提交 5c1f6423 编写于 作者: D deqingli

fix when resize the sankey view after drag the node the position of the node...

fix when resize the sankey view after drag the node the position of the node won't be changed accordingly
上级 0d5e6d9f
......@@ -67,6 +67,11 @@ export default echarts.extendChartView({
var graph = seriesModel.getGraph();
var group = this.group;
var layoutInfo = seriesModel.layoutInfo;
// view width
var width = layoutInfo.width;
// view height
var height = layoutInfo.height;
var nodeData = seriesModel.getData();
var edgeData = seriesModel.getData('edge');
......@@ -96,10 +101,10 @@ export default echarts.extendChartView({
curve.shape.extent = Math.max(1, edgeLayout.dy);
var x1 = (dragX1 != null ? dragX1 : n1Layout.x) + n1Layout.dx;
var y1 = (dragY1 != null ? dragY1 : n1Layout.y) + edgeLayout.sy + edgeLayout.dy / 2;
var x2 = dragX2 != null ? dragX2 : n2Layout.x;
var y2 = (dragY2 != null ? dragY2 : n2Layout.y) + edgeLayout.ty + edgeLayout.dy / 2;
var x1 = (dragX1 != null ? dragX1 * width : n1Layout.x) + n1Layout.dx;
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);
......@@ -145,8 +150,8 @@ export default echarts.extendChartView({
var rect = new graphic.Rect({
shape: {
x: dragX != null ? dragX : layout.x,
y: dragY != null ? dragY : layout.y,
x: dragX != null ? dragX * width : layout.x,
y: dragY != null ? dragY * height : layout.y,
width: layout.dx,
height: layout.dy
},
......@@ -187,8 +192,8 @@ export default echarts.extendChartView({
type: 'dragNode',
seriesId: seriesModel.id,
dataIndex: nodeData.getRawIndex(dataIndex),
localX: this.shape.x,
localY: this.shape.y
localX: this.shape.x / width,
localY: this.shape.y / height
});
};
......
......@@ -19,7 +19,7 @@
/**
* @file The layout algorithm of sankey view
* @author Deqing Li(annong035@gmail.com)
* @author Deqing Li(annong035@gmail.com)
*/
import * as layout from '../../util/layout';
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册