Search in sources :

Example 6 with HandleGesture

use of com.cburch.draw.model.HandleGesture in project logisim-evolution by reds-heig.

the class Selection method modelChanged.

void modelChanged(CanvasModelEvent event) {
    int action = event.getAction();
    switch(action) {
        case CanvasModelEvent.ACTION_REMOVED:
            Collection<? extends CanvasObject> affected = event.getAffected();
            if (affected != null) {
                selected.removeAll(affected);
                suppressed.keySet().removeAll(affected);
                Handle h = selectedHandle;
                if (h != null && affected.contains(h.getObject())) {
                    setHandleSelected(null);
                }
            }
            break;
        case CanvasModelEvent.ACTION_HANDLE_DELETED:
            if (event.getHandle().equals(selectedHandle)) {
                setHandleSelected(null);
            }
            break;
        case CanvasModelEvent.ACTION_HANDLE_MOVED:
            HandleGesture gesture = event.getHandleGesture();
            if (gesture.getHandle().equals(selectedHandle)) {
                setHandleSelected(gesture.getResultingHandle());
            }
            break;
        default:
            break;
    }
}
Also used : HandleGesture(com.cburch.draw.model.HandleGesture) Handle(com.cburch.draw.model.Handle)

Example 7 with HandleGesture

use of com.cburch.draw.model.HandleGesture in project logisim-evolution by reds-heig.

the class Selection method setHandleGesture.

public void setHandleGesture(HandleGesture gesture) {
    HandleGesture g = curHandleGesture;
    if (g != null)
        suppressed.remove(g.getHandle().getObject());
    Handle h = gesture.getHandle();
    suppressed.put(h.getObject(), MOVING_HANDLE);
    curHandleGesture = gesture;
}
Also used : HandleGesture(com.cburch.draw.model.HandleGesture) Handle(com.cburch.draw.model.Handle)

Aggregations

Handle (com.cburch.draw.model.Handle)7 HandleGesture (com.cburch.draw.model.HandleGesture)7 CanvasObject (com.cburch.draw.model.CanvasObject)4 Selection (com.cburch.draw.canvas.Selection)3 Location (com.cburch.logisim.data.Location)3 ModelMoveHandleAction (com.cburch.draw.actions.ModelMoveHandleAction)1 ModelTranslateAction (com.cburch.draw.actions.ModelTranslateAction)1 CanvasModel (com.cburch.draw.model.CanvasModel)1 Bounds (com.cburch.logisim.data.Bounds)1 Graphics (java.awt.Graphics)1 Graphics2D (java.awt.Graphics2D)1