- public function createGraphicsSVG(elementName:String, noPointerEvents:Boolean = true):SVGElement + public function createGraphicsSVG(elementName:String, noPointerEvents:Boolean):SVGElement
Greg, this breaks backwards compatibility. Any reason not to keep the default? ________________________________ From: gregd...@apache.org <gregd...@apache.org> Sent: Tuesday, February 23, 2021 5:08 AM To: comm...@royale.apache.org <comm...@royale.apache.org> Subject: [royale-asjs] branch develop updated: Allow for variation in svg expression for things like pointer-events with swf drawing api emulation (Keeping the original behaviour by default, for now) This is an automated email from the ASF dual-hosted git repository. gregdove 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 65a731f Allow for variation in svg expression for things like pointer-events with swf drawing api emulation (Keeping the original behaviour by default, for now) 65a731f is described below commit 65a731f2fbe530e62360c182aa4ce274e30294f4 Author: greg-dove <greg.d...@gmail.com> AuthorDate: Tue Feb 23 18:07:40 2021 +1300 Allow for variation in svg expression for things like pointer-events with swf drawing api emulation (Keeping the original behaviour by default, for now) --- .../royale/org/apache/royale/display/UIGraphicsBase.as | 2 +- .../main/royale/org/apache/royale/display/Graphics.as | 17 ++++++++++++----- .../apache/royale/display/js/JSRuntimeGraphicsStore.as | 2 +- .../org/apache/royale/display/js/createGraphicsSVG.as | 2 +- 4 files changed, 15 insertions(+), 8 deletions(-) diff --git a/frameworks/projects/Basic/src/main/royale/org/apache/royale/display/UIGraphicsBase.as b/frameworks/projects/Basic/src/main/royale/org/apache/royale/display/UIGraphicsBase.as index b4a1a5e..05042bc 100644 --- a/frameworks/projects/Basic/src/main/royale/org/apache/royale/display/UIGraphicsBase.as +++ b/frameworks/projects/Basic/src/main/royale/org/apache/royale/display/UIGraphicsBase.as @@ -45,7 +45,7 @@ package org.apache.royale.display */ public function get graphicsRenderTarget():SVGElement{ if (!_svg) { - _svg = createGraphicsSVG('svg') as SVGSVGElement; + _svg = createGraphicsSVG('svg', true) as SVGSVGElement; _svg.setAttribute('xmlns', 'http://www.w3.org/2000/svg'); _svg.style.overflow = 'visible'; //it is hidden by default if (element.childNodes.length) { diff --git a/frameworks/projects/Graphics/src/main/royale/org/apache/royale/display/Graphics.as b/frameworks/projects/Graphics/src/main/royale/org/apache/royale/display/Graphics.as index 4aae5dc..cd13393 100644 --- a/frameworks/projects/Graphics/src/main/royale/org/apache/royale/display/Graphics.as +++ b/frameworks/projects/Graphics/src/main/royale/org/apache/royale/display/Graphics.as @@ -49,8 +49,15 @@ package org.apache.royale.display COMPILE::SWF private static var instanceMap:Dictionary; - - + + COMPILE::JS + private var suppressPathPointerEvents = true; + + COMPILE::JS + public function setSuppressPathPointerEvents(value:Boolean):void{ + suppressPathPointerEvents = value; + } + public static function getInstanceFor(target:IGraphicsTarget):Graphics{ if (!target) return null; var graphicsInst:Graphics; @@ -210,7 +217,7 @@ package org.apache.royale.display */ private function getCurrentPath():SVGPathElement{ if (!_currentPath) { - _currentPath = createGraphicsSVG('path') as SVGPathElement; + _currentPath = createGraphicsSVG('path', suppressPathPointerEvents) as SVGPathElement; _currentStrokePath = _currentPath; _currentPath.setAttributeNS(null, 'd',''); _pathData = _currentPath.getAttributeNodeNS(null,'d'); @@ -271,7 +278,7 @@ package org.apache.royale.display //if we had no stroke, then no need to create the original, just continue after if (getCurrentPath().getAttributeNS(null, 'stroke') !== 'none') { //otherwise set current path stroke to none, transfer previous stroke attributes to new sub path - _currentStrokePath = createGraphicsSVG('path') as SVGPathElement; + _currentStrokePath = createGraphicsSVG('path', suppressPathPointerEvents) as SVGPathElement; _currentStrokePath.setAttributeNS(null, 'd', getPathData().value); _currentStrokePath.setAttributeNS(null, 'fill', 'none'); currentStroke.apply(this,_currentStrokePath); @@ -284,7 +291,7 @@ package org.apache.royale.display } } - _currentStrokePath = createGraphicsSVG('path') as SVGPathElement; + _currentStrokePath = createGraphicsSVG('path',suppressPathPointerEvents) as SVGPathElement; //then create the new stroke target _strokeMove = true; _currentStrokePath.setAttributeNS(null, 'd', 'M' + _lastPoint); diff --git a/frameworks/projects/Graphics/src/main/royale/org/apache/royale/display/js/JSRuntimeGraphicsStore.as b/frameworks/projects/Graphics/src/main/royale/org/apache/royale/display/js/JSRuntimeGraphicsStore.as index 9ccf1d1..4b0353b 100644 --- a/frameworks/projects/Graphics/src/main/royale/org/apache/royale/display/js/JSRuntimeGraphicsStore.as +++ b/frameworks/projects/Graphics/src/main/royale/org/apache/royale/display/js/JSRuntimeGraphicsStore.as @@ -62,7 +62,7 @@ package org.apache.royale.display.js styles.padding = '0'; styles.border = 'none'; styles.userSelect = 'none'; - var svg:SVGElement = createGraphicsSVG('svg'); + var svg:SVGElement = createGraphicsSVG('svg', true); svg.setAttribute('xmlns', 'http://www.w3.org/2000/svg'); svg.setAttribute('xmlns:html', 'http://www.w3.org/1999/xhtml'); svg.setAttribute('xmlns:xlink','http://www.w3.org/1999/xlink'); diff --git a/frameworks/projects/Graphics/src/main/royale/org/apache/royale/display/js/createGraphicsSVG.as b/frameworks/projects/Graphics/src/main/royale/org/apache/royale/display/js/createGraphicsSVG.as index 0f031d8..cc8164a 100644 --- a/frameworks/projects/Graphics/src/main/royale/org/apache/royale/display/js/createGraphicsSVG.as +++ b/frameworks/projects/Graphics/src/main/royale/org/apache/royale/display/js/createGraphicsSVG.as @@ -23,7 +23,7 @@ package org.apache.royale.display.js /** * @royaleignorecoercion SVGElement */ - public function createGraphicsSVG(elementName:String, noPointerEvents:Boolean = true):SVGElement + public function createGraphicsSVG(elementName:String, noPointerEvents:Boolean):SVGElement { var svgElement:SVGElement = document.createElementNS('http://www.w3.org/2000/svg', elementName) as SVGElement; //Graphics (emulation) has no inherent pointer-events because it is supposed to be visual only,