Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The history point location did not meet expectations #6510

Open
xiaoxiaofu1 opened this issue Nov 12, 2024 · 0 comments
Open

The history point location did not meet expectations #6510

xiaoxiaofu1 opened this issue Nov 12, 2024 · 0 comments

Comments

@xiaoxiaofu1
Copy link

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

@github-actions github-actions bot changed the title history点位置没有达到预期 The history point location did not meet expectations Nov 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant