You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@royale.apache.org by gr...@apache.org on 2021/02/23 05:08:18 UTC

[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 <gr...@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,


Re: [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)

Posted by Yishay Weiss <yi...@hotmail.com>.
No need to revert, just wanted to understand.

>It turns out the best thing is to have pointer events enabled for visual
svg child elements and have the svg element itself disabled

This will be useful to anyone else who has used this function with the default behavior (if that person exists).

Thanks.
________________________________
From: Greg Dove <gr...@gmail.com>
Sent: Monday, March 1, 2021 7:51 PM
To: Apache Royale Development <de...@royale.apache.org>
Subject: Re: [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)

Hi Yishay, I removed it for both performance reasons as it is not used in
many places, and also because the original assumptions behind having it on
by default were not valid, which is something I recently discovered when
working on matching mouse event behaviour for the 'rendered' svg graphics.
It turns out the best thing is to have pointer events enabled for visual
svg child elements and have the svg element itself disabled, this means
that the path winding rules (e.g. shapes with 'cutouts') are respected for
mouse events.
But it's been there just over a year now, so it's possible some others have
used this utility function as-is in their own code and I guess this is what
you are seeing? Feel free to revert the change in this function if you feel
strongly about that.



On Tue, Mar 2, 2021 at 12:55 AM Yishay Weiss <yi...@hotmail.com> wrote:

> -       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: gregdove@apache.org <gr...@apache.org>
> Sent: Tuesday, February 23, 2021 5:08 AM
> To: commits@royale.apache.org <co...@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 <gr...@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,
>
>

Re: [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)

Posted by Greg Dove <gr...@gmail.com>.
Hi Yishay, I removed it for both performance reasons as it is not used in
many places, and also because the original assumptions behind having it on
by default were not valid, which is something I recently discovered when
working on matching mouse event behaviour for the 'rendered' svg graphics.
It turns out the best thing is to have pointer events enabled for visual
svg child elements and have the svg element itself disabled, this means
that the path winding rules (e.g. shapes with 'cutouts') are respected for
mouse events.
But it's been there just over a year now, so it's possible some others have
used this utility function as-is in their own code and I guess this is what
you are seeing? Feel free to revert the change in this function if you feel
strongly about that.



On Tue, Mar 2, 2021 at 12:55 AM Yishay Weiss <yi...@hotmail.com> wrote:

> -       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: gregdove@apache.org <gr...@apache.org>
> Sent: Tuesday, February 23, 2021 5:08 AM
> To: commits@royale.apache.org <co...@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 <gr...@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,
>
>

Re: [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)

Posted by Yishay Weiss <yi...@hotmail.com>.
-       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: gregdove@apache.org <gr...@apache.org>
Sent: Tuesday, February 23, 2021 5:08 AM
To: commits@royale.apache.org <co...@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 <gr...@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,