修复 mode更改是如果有官方panNode则panNode中方法会保留

This commit is contained in:
chenjiev1 2018-11-29 08:56:16 +08:00 committed by GitHub
parent 1cd40306e6
commit 8db2af954c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -90,17 +90,17 @@ G6.registerBehaviour('panNode', graph => {
let node;
let dx;
let dy;
graph.on('node:mouseenter', () => {
graph.behaviourOn('node:mouseenter', () => {
graph.css({
cursor: 'move'
});
});
graph.on('node:mouseleave', () => {
graph.behaviourOn('node:mouseleave', () => {
graph.css({
cursor: 'default'
});
});
graph.on('node:dragstart', ({ item, x, y }) => {
graph.behaviourOn('node:dragstart', ({ item, x, y }) => {
graph.css({
cursor: 'move'
});
@ -109,7 +109,7 @@ G6.registerBehaviour('panNode', graph => {
dx = model.x - x;
dy = model.y - y;
});
graph.on('node:drag', ev => {
graph.behaviourOn('node:drag', ev => {
graph.preventAnimate(() => {
graph.update(node, {
x: ev.x + dx,
@ -117,10 +117,10 @@ G6.registerBehaviour('panNode', graph => {
});
});
});
graph.on('node:dragend', () => {
graph.behaviourOn('node:dragend', () => {
node = undefined;
});
graph.on('canvas:mouseleave', () => {
graph.behaviourOn('canvas:mouseleave', () => {
node = undefined;
});
});