package org.simantics.scenegraph.g2d.events; import java.awt.Component; import java.awt.event.MouseEvent; import java.awt.event.MouseWheelEvent; import java.lang.ref.WeakReference; public class SGMouseWheelEvent extends MouseWheelEvent implements ISGMouseEvent { /** * */ private static final long serialVersionUID = 1L; private double _x; private double _y; private WeakReference _orig; public SGMouseWheelEvent(Component source, int id, long when, int modifiers, int x, int y, int xAbs, int yAbs, int clickCount, boolean popupTrigger, int scrollType, int scrollAmount, int wheelRotation, MouseEvent orig) { super(source, id, when, modifiers, x, y, xAbs, yAbs, clickCount, popupTrigger, scrollType, scrollAmount, wheelRotation); this._x = x; this._y = y; this._orig = new WeakReference(orig); } public SGMouseWheelEvent(Component source, int id, long when, int modifiers, int x, int y, int clickCount, boolean popupTrigger, int scrollType, int scrollAmount, int wheelRotation, MouseEvent orig) { super(source, id, when, modifiers, x, y, clickCount, popupTrigger, scrollType, scrollAmount, wheelRotation); this._x = x; this._y = y; this._orig = new WeakReference(orig); } public SGMouseWheelEvent(Component source, int id, long when, int modifiers, double x, double y, int xAbs, int yAbs, int clickCount, boolean popupTrigger, int scrollType, int scrollAmount, int wheelRotation, MouseEvent orig) { super(source, id, when, modifiers, (int)x, (int)y, xAbs, yAbs, clickCount, popupTrigger, scrollType, scrollAmount, wheelRotation); this._x = x; this._y = y; this._orig = new WeakReference(orig); } public SGMouseWheelEvent(Component source, int id, long when, int modifiers, double x, double y, int clickCount, boolean popupTrigger, int scrollType, int scrollAmount, int wheelRotation, MouseEvent orig) { super(source, id, when, modifiers, (int)x, (int)y, clickCount, popupTrigger, scrollType, scrollAmount, wheelRotation); this._x = x; this._y = y; this._orig = new WeakReference(orig); } public double getDoubleX() { return _x; } public double getDoubleY() { return _y; } @Override public void consume() { MouseEvent e =_orig.get(); if(e != null) e.consume(); super.consume(); } @Override public boolean isConsumed() { MouseEvent e =_orig.get(); if(e != null) return e.isConsumed(); return super.isConsumed(); } }