use of com.cburch.draw.actions.ModelAddAction 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);
}
}
Aggregations