Open xiaoxiaofu1 opened 1 week ago
拖拽问题复现步骤. 1.选中点node-0,拖走,点undo,没问题。 2.选中点node-1,拖走,点undo,位置没有直接返回,需要连续点击多次undo才能撤销到初始位置 布局问题复现步骤. 1.切换布局比如到force时,点undo,没有回到布局前的位置 状态记录问题: 点的选中和hover状态都会默认记录到undo中,请问可不可以指定不记录状态
No response
import { Graph } from '@antv/g6';
const graph = new Graph({ container: 'container', data: { nodes: [{ id: 'node-0', style: { x: 200, y: 150 } }, { id: 'node-1', style: { x: 300, y: 250 } }] }, node: { style: { size: 60, labelText: (item)=>item.id, labelPlacement: 'middle', labelFill: '#fff', }, }, behaviors: ['drag-element','click-select','hover-activate'], 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'); gui .add({ layout: 'circular' }, 'layout', ['circular', 'grid', 'force', 'radial', 'concentric', 'mds']) .onChange((layout) => { const options = { circular: { type: 'circular' }, grid: { type: 'grid' }, force: { type: 'force', preventOverlap: true }, radial: { type: 'radial', preventOverlap: true }, concentric: { type: 'concentric' }, mds: { type: 'mds', linkDistance: 100 }, }; graph.stopLayout(); graph.setLayout(options[layout]); graph.layout(); }); }); });
🆕 5.x
macOS
Chrome
Describe the bug / 问题描述
拖拽问题复现步骤. 1.选中点node-0,拖走,点undo,没问题。 2.选中点node-1,拖走,点undo,位置没有直接返回,需要连续点击多次undo才能撤销到初始位置 布局问题复现步骤. 1.切换布局比如到force时,点undo,没有回到布局前的位置 状态记录问题: 点的选中和hover状态都会默认记录到undo中,请问可不可以指定不记录状态
Reproduction link / 重现链接
No response
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 } }, { id: 'node-1', style: { x: 300, y: 250 } }] }, node: { style: { size: 60, labelText: (item)=>item.id, labelPlacement: 'middle', labelFill: '#fff', }, }, behaviors: ['drag-element','click-select','hover-activate'], 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'); gui .add({ layout: 'circular' }, 'layout', ['circular', 'grid', 'force', 'radial', 'concentric', 'mds']) .onChange((layout) => { const options = { circular: { type: 'circular' }, grid: { type: 'grid' }, force: { type: 'force', preventOverlap: true }, radial: { type: 'radial', preventOverlap: true }, concentric: { type: 'concentric' }, mds: { type: 'mds', linkDistance: 100 }, }; graph.stopLayout(); graph.setLayout(options[layout]); graph.layout(); }); }); });
G6 Version / G6 版本
🆕 5.x
Operating System / 操作系统
macOS
Browser / 浏览器
Chrome
Additional context / 补充说明
No response