use of edu.cmu.cs.hcii.cogtool.uimodel.DesignEditorTransition in project cogtool by cogtool.
the class DesignEditorMouseState method handleMousePressed.
// dealWithMouseDoubleClicked
protected void handleMousePressed(int filter) {
if (filter == StructureViewUIModel.NO_LABEL) {
ResizeThumb thumb = ui.getResizeAtXY(mouseDownX, mouseDownY);
if (thumb != null) {
hitTransition = (DesignEditorTransition) thumb.getData();
selection.setSelectedTransition(hitTransition);
if (thumb.thumbType == DesignEditorUI.SOURCE) {
setMouseState(PotentialChangeSource);
} else {
setMouseState(PotentialChangeTarget);
}
return;
}
}
IFigure target = ui.structureView.getFigureAtXY(mouseDownX, mouseDownY, filter);
if (target instanceof DesignEditorTransition) {
hitTransition = (DesignEditorTransition) target;
if ((mouseDownState & InputEvent.SHIFT) != 0) {
setMouseState(PotentialToggleTransition);
} else {
setMouseState(PotentialSelectTransition);
}
} else if (target instanceof GraphicalSource<?>) {
potentialTransitionSource = (GraphicalSource<?>) target;
setMouseState(PotentialCreatingTransition);
// drag creates arrow
} else if (target instanceof DesignEditorFrame) {
DesignEditorFrame frameFigure = (DesignEditorFrame) target;
Frame frame = frameFigure.getFrame();
if ((mouseDownState & InputEvent.SHIFT) != 0) {
setMouseState(PotentialTogglingSelection);
} else if ((mouseDownState & platformDuplicateModifierKey()) != 0) {
if (!selection.isFrameSelected(frame)) {
selection.setSelectedFrame(frameFigure);
}
setMouseState(PotentialDuplicatingFrame);
} else {
if (selection.isFrameSelected(frame)) {
setMouseState(PotentialMovingSelection);
} else {
selection.setSelectedFrame(frameFigure);
setMouseState(PotentialMovingFrame);
}
}
} else {
// out in space
if ((mouseDownState & InputEvent.SHIFT) != 0) {
setMouseState(PotentialTogglingSelection);
} else {
selection.deselectAll();
setMouseState(PotentialSelectingFrames);
}
}
}
Aggregations