Skip to content

Commit cd8a6c5

Browse files
committed
adds MouseEvent.preciseWheelRotation
1 parent 400fb64 commit cd8a6c5

File tree

3 files changed

+22
-4
lines changed

3 files changed

+22
-4
lines changed

sources/net.sf.j2s.java.core/src/java/awt/Component.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4130,7 +4130,8 @@ boolean dispatchMouseWheelToAncestor(MouseWheelEvent e) {
41304130
// source
41314131
newY, // y relative to new source
41324132
e.getXOnScreen(), e.getYOnScreen(), e.getClickCount(), e.isPopupTrigger(), e.getScrollType(),
4133-
e.getScrollAmount(), e.getWheelRotation());
4133+
e.getScrollAmount(), e.getWheelRotation(),
4134+
e.getPreciseWheelRotation());
41344135
((AWTEvent) e).copyPrivateDataInto(newMWE);
41354136
// When dispatching a wheel event to
41364137
// ancestor, there is no need trying to find descendant

sources/net.sf.j2s.java.core/src/java/awt/Container.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4733,7 +4733,8 @@ void retargetMouseEvent(Component target, int id, MouseEvent e) {
47334733
e.isPopupTrigger(),
47344734
((MouseWheelEvent)e).getScrollType(),
47354735
((MouseWheelEvent)e).getScrollAmount(),
4736-
((MouseWheelEvent)e).getWheelRotation());
4736+
((MouseWheelEvent)e).getWheelRotation(),
4737+
((MouseWheelEvent)e).getPreciseWheelRotation());
47374738
}
47384739
else {
47394740
retargeted = new MouseEvent(target,

sources/net.sf.j2s.java.core/src/java/awt/event/MouseWheelEvent.java

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,9 @@ public class MouseWheelEvent extends MouseEvent {
134134
* @see #getWheelRotation
135135
*/
136136
int wheelRotation;
137+
138+
double preciseWheelRotation;
139+
137140

138141
/*
139142
* serialVersionUID
@@ -179,7 +182,6 @@ public class MouseWheelEvent extends MouseEvent {
179182
public MouseWheelEvent (Component source, int id, long when, int modifiers,
180183
int x, int y, int clickCount, boolean popupTrigger,
181184
int scrollType, int scrollAmount, int wheelRotation) {
182-
183185
this(source, id, when, modifiers, x, y, 0, 0, clickCount,
184186
popupTrigger, scrollType, scrollAmount, wheelRotation);
185187
}
@@ -226,15 +228,24 @@ public MouseWheelEvent (Component source, int id, long when, int modifiers,
226228
public MouseWheelEvent (Component source, int id, long when, int modifiers,
227229
int x, int y, int xAbs, int yAbs, int clickCount, boolean popupTrigger,
228230
int scrollType, int scrollAmount, int wheelRotation) {
229-
231+
this(source, id, when, modifiers, x, y, xAbs, yAbs, clickCount, popupTrigger,
232+
scrollType, scrollAmount, wheelRotation, wheelRotation);
233+
}
234+
235+
public MouseWheelEvent (Component source, int id, long when, int modifiers,
236+
int x, int y, int xAbs, int yAbs, int clickCount, boolean popupTrigger,
237+
int scrollType, int scrollAmount, int wheelRotation, double preciseWheelRotation) {
238+
// ala Java 7
230239
super(source, id, when, modifiers, x, y, xAbs, yAbs, clickCount,
231240
popupTrigger, MouseEvent.NOBUTTON);
232241

233242
this.scrollType = scrollType;
234243
this.scrollAmount = scrollAmount;
235244
this.wheelRotation = wheelRotation;
245+
this.preciseWheelRotation = preciseWheelRotation;
236246
}
237247

248+
238249
/**
239250
* Returns the type of scrolling that should take place in response to this
240251
* event. This is determined by the native platform. Legal values are:
@@ -281,6 +292,11 @@ public int getWheelRotation() {
281292
return wheelRotation;
282293
}
283294

295+
public double getPreciseWheelRotation() {
296+
// SwingJS no different here
297+
return preciseWheelRotation;
298+
}
299+
284300
/**
285301
* This is a convenience method to aid in the implementation of
286302
* the common-case MouseWheelListener - to scroll a ScrollPane or

0 commit comments

Comments
 (0)