You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@echarts.apache.org by wa...@apache.org on 2022/02/15 12:46:21 UTC

[echarts] branch fix-graphic-cursor created (now 2317a9a)

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

wangzx pushed a change to branch fix-graphic-cursor
in repository https://gitbox.apache.org/repos/asf/echarts.git.


      at 2317a9a  fix(graphic): fix `cursor` doesn't work in `graphic` component.

This branch includes the following new commits:

     new 2317a9a  fix(graphic): fix `cursor` doesn't work in `graphic` component.

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org


[echarts] 01/01: fix(graphic): fix `cursor` doesn't work in `graphic` component.

Posted by wa...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

wangzx pushed a commit to branch fix-graphic-cursor
in repository https://gitbox.apache.org/repos/asf/echarts.git

commit 2317a9a38af21faebf34d05b4b9a9061b1df15a0
Author: plainheart <yh...@all-my-life.cn>
AuthorDate: Tue Feb 15 20:44:04 2022 +0800

    fix(graphic): fix `cursor` doesn't work in `graphic` component.
---
 src/component/graphic/GraphicView.ts | 11 +++++--
 test/graphic-cases.html              | 57 +++++++++++++++++++++++++++++++++++-
 2 files changed, 65 insertions(+), 3 deletions(-)

diff --git a/src/component/graphic/GraphicView.ts b/src/component/graphic/GraphicView.ts
index eeebfd1..0e0352a 100644
--- a/src/component/graphic/GraphicView.ts
+++ b/src/component/graphic/GraphicView.ts
@@ -441,10 +441,17 @@ function updateCommonAttrs(
 ) {
     if (!el.isGroup) {
         const elDisplayable = el as Displayable;
+        elDisplayable.cursor = (elOption as GraphicComponentDisplayableOption).cursor;
         // We should not support configure z and zlevel in the element level.
         // But seems we didn't limit it previously. So here still use it to avoid breaking.
-        elDisplayable.z = zrUtil.retrieve2((elOption as any).z, defaultZ || 0);
-        elDisplayable.zlevel = zrUtil.retrieve2((elOption as any).zlevel, defaultZlevel || 0);
+        elDisplayable.z = zrUtil.retrieve2(
+            (elOption as GraphicComponentDisplayableOption).z,
+            defaultZ || 0
+        );
+        elDisplayable.zlevel = zrUtil.retrieve2(
+            (elOption as GraphicComponentDisplayableOption).zlevel,
+            defaultZlevel || 0
+        );
         // z2 must not be null/undefined, otherwise sort error may occur.
         const optZ2 = (elOption as GraphicComponentDisplayableOption).z2;
         optZ2 != null && (elDisplayable.z2 = optZ2 || 0);
diff --git a/test/graphic-cases.html b/test/graphic-cases.html
index 8b913ed..a9eddf3 100644
--- a/test/graphic-cases.html
+++ b/test/graphic-cases.html
@@ -40,7 +40,7 @@ under the License.
         <div id="main0"></div>
         <div id="main1"></div>
         <div id="main2"></div>
-
+        <div id="main3"></div>
 
 
 
@@ -220,6 +220,61 @@ under the License.
             });
             </script>
 
+        <script>
+             require(['echarts'], function (echarts) {
+                var option = {
+                    graphic:{
+                        elements: [{
+                            type: 'group',
+                            left: '10%',
+                            top: 'center',
+                            draggable: true,
+                            children: [{
+                                type: 'rect',
+                                z: 100,
+                                left: 'center',
+                                top: 'middle',
+                                shape: {
+                                    width: 240,
+                                    height: 90
+                                },
+                                style: {
+                                    fill: 'gray',
+                                    stroke: '#555',
+                                    lineWidth: 1,
+                                    shadowBlur: 8,
+                                    shadowOffsetX: 3,
+                                    shadowOffsetY: 3,
+                                    shadowColor: 'rgba(0,0,0,0.2)'
+                                },
+                                cursor: 'move',
+                            }, {
+                                type: 'text',
+                                z: 100,
+                                left: 'center',
+                                top: 'middle',
+                                style: {
+                                    fill: '#000',
+                                    width: 220,
+                                    overflow: 'break',
+                                    text: 'the value of cursor prop is "default", it looks well on version 5.1.1. Replace echarts version with 5.3.0, the mouse will still be a pointer',
+                                    font: '14px Microsoft YaHei'
+                                },
+                                cursor: 'help',
+                            }]
+                        }]
+                    }
+                };
+                var chart = testHelper.create(echarts, 'main3', {
+                    title: [
+                        'Cursor should be **move** when hovering on the rect',
+                        'Cursor should be **help** when hovering on the text',
+                        'See https://github.com/apache/echarts/issues/16511'
+                    ],
+                    option: option
+                });
+             });
+        </script>
     </body>
 </html>
 

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org