mirror of
https://gitee.com/antv/g6.git
synced 2024-12-05 21:28:33 +08:00
Merge pull request #857 from antvis/dev3.1.0
修复当自定义的节点中心位置不在中心点时delegate错位的问题
This commit is contained in:
commit
d8ccff10e6
@ -481,6 +481,9 @@
|
||||
container: 'mountNode',
|
||||
width: 800,
|
||||
height: 600,
|
||||
modes: {
|
||||
default: ['drag-node']
|
||||
},
|
||||
defaultNode: {
|
||||
shape: 'card-node'
|
||||
}
|
||||
|
@ -194,16 +194,15 @@ module.exports = {
|
||||
attrs: {
|
||||
width: bbox.width,
|
||||
height: bbox.height,
|
||||
x: x - bbox.width / 2,
|
||||
y: y - bbox.height / 2,
|
||||
x: x + bbox.x,
|
||||
y: y + bbox.y,
|
||||
...attrs
|
||||
}
|
||||
});
|
||||
this.target.set('delegateShape', this.shape);
|
||||
}
|
||||
this.shape.set('capture', false);
|
||||
}
|
||||
|
||||
} else {
|
||||
if (this.targets.length > 0) {
|
||||
const clientX = e.x - this.origin.x + this.originPoint.minX;
|
||||
const clientY = e.y - this.origin.y + this.originPoint.minY;
|
||||
@ -213,10 +212,12 @@ module.exports = {
|
||||
});
|
||||
} else if (this.target) {
|
||||
this.shape.attr({
|
||||
x: x - bbox.width / 2,
|
||||
y: y - bbox.height / 2
|
||||
x: x + bbox.x,
|
||||
y: y + bbox.y
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
this.graph.paint();
|
||||
},
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user