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 2019/04/20 20:15:18 UTC

[royale-asjs] branch develop updated: jewel-tabbariconitemrenderer: add "restrictIndicatorToContent" boolean property to make indicator be restricted or not to the content

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

carlosrovira 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 dd4f0ae  jewel-tabbariconitemrenderer: add "restrictIndicatorToContent" boolean property to make indicator be restricted or not to the content
dd4f0ae is described below

commit dd4f0ae62a754ce4603e59ee1e9ec5f2c23efacd
Author: Carlos Rovira <ca...@apache.org>
AuthorDate: Sat Apr 20 22:15:11 2019 +0200

    jewel-tabbariconitemrenderer: add "restrictIndicatorToContent" boolean property to make indicator be restricted or not to the content
---
 .../itemRenderers/TabBarIconItemRenderer.mxml      |  3 +-
 .../itemRenderers/TabBarButtonItemRenderer.as      | 35 +++++++++++++++++++++-
 2 files changed, 36 insertions(+), 2 deletions(-)

diff --git a/examples/royale/TourDeJewel/src/main/royale/itemRenderers/TabBarIconItemRenderer.mxml b/examples/royale/TourDeJewel/src/main/royale/itemRenderers/TabBarIconItemRenderer.mxml
index 915af81..25be2ed 100644
--- a/examples/royale/TourDeJewel/src/main/royale/itemRenderers/TabBarIconItemRenderer.mxml
+++ b/examples/royale/TourDeJewel/src/main/royale/itemRenderers/TabBarIconItemRenderer.mxml
@@ -21,7 +21,8 @@ limitations under the License.
     xmlns:j="library://ns.apache.org/royale/jewel" 
     xmlns:js="library://ns.apache.org/royale/basic" 
     xmlns:html="library://ns.apache.org/royale/html" 
-    xmlns="http://www.w3.org/1999/xhtml">
+    xmlns="http://www.w3.org/1999/xhtml"
+    restrictIndicatorToContent="true">
 
     <fx:Script>
         <![CDATA[
diff --git a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/itemRenderers/TabBarButtonItemRenderer.as b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/itemRenderers/TabBarButtonItemRenderer.as
index 0944b98..ef966bf 100644
--- a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/itemRenderers/TabBarButtonItemRenderer.as
+++ b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/itemRenderers/TabBarButtonItemRenderer.as
@@ -138,6 +138,9 @@ package org.apache.royale.jewel.itemRenderers
 		}
 
 		COMPILE::JS
+		private var span:HTMLSpanElement;
+		
+		COMPILE::JS
 		private var indicator:HTMLSpanElement;
 		
 		COMPILE::JS
@@ -150,7 +153,7 @@ package org.apache.royale.jewel.itemRenderers
         COMPILE::JS
         override protected function createElement():WrappedHTMLElement
         {
-            var span:HTMLSpanElement = addElementToWrapper(this, 'span') as HTMLSpanElement;
+            span = addElementToWrapper(this, 'span') as HTMLSpanElement;
 			span.className = "content";
 			positioner = document.createElement('button') as WrappedHTMLElement;
 
@@ -253,5 +256,35 @@ package org.apache.royale.jewel.itemRenderers
             	toggleClass("selected", selected);
 			}
 		}
+
+
+		private var _restrictIndicatorToContent:Boolean;
+        /**
+         *  Restrict the indicator to content
+         *  
+         *  @langversion 3.0
+         *  @playerversion Flash 10.2
+         *  @playerversion AIR 2.6
+         *  @productversion Royale 0.9.6
+         */
+		public function get restrictIndicatorToContent():Boolean
+		{
+            return _restrictIndicatorToContent;   
+		}
+		public function set restrictIndicatorToContent(value:Boolean):void
+		{
+            _restrictIndicatorToContent = value;
+
+			COMPILE::JS
+			{
+			if(!_restrictIndicatorToContent && positioner && indicator)
+			{
+				positioner.appendChild(indicator);
+			} else if(_restrictIndicatorToContent && span && indicator)
+			{
+				span.appendChild(indicator);
+			}
+			}
+		}
 	}
 }