mirror of
https://gitee.com/antv/g6.git
synced 2024-12-09 15:18:08 +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,29 +194,30 @@ 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;
|
||||
this.shape.attr({
|
||||
x: clientX,
|
||||
y: clientY
|
||||
});
|
||||
} else if (this.target) {
|
||||
this.shape.attr({
|
||||
x: x + bbox.x,
|
||||
y: y + bbox.y
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
this.shape.attr({
|
||||
x: clientX,
|
||||
y: clientY
|
||||
});
|
||||
} else if (this.target) {
|
||||
this.shape.attr({
|
||||
x: x - bbox.width / 2,
|
||||
y: y - bbox.height / 2
|
||||
});
|
||||
}
|
||||
this.graph.paint();
|
||||
},
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user