1 16 package com.google.gwt.user.client.ui; 17 18 import com.google.gwt.user.client.DOM; 19 import com.google.gwt.user.client.Event; 20 21 29 public class MouseWheelVelocity { 30 31 34 protected final int vY; 35 36 41 public MouseWheelVelocity(Event e) { 42 vY = DOM.eventGetMouseWheelVelocityY(e); 43 } 44 45 public boolean equals(Object o) { 46 if (o instanceof MouseWheelVelocity) { 47 MouseWheelVelocity v = (MouseWheelVelocity) o; 48 return getDeltaY() == v.getDeltaY(); 49 } 50 51 return false; 52 } 53 54 60 public int getDeltaY() { 61 return vY; 62 } 63 64 public int hashCode() { 65 return getDeltaY(); 66 } 67 68 75 public boolean isNorth() { 76 return getDeltaY() < 0; 77 } 78 79 86 public boolean isSouth() { 87 return getDeltaY() > 0; 88 } 89 90 public String toString() { 91 return "<" + getDeltaY() + ">"; 92 } 93 } 94 | Popular Tags |