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

[royale-asjs] 03/04: MaskBead now changes svg element into a mask definition instead of attempting to draw mask using path.

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

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

commit 00bbbcae9b249fde65d43637b412a4a99c8a0870
Author: DESKTOP-RH4S838\Yishay <yi...@hotmail.com>
AuthorDate: Tue Jan 2 10:59:12 2018 +0200

    MaskBead now changes svg element into a mask definition instead of
    attempting to draw mask using path.
---
 .../main/royale/org/apache/royale/svg/MaskBead.as  | 26 +++++++++++++++++-----
 1 file changed, 20 insertions(+), 6 deletions(-)

diff --git a/frameworks/projects/Graphics/src/main/royale/org/apache/royale/svg/MaskBead.as b/frameworks/projects/Graphics/src/main/royale/org/apache/royale/svg/MaskBead.as
index 8c8bc96..7eb2ac5 100644
--- a/frameworks/projects/Graphics/src/main/royale/org/apache/royale/svg/MaskBead.as
+++ b/frameworks/projects/Graphics/src/main/royale/org/apache/royale/svg/MaskBead.as
@@ -71,12 +71,12 @@ package org.apache.royale.svg
 			{
 				_strand = value;
 				var currentPositioner:Element = (value as IRenderedObject).element as Element;
-				var myPositioner:Element = createChildNode(currentPositioner, "defs") as Element;
-				myPositioner = createChildNode(myPositioner, "mask") as Element;
-				maskElementId = myPositioner.id = "myMask" + UIDUtil.createUID();
-				(value as IUIBase).positioner = myPositioner as WrappedHTMLElement;
+				var newPositioner:Element = createChildNode(currentPositioner, "defs") as Element;
+				newPositioner = createChildNode(newPositioner, "mask") as Element;
+				maskElementId = newPositioner.id = "myMask" + UIDUtil.createUID();
+				(value as IUIBase).positioner = newPositioner as WrappedHTMLElement;
 				// this helps retains width and height
-				myPositioner.setAttribute('style', currentPositioner.getAttribute('style'));
+				newPositioner.setAttribute('style', currentPositioner.getAttribute('style'));
 				// move children to new positioner
 				var childNodes:Object = currentPositioner.childNodes;
 				for (var i:int = 0; i < childNodes.length; i++)
@@ -84,7 +84,7 @@ package org.apache.royale.svg
 					var childNode:Element = childNodes[i] as Element;
 					if (childNode.tagName != "defs")
 					{
-						myPositioner.appendChild(childNode);
+						newPositioner.appendChild(childNode);
 					}
 				}
 			}
@@ -104,6 +104,20 @@ package org.apache.royale.svg
 			return _strand as IRenderedObject;
 		}
 
+		COMPILE::SWF 
+		public function unmaskElement(renderedObject:IRenderedObject):void
+		{
+			renderedObject.$displayObject.mask = null;
+		}
+
+		COMPILE::SWF 
+		public function maskElement(renderedObject:IRenderedObject):void
+		{
+			renderedObject.$displayObject.x = host.$displayObject.x;
+			renderedObject.$displayObject.y = host.$displayObject.y;
+			renderedObject.$displayObject.mask = host.$displayObject;
+		}
+
 		COMPILE::JS 
 		public function unmaskElement(renderedObject:IRenderedObject):void
 		{

-- 
To stop receiving notification emails like this one, please contact
"commits@royale.apache.org" <co...@royale.apache.org>.