You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@royale.apache.org by ha...@apache.org on 2021/03/12 08:27:48 UTC

[royale-asjs] branch develop updated: Better buttonDown support

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 8fb0543  Better buttonDown support
8fb0543 is described below

commit 8fb0543946fc589968d22d53689455d623781b3a
Author: Harbs <ha...@in-tools.com>
AuthorDate: Fri Mar 12 10:27:37 2021 +0200

    Better buttonDown support
---
 .../src/main/royale/org/apache/royale/events/MouseEvent.as   | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 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 6fbd371..29bf442 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
@@ -390,15 +390,19 @@ package org.apache.royale.events
         }
 
         private var _buttons:int = -1;
-        
         public function get buttonDown():Boolean
         {
-            return button > -1 && button < 3;
+            if(_buttons > -1)
+                return _buttons == 1;
+            var ev:* = wrappedEvent.getBrowserEvent();
+            //Safari does not yet support buttons
+            if ('buttons' in ev)
+                return ev["buttons"] == 1;
+            return ev["which"] == 1;
         }
-        
         public function set buttonDown(value:Boolean):void
         {
-            _button = value ? 0 : 9;// any value over 2 will be interpreted as no button down
+            _buttons = value ? 1 : 0;
         }
         
         private var _button:int = -1;