| author | ujhelyiz | 2011-02-20 16:30:36 (EST) |
|---|---|---|
| committer | Fabian Steeg | 2011-02-20 21:12:22 (EST) |
| commit | 15bd2585432ec7b9273e3de16d243865f5f2d7c1 (patch) (side-by-side diff) | |
| tree | 4a23e6594890691bd2c24a917d372538595726fd | |
| parent | 2f66c3a4c02bea4a4ab409a638d014c75081ba5e (diff) | |
| download | org.eclipse.gef4-15bd2585432ec7b9273e3de16d243865f5f2d7c1.zip org.eclipse.gef4-15bd2585432ec7b9273e3de16d243865f5f2d7c1.tar.gz org.eclipse.gef4-15bd2585432ec7b9273e3de16d243865f5f2d7c1.tar.bz2 | |
Key modifiers updated
| -rw-r--r-- | org.eclipse.zest.core/src/org/eclipse/zest/core/widgets/Graph.java | 62 |
1 files changed, 32 insertions, 30 deletions
diff --git a/org.eclipse.zest.core/src/org/eclipse/zest/core/widgets/Graph.java b/org.eclipse.zest.core/src/org/eclipse/zest/core/widgets/Graph.java index 0a85e31..d99455b 100644 --- a/org.eclipse.zest.core/src/org/eclipse/zest/core/widgets/Graph.java +++ b/org.eclipse.zest.core/src/org/eclipse/zest/core/widgets/Graph.java @@ -744,32 +744,34 @@ public class Graph extends FigureCanvas implements IContainer { getRootLayer().translateToRelative(mousePoint); - if (me.getState() == SWT.ALT) { - double scale = getRootLayer().getScale(); - scale *= 1.05; - getRootLayer().setScale(scale); - Point newMousePoint = mousePoint.getCopy().scale(1.05); - Point delta = new Point(newMousePoint.x - mousePoint.x, - newMousePoint.y - mousePoint.y); - Point newViewLocation = getViewport().getViewLocation() - .getCopy().translate(delta); - getViewport().setViewLocation(newViewLocation); - - clearSelection(); - return; - } else if (me.getState() == (SWT.ALT | SWT.SHIFT)) { - double scale = getRootLayer().getScale(); - scale /= 1.05; - getRootLayer().setScale(scale); - - Point newMousePoint = mousePoint.getCopy().scale(1 / 1.05); - Point delta = new Point(newMousePoint.x - mousePoint.x, - newMousePoint.y - mousePoint.y); - Point newViewLocation = getViewport().getViewLocation() - .getCopy().translate(delta); - getViewport().setViewLocation(newViewLocation); - clearSelection(); - return; + if ((me.getState() & SWT.MOD3) != 0) { + if ((me.getState() & SWT.MOD2) == 0) { + double scale = getRootLayer().getScale(); + scale *= 1.05; + getRootLayer().setScale(scale); + Point newMousePoint = mousePoint.getCopy().scale(1.05); + Point delta = new Point(newMousePoint.x - mousePoint.x, + newMousePoint.y - mousePoint.y); + Point newViewLocation = getViewport().getViewLocation() + .getCopy().translate(delta); + getViewport().setViewLocation(newViewLocation); + + clearSelection(); + return; + } else { + double scale = getRootLayer().getScale(); + scale /= 1.05; + getRootLayer().setScale(scale); + + Point newMousePoint = mousePoint.getCopy().scale(1 / 1.05); + Point delta = new Point(newMousePoint.x - mousePoint.x, + newMousePoint.y - mousePoint.y); + Point newViewLocation = getViewport().getViewLocation() + .getCopy().translate(delta); + getViewport().setViewLocation(newViewLocation); + clearSelection(); + return; + } } else { boolean hasSelection = selectedItems.size() > 0; IFigure figureUnderMouse = getFigureAt(mousePoint.x, @@ -784,7 +786,7 @@ public class Graph extends FigureCanvas implements IContainer { // being held down, then select // nothing if (figureUnderMouse == null || figureUnderMouse == Graph.this) { - if (me.getState() != SWT.CONTROL) { + if ((me.getState() & SWT.MOD1) != 0) { clearSelection(); if (hasSelection) { fireWidgetSelectedEvent(null); @@ -797,7 +799,7 @@ public class Graph extends FigureCanvas implements IContainer { GraphItem itemUnderMouse = (GraphItem) figure2ItemMap .get(figureUnderMouse); if (itemUnderMouse == null) { - if (me.getState() != SWT.CONTROL) { + if ((me.getState() & SWT.MOD1) != 0) { clearSelection(); if (hasSelection) { fireWidgetSelectedEvent(null); @@ -811,7 +813,7 @@ public class Graph extends FigureCanvas implements IContainer { // held down, remove this selection // @tag Zest.selection : This deselects when you have CTRL // pressed - if (me.getState() == SWT.CONTROL) { + if ((me.getState() & SWT.MOD1) != 0) { selectedItems.remove(itemUnderMouse); (itemUnderMouse).unhighlight(); fireWidgetSelectedEvent(itemUnderMouse); @@ -819,7 +821,7 @@ public class Graph extends FigureCanvas implements IContainer { return; } - if (me.getState() != SWT.CONTROL) { + if ((me.getState() & SWT.MOD1) == 0) { clearSelection(); } |

