-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
删除边的箭头有bug #3937
Labels
type: discussion 讨论
Usage questions, guidance, and other discussions
Comments
请使用 |
NewByVector
added
the
type: discussion 讨论
Usage questions, guidance, and other discussions
label
Sep 26, 2023
但是撤销和重做有问题啊。试一试下面的代码,添加了两个按钮,一个撤销一个重做。先点击取消箭头,然后点击撤销,在点击重做,你会发现,箭头会向前突一点,这时候再点撤销,发现箭头不会消失了 import { Graph, Cell, Color } from '@antv/x6'
import {History} from '@antv/x6-plugin-history'
const graph = new Graph({
container: document.getElementById('container'),
grid: true,
})
const source = graph.addNode({
x: 180,
y: 60,
width: 100,
height: 40,
attrs: {
body: {
fill: '#f5f5f5',
stroke: '#d9d9d9',
strokeWidth: 1,
},
},
tools: [
{
name: 'button',
args: {
markup: [
{
tagName: 'circle',
selector: 'button',
attrs: {
r: 14,
stroke: '#fe854f',
strokeWidth: 2,
fill: 'white',
cursor: 'pointer',
},
},
{
tagName: 'text',
textContent: '取消箭头',
selector: 'icon',
attrs: {
fill: '#fe854f',
fontSize: 10,
textAnchor: 'middle',
pointerEvents: 'none',
y: '0.3em',
},
},
],
x: '100%',
y: '100%',
offset: { x: -20, y: -20 },
onClick({ cell }: { cell: Cell }) {
edge.attr('line/targetMarker',null);
},
},
},
{
name: 'button',
args: {
markup: [
{
tagName: 'circle',
selector: 'button',
attrs: {
r: 14,
stroke: '#fe854f',
strokeWidth: 2,
fill: 'white',
cursor: 'pointer',
},
},
{
tagName: 'text',
textContent: '撤销',
selector: 'icon',
attrs: {
fill: '#fe854f',
fontSize: 10,
textAnchor: 'middle',
pointerEvents: 'none',
y: '0.3em',
},
},
],
x: '0',
y: '0',
offset: { x: -20, y: -20 },
onClick({ cell }: { cell: Cell }) {
graph.undo();
},
},
},
{
name: 'button',
args: {
markup: [
{
tagName: 'circle',
selector: 'button',
attrs: {
r: 14,
stroke: '#fe854f',
strokeWidth: 2,
fill: 'white',
cursor: 'pointer',
},
},
{
tagName: 'text',
textContent: '重做',
selector: 'icon',
attrs: {
fill: '#fe854f',
fontSize: 10,
textAnchor: 'middle',
pointerEvents: 'none',
y: '0.3em',
},
},
],
x: '50%',
y: '0',
offset: { x: -20, y: -20 },
onClick({ cell }: { cell: Cell }) {
graph.redo();
},
},
},
],
})
const target = graph.addNode({
x: 320,
y: 250,
width: 100,
height: 40,
attrs: {
body: {
fill: '#f5f5f5',
stroke: '#d9d9d9',
strokeWidth: 1,
},
},
})
const edge=graph.addEdge({
source,
target,
attrs: {
line: {
stroke: '#a0a0a0',
strokeWidth: 1,
targetMarker: {
name: 'classic',
size: 7,
},
},
},
})
graph.use(
new History({
enabled: true,
}),
)
|
15 tasks
This thread has been automatically locked because it has not had recent activity. Please open a new issue for related bugs and link to relevant comments in this thread. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Describe the bug
已存在的边,使用attr方式删除targetMarker,也就是甚至为null,显示上还是存在着边. 把下面的代码覆盖x6的编辑器去,然后点击第一个节点的按钮
Your Example Website or App
http://x6.antv.antgroup.com/examples/node/tool#button
Steps to Reproduce the Bug or Issue
Expected behavior
箭头被去掉
Screenshots or Videos
No response
Platform
Additional context
No response
The text was updated successfully, but these errors were encountered: