import java.lang.reflect.Method;
import java.util.LinkedList;
+import org.simantics.scenegraph.g2d.events.MouseEvent.MouseWheelMovedEvent;
import org.simantics.utils.datastructures.ListenerList;
import org.simantics.utils.threads.IThreadWorkQueue;
import org.simantics.utils.threads.SyncListenerList;
return EventTypes.AnyMask;
}
+ /**
+ *
+ */
+ private MouseWheelMovedEvent lastMouseWheelMovedEvent;
+
+ private static final String DISABLE_DUPLICATE_REMOVAL = "org.simantics.scenegraph.g2d.events.disableDuplicateMouseWheelEvent";
+ private static final boolean IGNORE_DUPLICATE = !Boolean.parseBoolean(System.getProperty(DISABLE_DUPLICATE_REMOVAL));
+
+ private boolean ignoreDuplicateMouseWheelMovedEvent(Event e) {
+ if (IGNORE_DUPLICATE && e instanceof MouseWheelMovedEvent) {
+ if (e.time > 0 && (lastMouseWheelMovedEvent != null && lastMouseWheelMovedEvent.time < 0)) {
+ return true;
+ }
+ lastMouseWheelMovedEvent = (MouseWheelMovedEvent) e;
+ }
+ return false;
+ }
+
@Override
public synchronized void queueEvent(Event e) {
+ if (ignoreDuplicateMouseWheelMovedEvent(e))
+ return;
// coalesce with last
EventCoalescer[] css = coalescers.getListeners();
if (css.length > 0 && !queue.isEmpty()) {