right click rectangle selection

This commit is contained in:
bancika
2017-05-10 15:25:43 +02:00
parent a8665271b0
commit d1a7227f4c
4 changed files with 33 additions and 8 deletions
@@ -37,8 +37,9 @@ public interface IMouseProcessor {
*
* @param point
* @param dragAction
* @param forceSelectionRect
*/
void dragStarted(Point point, int dragAction);
void dragStarted(Point point, int dragAction, boolean forceSelectionRect);
/**
* Checks if it's possible to drop over the specified point.
@@ -899,7 +899,7 @@ public class Presenter implements IPlugInPort {
}
@Override
public void dragStarted(Point point, int dragAction) {
public void dragStarted(Point point, int dragAction, boolean forceSelectionRect) {
LOG.debug(String.format("dragStarted(%s, %s)", point, dragAction));
if (instantiationManager.getComponentTypeSlot() != null) {
LOG.debug("Cannot start drag because a new component is being created.");
@@ -912,7 +912,7 @@ public class Presenter implements IPlugInPort {
this.preDragProject = currentProject.clone();
Point scaledPoint = scalePoint(point);
this.previousDragPoint = scaledPoint;
List<IDIYComponent<?>> components = findComponentsAtScaled(scaledPoint);
List<IDIYComponent<?>> components = forceSelectionRect ? null : findComponentsAtScaled(scaledPoint);
if (!this.controlPointMap.isEmpty()) {
// If we're dragging control points reset selection.
updateSelection(new ArrayList<IDIYComponent<?>>(this.controlPointMap.keySet()));
@@ -921,7 +921,7 @@ public class Presenter implements IPlugInPort {
// messageDispatcher.dispatchMessage(EventType.SELECTION_SIZE_CHANGED,
// calculateSelectionDimension());
messageDispatcher.dispatchMessage(EventType.REPAINT);
} else if (components.isEmpty()) {
} else if (components == null || components.isEmpty()) {
// If there are no components are under the cursor, reset selection.
updateSelection(EMPTY_SELECTION);
// messageDispatcher.dispatchMessage(EventType.SELECTION_CHANGED,
@@ -1442,7 +1442,7 @@ public class Presenter implements IPlugInPort {
updateSelection(newSelection);
messageDispatcher.dispatchMessage(EventType.PROJECT_MODIFIED, oldProject, currentProject.clone(), "Duplicate");
messageDispatcher.dispatchMessage(EventType.PROJECT_MODIFIED, oldProject, currentProject.clone(), "Duplicate");
projectFileManager.notifyFileChange();
messageDispatcher.dispatchMessage(EventType.REPAINT);
}