This is an automated email from the ASF dual-hosted git repository. harbs pushed a commit to branch develop in repository https://gitbox.apache.org/repos/asf/royale-asjs.git
The following commit(s) were added to refs/heads/develop by this push: new 4701c5e Fixed MouseEvent button tracking 4701c5e is described below commit 4701c5e13904857bee12176c5978404a0e1f4a1c Author: Harbs <ha...@in-tools.com> AuthorDate: Tue Mar 19 11:13:55 2019 +0200 Fixed MouseEvent button tracking --- .../royale/org/apache/royale/events/MouseEvent.as | 37 +++++++++++++++------- 1 file changed, 25 insertions(+), 12 deletions(-) diff --git a/frameworks/projects/Core/src/main/royale/org/apache/royale/events/MouseEvent.as b/frameworks/projects/Core/src/main/royale/org/apache/royale/events/MouseEvent.as index 8e878d3..f277ae7 100644 --- a/frameworks/projects/Core/src/main/royale/org/apache/royale/events/MouseEvent.as +++ b/frameworks/projects/Core/src/main/royale/org/apache/royale/events/MouseEvent.as @@ -331,25 +331,38 @@ package org.apache.royale.events private var _buttons:int = -1; public function get buttonDown():Boolean { - if(_buttons > -1) - return _buttons == 1; - if(!wrappedEvent) - return false; - //Safari does not yet support buttons - if ('buttons' in nativeEvent) - _buttons = nativeEvent["buttons"]; - else - _buttons = nativeEvent["which"]; - return _buttons == 1; + return button > -1 && button < 3; } public function set buttonDown(value:Boolean):void { - _buttons = value ? 1 : 0; + _button = value ? 0 : 9;// any value over 2 will be interpreted as no button down + } + + private var _button:int = -1; + + /** + * see https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/button + */ + public function get button():int + { + if(_button > -1) + return _button; + return nativeEvent["button"]; + } + + public function set button(value:int):void + { + _button = value; } + /** + * see https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/buttons + */ public function get buttons():int { - return _buttons; + if(_buttons > -1) + return _buttons; + return nativeEvent["buttons"]; } public function set buttons(value:int):void {