mirror of
https://github.com/bancika/diy-layout-creator
synced 2026-11-11 01:32:08 +10:00
right click rectangle selection
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -2,6 +2,8 @@ package org.diylc.swing.plugins.canvas;
|
||||
|
||||
import java.awt.dnd.DragGestureEvent;
|
||||
import java.awt.dnd.DragGestureListener;
|
||||
import java.awt.event.InputEvent;
|
||||
import java.awt.event.MouseEvent;
|
||||
|
||||
import org.diylc.common.IPlugInPort;
|
||||
|
||||
@@ -21,7 +23,13 @@ class CanvasGestureListener implements DragGestureListener {
|
||||
|
||||
@Override
|
||||
public void dragGestureRecognized(DragGestureEvent dge) {
|
||||
presenter.dragStarted(dge.getDragOrigin(), dge.getDragAction());
|
||||
boolean forceReSelection = false;
|
||||
InputEvent e = dge.getTriggerEvent();
|
||||
if (e instanceof MouseEvent) {
|
||||
MouseEvent me = (MouseEvent) e;
|
||||
forceReSelection = me.getButton() != MouseEvent.BUTTON1;
|
||||
}
|
||||
presenter.dragStarted(dge.getDragOrigin(), dge.getDragAction(), forceReSelection);
|
||||
dge.startDrag(presenter.getCursorAt(dge.getDragOrigin()), new EmptyTransferable(), new CanvasSourceListener(
|
||||
presenter));
|
||||
}
|
||||
|
||||
@@ -1764,7 +1764,7 @@
|
||||
</org.diylc.appframework.update.Change>
|
||||
<org.diylc.appframework.update.Change>
|
||||
<changeType>NEW_FEATURE</changeType>
|
||||
<description>Ability to force components to the front or back of other components even outisde their designated layers, allowing placing components or jumpers below boards, etc.</description>
|
||||
<description>Ability to force components to the front or back of other components even outisde their designated layers, allowing placing components or jumpers below boards, etc</description>
|
||||
</org.diylc.appframework.update.Change>
|
||||
<org.diylc.appframework.update.Change>
|
||||
<changeType>NEW_FEATURE</changeType>
|
||||
@@ -1772,7 +1772,7 @@
|
||||
</org.diylc.appframework.update.Change>
|
||||
<org.diylc.appframework.update.Change>
|
||||
<changeType>NEW_FEATURE</changeType>
|
||||
<description>Duplicate selection option in Edit menu and popup menu (Ctrl+D).</description>
|
||||
<description>Duplicate selection option in Edit menu and popup menu (Ctrl+D)</description>
|
||||
</org.diylc.appframework.update.Change>
|
||||
<org.diylc.appframework.update.Change>
|
||||
<changeType>NEW_FEATURE</changeType>
|
||||
@@ -1809,5 +1809,21 @@
|
||||
</changes>
|
||||
<url>https://github.com/bancika/diy-layout-creator/releases</url>
|
||||
</org.diylc.appframework.update.Version>
|
||||
<org.diylc.appframework.update.Version>
|
||||
<versionNumber>
|
||||
<major>3</major>
|
||||
<minor>41</minor>
|
||||
<build>0</build>
|
||||
</versionNumber>
|
||||
<releaseDate>2017-05-08 00:00:00.000 CET</releaseDate>
|
||||
<name></name>
|
||||
<changes>
|
||||
<org.diylc.appframework.update.Change>
|
||||
<changeType>NEW_FEATURE</changeType>
|
||||
<description>Using right click to draw a selection rectangle doesn't move objects under the cursor (useful for selecting multiple components that have a big board below)</description>
|
||||
</org.diylc.appframework.update.Change>
|
||||
</changes>
|
||||
<url>https://github.com/bancika/diy-layout-creator/releases</url>
|
||||
</org.diylc.appframework.update.Version>
|
||||
</a>
|
||||
</java.util.Arrays_-ArrayList>
|
||||
|
||||
Reference in New Issue
Block a user