Pointer display

This commit is contained in:
2025-08-20 15:34:13 +02:00
parent 83a1ae739d
commit 45cb47eb71
4 changed files with 40 additions and 0 deletions

View File

@@ -436,6 +436,18 @@ public class BasePlatePanel extends DevicePanel {
}
}
void pointPuck(Puck puck){
if (puck != null){
puck.setPointed(true);
} else {
for (Puck p : getDevice().getPucks()) {
p.setPointed(false);
}
}
repaint();
}
void onPuckPressed(MouseEvent e, Puck puck){
if (getSelectionMode()!=SelectionMode.None){
if (TOGGLE_SELECTION){

View File

@@ -759,6 +759,7 @@ public class Controller {
public void setLaserPos(String pos){
try {
getMainFrame().evalAsync("set_laser_pos(" + ((pos==null) ? "" : ("'" + pos + "'") ) + ")" ,true);
getMainFrame().basePlatePanel.pointPuck((pos==null) ? null : basePlate.getPuckByName(pos));
} catch (Interpreter.InterpreterStateException ex) {
Logger.getLogger(Controller.class.getName()).log(Level.SEVERE, null, ex);
}

View File

@@ -454,6 +454,26 @@ public class Puck extends DeviceBase {
}
}
private boolean pointed;
public boolean isPointed() {
return pointed;
}
public void setPointed(boolean value) {
if (value != pointed) {
if (value == true) {
for (Device d : getParent().getChildren()) {
if (d instanceof Puck puck) {
puck.pointed = false;
}
}
}
pointed = value;
}
}
public int getNumberOfSamples() {
return numberOfSamples;
}

View File

@@ -315,6 +315,13 @@ public class PuckGraphics {
g.drawOval(pu.x - unipuckSize / 2, pu.y - unipuckSize / 2, unipuckSize, unipuckSize);
g.drawOval(pm.x - minispineSize / 2, pm.y - minispineSize / 2, minispineSize, minispineSize);
}
//Draw pointed
if (puck.isPointed()){
int pointerSize = 8;
g.setColor(Color.red);
g.drawOval(position.x - pointerSize / 2, position.y - pointerSize / 2, pointerSize, pointerSize);
}
//Draw text
String id = puck.getId();