You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@royale.apache.org by ca...@apache.org on 2018/09/05 11:13:58 UTC

[royale-asjs] branch feature/new_merge updated: make Jewel Image use cursor pointer if MouseEvent is configured

This is an automated email from the ASF dual-hosted git repository.

carlosrovira pushed a commit to branch feature/new_merge
in repository https://gitbox.apache.org/repos/asf/royale-asjs.git


The following commit(s) were added to refs/heads/feature/new_merge by this push:
     new c3231e7  make Jewel Image use cursor pointer if MouseEvent is configured
c3231e7 is described below

commit c3231e7bd3a4c3820991d214da6e5895daf994f1
Author: Carlos Rovira <ca...@apache.org>
AuthorDate: Wed Sep 5 13:13:53 2018 +0200

    make Jewel Image use cursor pointer if MouseEvent is configured
---
 .../JewelExample/src/main/royale/MainContent.mxml  |  2 +-
 .../main/royale/org/apache/royale/jewel/Image.as   | 28 ++++++++++++++++++++++
 2 files changed, 29 insertions(+), 1 deletion(-)

diff --git a/examples/royale/JewelExample/src/main/royale/MainContent.mxml b/examples/royale/JewelExample/src/main/royale/MainContent.mxml
index 25adfcf..fd7928f 100644
--- a/examples/royale/JewelExample/src/main/royale/MainContent.mxml
+++ b/examples/royale/JewelExample/src/main/royale/MainContent.mxml
@@ -62,7 +62,7 @@ limitations under the License.
             <j:ResponsiveDrawer auto="true"/>
         </j:beads>
         <j:DrawerHeader>
-            <j:Image src="assets/apache-royale-jewel-logo-white.svg" height="140" click="goToHome()" className="cursor-pointer"/>
+            <j:Image src="assets/apache-royale-jewel-logo-white.svg" height="140" click="goToHome()"/>
         </j:DrawerHeader>
         <j:DrawerContent>
             <j:Navigation change="changeHandler(event)" className="navIconLinkItemRenderer">
diff --git a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/Image.as b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/Image.as
index 742c732..c7c6496 100644
--- a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/Image.as
+++ b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/Image.as
@@ -19,6 +19,7 @@
 package org.apache.royale.jewel
 {
 	import org.apache.royale.core.supportClasses.StyledImageBase;
+	import org.apache.royale.events.MouseEvent;
 
     COMPILE::JS
     {
@@ -77,5 +78,32 @@ package org.apache.royale.jewel
 			(element as HTMLImageElement).src = binaryDataAsString;
 		}
 
+
+		COMPILE::JS
+		override public function addEventListener(type:String, handler:Function, opt_capture:Boolean = false, opt_handlerScope:Object = null):void
+        {
+            super.addEventListener(type, handler, opt_capture, opt_handlerScope);
+			if(type == MouseEvent.CLICK || type == MouseEvent.MOUSE_DOWN || type == MouseEvent.ROLL_OVER ||
+					type == MouseEvent.MOUSE_UP || type == MouseEvent.MOUSE_MOVE || type == MouseEvent.MOUSE_OVER || 
+					type == MouseEvent.ROLL_OUT || type == MouseEvent.MOUSE_OUT ||
+					type == MouseEvent.DOUBLE_CLICK || type == MouseEvent.WHEEL)
+			{
+				addClass("cursor-pointer");
+			}
+        }
+        
+		COMPILE::JS
+        override public function removeEventListener(type:String, handler:Function, opt_capture:Boolean = false, opt_handlerScope:Object = null):void
+        {
+            super.removeEventListener(type, handler, opt_capture, opt_handlerScope);
+			if(type == MouseEvent.CLICK || type == MouseEvent.MOUSE_DOWN || type == MouseEvent.ROLL_OVER ||
+					type == MouseEvent.MOUSE_UP || type == MouseEvent.MOUSE_MOVE || type == MouseEvent.MOUSE_OVER || 
+					type == MouseEvent.ROLL_OUT || type == MouseEvent.MOUSE_OUT ||
+					type == MouseEvent.DOUBLE_CLICK || type == MouseEvent.WHEEL)
+			{
+				removeClass("cursor-pointer");
+			}
+
+        }
 	}
 }