These constants are expected to be used with NativeEvent.getButton(). GWT's implementation translates 0, 1, 2 to 1, 2, 4. The values 1, 2, 4 had been used by IE.
See DOMImplStandard.eventGetButton(). -- J. Craig Mitchell schrieb am Montag, 4. August 2025 um 03:36:12 UTC+2: > PSA: GWT uses old mouse button constants > in com.google.gwt.dom.client.NativeEvent: > > public static final int BUTTON_LEFT = 1; > public static final int BUTTON_MIDDLE = 4; > public static final int BUTTON_RIGHT = 2; > > These are not the correct values to use with > Elemental2 elemental2.dom.MouseEvent.button. > > JavaScript now uses > https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/button so > these are the correct values: > > public static final int BUTTON_LEFT = 0; > public static final int BUTTON_MIDDLE = 1; > public static final int BUTTON_RIGHT = 2; > > The keyboard key code constants are also old in GWT, but that one was > obvious, as GWT has key codes as integers, while Elemental2 has key codes > as strings. > > I couldn't find any definitions for these new mouse buttons or key codes. > I still need to have a look at projects like Akasha and Elemento, as > hopefully they fix these Elemental2 gotchas. > -- You received this message because you are subscribed to the Google Groups "GWT Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion visit https://groups.google.com/d/msgid/google-web-toolkit/7d90c4d8-496d-464d-9f15-48b6273bb369n%40googlegroups.com.
