use of com.cburch.logisim.data.Location in project logisim-evolution by reds-heig.
the class InstanceComponent method recomputeBounds.
void recomputeBounds() {
Location p = loc;
bounds = factory.getOffsetBounds(attrs).translate(p.getX(), p.getY());
}
use of com.cburch.logisim.data.Location in project logisim-evolution by reds-heig.
the class InstancePainter method isPortConnected.
public boolean isPortConnected(int index) {
Circuit circ = context.getCircuit();
Location loc = comp.getEnd(index).getLocation();
return circ.isConnected(loc, comp);
}
use of com.cburch.logisim.data.Location in project logisim-evolution by reds-heig.
the class LineTool method mouseReleased.
@Override
public void mouseReleased(Canvas canvas, MouseEvent e) {
if (active) {
updateMouse(canvas, e.getX(), e.getY(), e.getModifiersEx());
Location start = mouseStart;
Location end = mouseEnd;
CanvasObject add = null;
if (!start.equals(end)) {
active = false;
CanvasModel model = canvas.getModel();
Location[] ends = { start, end };
List<Location> locs = UnmodifiableList.create(ends);
add = attrs.applyTo(new Poly(false, locs));
add.setValue(DrawAttr.PAINT_TYPE, DrawAttr.PAINT_STROKE);
canvas.doAction(new ModelAddAction(model, add));
repaintArea(canvas);
}
canvas.toolGestureComplete(this, add);
}
}
use of com.cburch.logisim.data.Location in project logisim-evolution by reds-heig.
the class LineTool method mousePressed.
@Override
public void mousePressed(Canvas canvas, MouseEvent e) {
int x = e.getX();
int y = e.getY();
int mods = e.getModifiersEx();
if ((mods & InputEvent.CTRL_DOWN_MASK) != 0) {
x = canvas.snapX(x);
y = canvas.snapY(y);
}
Location loc = Location.create(x, y);
mouseStart = loc;
mouseEnd = loc;
lastMouseX = loc.getX();
lastMouseY = loc.getY();
active = canvas.getModel() != null;
repaintArea(canvas);
}
use of com.cburch.logisim.data.Location in project logisim-evolution by reds-heig.
the class LineTool method draw.
@Override
public void draw(Canvas canvas, Graphics g) {
if (active) {
Location start = mouseStart;
Location end = mouseEnd;
g.setColor(Color.GRAY);
g.drawLine(start.getX(), start.getY(), end.getX(), end.getY());
}
}
Aggregations