antvis/G6


The issue has been closed
[Bug]: brush-select not work well with undo/redo feature #6842
Rey-Wang posted onGitHub
Describe the bug / 问题描述
when use brush-select and drag the selected elements, undo/redo not work well
Reproduction link / 复现链接
no link, you can reproduce on offical examples
Steps to Reproduce the Bug or Issue / 重现步骤
import { Graph } from '@antv/g6';
const graph = new Graph({
container: 'container',
data: {
nodes: [{ id: 'node-0', style: { x: 200, y: 150 } }],
},
node: {
style: {
size: 60,
labelText: 'Drag Me!',
labelPlacement: 'middle',
labelFill: '#fff',
},
},
behaviors: ['drag-element',
{
type: 'brush-select',
immediately: true,
mode: 'default',
enableElements: ['node', 'combo'],
},],
plugins: [
{
type: 'history',
key: 'history',
},
],
});
graph.render().then(() => {
window.addPanel((gui) => {
const history = graph.getPluginInstance('history');
const config = {
undo: () => {
if (history.canUndo()) history.undo();
},
redo: () => {
if (history.canRedo()) history.redo();
},
};
gui.add(config, 'undo').name('⬅️ undo');
gui.add(config, 'redo').name('➡️ redo');
});
});
Version / 版本
🆕 5.x
OS / 操作系统
- macOS
- Windows
- Linux
- Others / 其他
Browser / 浏览器
- Chrome
- Edge
- Firefox
- Safari (Limited support / 有限支持)
- IE (Nonsupport / 不支持)
- Others / 其他