Merge lp:~yrke/tapaal/fix1894107-mouseWheelOnPTO into lp:tapaal

Proposed by Kenneth Yrke Jørgensen
Status: Merged
Approved by: Jiri Srba
Approved revision: 1100
Merged at revision: 1101
Proposed branch: lp:~yrke/tapaal/fix1894107-mouseWheelOnPTO
Merge into: lp:tapaal
Diff against target: 54 lines (+19/-11)
1 file modified
src/dk/aau/cs/gui/TabContent.java (+19/-11)
To merge this branch: bzr merge lp:~yrke/tapaal/fix1894107-mouseWheelOnPTO
Reviewer Review Type Date Requested Status
TAPAAL Reviewers Pending
Review via email: mp+390741@code.launchpad.net
To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/dk/aau/cs/gui/TabContent.java'
2--- src/dk/aau/cs/gui/TabContent.java 2020-09-03 08:21:27 +0000
3+++ src/dk/aau/cs/gui/TabContent.java 2020-09-15 13:11:48 +0000
4@@ -2688,32 +2688,40 @@
5 e->arcDoubleClickedWithContrl(((Arc) e.pno), e.e)
6 );
7 registerEvent(
8- e->e.pno instanceof TimedPlaceComponent && e.a == MouseAction.wheel && e.e.isShiftDown(),
9+ e->e.pno instanceof TimedPlaceComponent && e.a == MouseAction.wheel,
10 e->timedPlaceMouseWheelWithShift(((TimedPlaceComponent) e.pno), ((MouseWheelEvent) e.e))
11 );
12 registerEvent(
13- e->e.pno instanceof TimedTransitionComponent && e.a == MouseAction.wheel && e.e.isShiftDown(),
14+ e->e.pno instanceof TimedTransitionComponent && e.a == MouseAction.wheel,
15 e->timedTranstionMouseWheelWithShift(((TimedTransitionComponent) e.pno), ((MouseWheelEvent) e.e))
16 );
17
18 }
19
20 private void timedTranstionMouseWheelWithShift(TimedTransitionComponent p, MouseWheelEvent e) {
21- int rotation = 0;
22- if (e.getWheelRotation() < 0) {
23- rotation = -e.getWheelRotation() * 135;
24+ if (p.isSelected()) {
25+ int rotation = 0;
26+ if (e.getWheelRotation() < 0) {
27+ rotation = -e.getWheelRotation() * 135;
28+ } else {
29+ rotation = e.getWheelRotation() * 45;
30+ }
31+
32+ CreateGui.getCurrentTab().getUndoManager().addNewEdit(((Transition) p).rotate(rotation));
33 } else {
34- rotation = e.getWheelRotation() * 45;
35+ p.getParent().dispatchEvent(e);
36 }
37-
38- CreateGui.getCurrentTab().getUndoManager().addNewEdit(((Transition) p).rotate(rotation));
39 }
40
41 private void timedPlaceMouseWheelWithShift(TimedPlaceComponent p, MouseWheelEvent e) {
42- if (e.getWheelRotation() < 0) {
43- guiModelManager.addToken(getModel(), p, 1);
44+ if (p.isSelected()) {
45+ if (e.getWheelRotation() < 0) {
46+ guiModelManager.addToken(getModel(), p, 1);
47+ } else {
48+ guiModelManager.removeToken(getModel(), p, 1);
49+ }
50 } else {
51- guiModelManager.removeToken(getModel(), p, 1);
52+ p.getParent().dispatchEvent(e);
53 }
54 }
55

Subscribers

People subscribed via source and target branches