antvis / antvis/X6

对齐线一个bug

Open
#3,974 1 comment 0 reactions 0 assignees View on GitHub
good first issue help wanted
Dominant language
TypeScript
Stars
6.7k
Forks
1.9k
PR merge metrics
No merged PRs in 30d

Description

### Describe the bug

对齐线里默认把画布上的mouseup和touchend事件隐藏了。会导致自己添加到document上的mouseup事件全部失效,代码如下:
![image](https://github.com/antvis/X6/assets/10322892/2e40f423-380e-423e-a2e2-368057af0039)
另外,对齐线插件能否添加一个过滤掉不需要对齐的节点的过滤器。当前的过滤器时过滤掉被对齐的节点。

### Your Example Website or App

https://x6.antv.antgroup.com/examples/node/native-node#image

### Steps to Reproduce the Bug or Issue

```javascript
import { Graph } from '@antv/x6'
import {Snapline} from '@antv/x6-plugin-snapline'
const graph = new Graph({
container: document.getElementById('container'),
grid: true,
})
graph.use(
new Snapline({
enabled: true,
sharp:false
}),
)
const node=graph.addNode({
shape: 'image',
x: 320,
y: 120,
width: 94,
height: 28,
imageUrl:
'https://gw.alipayobjects.com/os/s/prod/antv/assets/image/logo-with-text-73b8a.svg',
})
function mouseup(){
node.prop('position/x',node.prop('position/x')+10)
}
document.removeEventListener('mouseup',mouseup)
document.addEventListener('mouseup',mouseup)
```
1. 点击非画布区域,节点会向右移动
2. 点击画布区域,会发现节点不动

### Expected behavior

希望解决下这个问题

### Screenshots or Videos

_No response_

### Platform

- OS: [e.g. macOS, Windows, Linux]
- Browser: [e.g. Chrome, Safari, Firefox]
- Version: [e.g. 2.11.1]

### Additional context

_No response_

Contributor guide

Open the contributing guide

Research direction

Start with the provided reproduction and trace the Snapline plugin's handling of canvas mouseup and touchend events. Verify that document-level mouseup handlers still run when clicking the canvas, then check how the existing node filter works; done means event behavior is preserved and a filter can exclude nodes from alignment.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, typescript
Domain
frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.