Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
K
kernel
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
af3
kernel
Commits
56715a82
Commit
56715a82
authored
9 years ago
by
Vincent Aravantinos
Browse files
Options
Downloads
Patches
Plain Diff
made the moves follow the grid
refs 1948
parent
f599e143
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
org.fortiss.tooling.base.ui/trunk/src/org/fortiss/tooling/base/ui/editor/DiagramKeyHandler.java
+6
-3
6 additions, 3 deletions
...org/fortiss/tooling/base/ui/editor/DiagramKeyHandler.java
with
6 additions
and
3 deletions
org.fortiss.tooling.base.ui/trunk/src/org/fortiss/tooling/base/ui/editor/DiagramKeyHandler.java
+
6
−
3
View file @
56715a82
...
...
@@ -17,6 +17,8 @@ $Id$
+--------------------------------------------------------------------------*/
package
org.fortiss.tooling.base.ui.editor
;
import
static
org
.
fortiss
.
tooling
.
base
.
layout
.
DefaultLayoutConstants
.
DEFAULT_GRID_SIZE
;
import
org.eclipse.draw2d.FigureCanvas
;
import
org.eclipse.draw2d.geometry.Point
;
import
org.eclipse.draw2d.geometry.Rectangle
;
...
...
@@ -41,7 +43,7 @@ import org.fortiss.tooling.kernel.service.IPersistencyService;
* @author aravantinos
* @author $Author$
* @version $Rev$
* @ConQAT.Rating YELLOW Hash:
7EC7261CB45A60C97A9AF00CA6E0A15
0
* @ConQAT.Rating YELLOW Hash:
5C22B7A1E2A086815AD43784943CE42
0
*/
public
class
DiagramKeyHandler
extends
KeyHandler
{
...
...
@@ -78,7 +80,7 @@ public class DiagramKeyHandler extends KeyHandler {
return
false
;
FigureCanvas
figCanvas
=
(
FigureCanvas
)
viewer
.
getControl
();
Point
loc
=
figCanvas
.
getViewport
().
getViewLocation
();
Rectangle
area
=
figCanvas
.
getViewport
().
getClientArea
(
Rectangle
.
SINGLETON
).
scale
(.
0
1
);
Rectangle
area
=
figCanvas
.
getViewport
().
getClientArea
(
Rectangle
.
SINGLETON
).
scale
(.
1
);
Point
scrollCoeff
=
computeScrollCoeff
(
event
);
figCanvas
.
scrollToY
(
loc
.
y
+
scrollCoeff
.
y
*
area
.
height
);
figCanvas
.
scrollToX
(
loc
.
x
+
scrollCoeff
.
x
*
area
.
width
);
...
...
@@ -96,6 +98,7 @@ public class DiagramKeyHandler extends KeyHandler {
(
ILayoutedModelElement
)
viewer
.
getFocusEditPart
().
getModel
();
ITopLevelElement
topLevel
=
IPersistencyService
.
INSTANCE
.
getTopLevelElementFor
(
model
);
final
Point
scrollCoeff
=
computeScrollCoeff
(
event
);
scrollCoeff
.
scale
(
DEFAULT_GRID_SIZE
);
topLevel
.
runAsCommand
(
new
Runnable
()
{
@Override
public
void
run
()
{
...
...
@@ -111,7 +114,7 @@ public class DiagramKeyHandler extends KeyHandler {
* Coefficient of 1 if the SHIFT key is not pressed, 50 otherwise.
*/
private
Point
computeScrollCoeff
(
KeyEvent
event
)
{
int
coeff
=
(
event
.
stateMask
&
SWT
.
SHIFT
)
==
0
?
1
:
5
0
;
int
coeff
=
(
event
.
stateMask
&
SWT
.
SHIFT
)
==
0
?
1
:
1
0
;
if
(
event
.
keyCode
==
SWT
.
ARROW_DOWN
)
return
new
Point
(
0
,
coeff
);
if
(
event
.
keyCode
==
SWT
.
ARROW_UP
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment