You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@echarts.apache.org by de...@apache.org on 2018/08/13 10:58:21 UTC

[incubator-echarts] branch master updated: fix(sankey): fix the hover error after drag action

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

deqingli pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-echarts.git


The following commit(s) were added to refs/heads/master by this push:
     new cc89093  fix(sankey): fix the hover error after drag action
cc89093 is described below

commit cc89093589a99db361062e90a7b01cf26d5c735a
Author: deqingli <an...@gmail.com>
AuthorDate: Mon Aug 13 18:57:35 2018 +0800

    fix(sankey): fix the hover error after drag action
---
 src/chart/sankey/SankeyView.js | 31 +++++++++++++++++++++++--------
 1 file changed, 23 insertions(+), 8 deletions(-)

diff --git a/src/chart/sankey/SankeyView.js b/src/chart/sankey/SankeyView.js
index 6807f63..1914eb8 100644
--- a/src/chart/sankey/SankeyView.js
+++ b/src/chart/sankey/SankeyView.js
@@ -115,7 +115,6 @@ export default echarts.extendChartView({
         var width = layoutInfo.width;
         // view height
         var height = layoutInfo.height;
-        
         var nodeData = seriesModel.getData();
         var edgeData = seriesModel.getData('edge');
         var orient = seriesModel.get('orient');
@@ -150,10 +149,23 @@ export default echarts.extendChartView({
             var y1 = (dragY1 != null ? dragY1 * height : n1Layout.y) + edgeLayout.sy + edgeLayout.dy / 2;
             var x2 = dragX2 != null ? dragX2 * width : n2Layout.x;
             var y2 = (dragY2 != null ? dragY2 * height : n2Layout.y) + edgeLayout.ty + edgeLayout.dy / 2;
-            var cpx1 = x1 * (1 - curvature) + x2 * curvature;
-            var cpy1 = y1;
-            var cpx2 = x1 * curvature + x2 * (1 - curvature);
-            var cpy2 = y2;
+
+            if (orient === 'vertical') {
+                var cpx1 = x1;
+                var cpy1 = y1 * (1 - curvature) + y2 * curvature;
+                var cpx2 = x2;
+                var cpy2 = y1 * curvature + y2 * (1 - curvature);
+            }
+            else {
+                var cpx1 = x1 * (1 - curvature) + x2 * curvature;
+                var cpy1 = y1;
+                var cpx2 = x1 * curvature + x2 * (1 - curvature);
+                var cpy2 = y2;
+            }
+            // var cpx1 = x1 * (1 - curvature) + x2 * curvature;
+            // var cpy1 = y1;
+            // var cpx2 = x1 * curvature + x2 * (1 - curvature);
+            // var cpy2 = y2;
 
             curve.setShape({
                 x1: x1,
@@ -225,7 +237,7 @@ export default echarts.extendChartView({
 
             rect.dataType = 'node';
         });
-       
+
         nodeData.eachItemGraphicEl(function (el, dataIndex) {
             var itemModel = nodeData.getItemModel(dataIndex);
             if (itemModel.get('draggable')) {
@@ -242,10 +254,13 @@ export default echarts.extendChartView({
                         localY: this.shape.y / height
                     });
                 };
+                el.ondragend = function () {
+                    sankeyView._focusAdjacencyDisabled = false;
+                };
                 el.draggable = true;
                 el.cursor = 'move';
             }
-            
+
             if (itemModel.get('focusNodeAdjacency')) {
                 el.off('mouseover').on('mouseover', function () {
                     if (!sankeyView._focusAdjacencyDisabled) {
@@ -307,7 +322,7 @@ export default echarts.extendChartView({
         var dataIndex = payload.dataIndex;
         var itemModel = data.getItemModel(dataIndex);
         var edgeDataIndex = payload.edgeDataIndex;
-        
+
         if (dataIndex == null && edgeDataIndex == null) {
             return;
         }


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