@antv/g6 5.0.15 → 5.0.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/g6.min.js +2 -2
- package/dist/lib/behaviors/drag-canvas.d.ts +13 -0
- package/dist/lib/behaviors/optimize-viewport-transform.d.ts +0 -1
- package/dist/lib/behaviors/scroll-canvas.d.ts +7 -0
- package/dist/lib/behaviors/zoom-canvas.d.ts +7 -0
- package/dist/lib/constants/registry.d.ts +7 -1
- package/dist/lib/elements/edges/base-edge.d.ts +2 -2
- package/dist/lib/elements/edges/polyline.d.ts +4 -20
- package/dist/lib/elements/shapes/base-shape.d.ts +51 -2
- package/dist/lib/exports.d.ts +3 -2
- package/dist/lib/plugins/edge-filter-lens/index.d.ts +125 -0
- package/dist/lib/plugins/index.d.ts +4 -0
- package/dist/lib/plugins/snapline/index.d.ts +95 -0
- package/dist/lib/registry/types.d.ts +4 -0
- package/dist/lib/runtime/element.d.ts +1 -0
- package/dist/lib/runtime/plugin.d.ts +1 -1
- package/dist/lib/runtime/viewport.d.ts +8 -0
- package/dist/lib/types/index.d.ts +1 -0
- package/dist/lib/types/router.d.ts +103 -0
- package/dist/lib/utils/bbox.d.ts +8 -0
- package/dist/lib/utils/router/orth.d.ts +8 -8
- package/dist/lib/utils/router/shortest-path.d.ts +57 -0
- package/dist/lib/utils/text.d.ts +1 -1
- package/dist/lib/utils/visibility.d.ts +2 -1
- package/dist/lib/version.d.ts +1 -1
- package/esm/behaviors/brush-select.js +11 -6
- package/esm/behaviors/brush-select.js.map +1 -1
- package/esm/behaviors/drag-canvas.d.ts +13 -0
- package/esm/behaviors/drag-canvas.js +10 -1
- package/esm/behaviors/drag-canvas.js.map +1 -1
- package/esm/behaviors/optimize-viewport-transform.d.ts +0 -1
- package/esm/behaviors/optimize-viewport-transform.js +5 -4
- package/esm/behaviors/optimize-viewport-transform.js.map +1 -1
- package/esm/behaviors/scroll-canvas.d.ts +7 -0
- package/esm/behaviors/scroll-canvas.js +3 -1
- package/esm/behaviors/scroll-canvas.js.map +1 -1
- package/esm/behaviors/zoom-canvas.d.ts +7 -0
- package/esm/behaviors/zoom-canvas.js +3 -1
- package/esm/behaviors/zoom-canvas.js.map +1 -1
- package/esm/constants/registry.d.ts +7 -1
- package/esm/constants/registry.js +6 -0
- package/esm/constants/registry.js.map +1 -1
- package/esm/elements/edges/base-edge.d.ts +2 -2
- package/esm/elements/edges/base-edge.js +10 -4
- package/esm/elements/edges/base-edge.js.map +1 -1
- package/esm/elements/edges/polyline.d.ts +4 -20
- package/esm/elements/edges/polyline.js +32 -33
- package/esm/elements/edges/polyline.js.map +1 -1
- package/esm/elements/shapes/base-shape.d.ts +51 -2
- package/esm/elements/shapes/base-shape.js +23 -5
- package/esm/elements/shapes/base-shape.js.map +1 -1
- package/esm/exports.d.ts +3 -2
- package/esm/exports.js +1 -1
- package/esm/exports.js.map +1 -1
- package/esm/plugins/edge-filter-lens/index.d.ts +125 -0
- package/esm/plugins/edge-filter-lens/index.js +236 -0
- package/esm/plugins/edge-filter-lens/index.js.map +1 -0
- package/esm/plugins/index.d.ts +4 -0
- package/esm/plugins/index.js +2 -0
- package/esm/plugins/index.js.map +1 -1
- package/esm/plugins/snapline/index.d.ts +95 -0
- package/esm/plugins/snapline/index.js +268 -0
- package/esm/plugins/snapline/index.js.map +1 -0
- package/esm/registry/build-in.js +21 -2
- package/esm/registry/build-in.js.map +1 -1
- package/esm/registry/store.js +1 -0
- package/esm/registry/store.js.map +1 -1
- package/esm/registry/types.d.ts +4 -0
- package/esm/runtime/element.d.ts +1 -0
- package/esm/runtime/element.js +10 -4
- package/esm/runtime/element.js.map +1 -1
- package/esm/runtime/plugin.d.ts +1 -1
- package/esm/runtime/plugin.js +8 -1
- package/esm/runtime/plugin.js.map +1 -1
- package/esm/runtime/viewport.d.ts +8 -0
- package/esm/runtime/viewport.js +35 -2
- package/esm/runtime/viewport.js.map +1 -1
- package/esm/types/index.d.ts +1 -0
- package/esm/types/router.d.ts +103 -0
- package/esm/types/router.js +2 -0
- package/esm/types/router.js.map +1 -0
- package/esm/utils/bbox.d.ts +8 -0
- package/esm/utils/bbox.js +19 -0
- package/esm/utils/bbox.js.map +1 -1
- package/esm/utils/router/orth.d.ts +8 -8
- package/esm/utils/router/orth.js +13 -7
- package/esm/utils/router/orth.js.map +1 -1
- package/esm/utils/router/shortest-path.d.ts +57 -0
- package/esm/utils/router/shortest-path.js +387 -0
- package/esm/utils/router/shortest-path.js.map +1 -0
- package/esm/utils/text.d.ts +1 -1
- package/esm/utils/visibility.d.ts +2 -1
- package/esm/utils/visibility.js +3 -2
- package/esm/utils/visibility.js.map +1 -1
- package/esm/version.d.ts +1 -1
- package/esm/version.js +1 -1
- package/lib/behaviors/brush-select.js +11 -6
- package/lib/behaviors/brush-select.js.map +1 -1
- package/lib/behaviors/drag-canvas.d.ts +13 -0
- package/lib/behaviors/drag-canvas.js +10 -1
- package/lib/behaviors/drag-canvas.js.map +1 -1
- package/lib/behaviors/optimize-viewport-transform.d.ts +0 -1
- package/lib/behaviors/optimize-viewport-transform.js +5 -4
- package/lib/behaviors/optimize-viewport-transform.js.map +1 -1
- package/lib/behaviors/scroll-canvas.d.ts +7 -0
- package/lib/behaviors/scroll-canvas.js +3 -1
- package/lib/behaviors/scroll-canvas.js.map +1 -1
- package/lib/behaviors/zoom-canvas.d.ts +7 -0
- package/lib/behaviors/zoom-canvas.js +3 -1
- package/lib/behaviors/zoom-canvas.js.map +1 -1
- package/lib/constants/registry.d.ts +7 -1
- package/lib/constants/registry.js +6 -0
- package/lib/constants/registry.js.map +1 -1
- package/lib/elements/edges/base-edge.d.ts +2 -2
- package/lib/elements/edges/base-edge.js +9 -3
- package/lib/elements/edges/base-edge.js.map +1 -1
- package/lib/elements/edges/polyline.d.ts +4 -20
- package/lib/elements/edges/polyline.js +32 -33
- package/lib/elements/edges/polyline.js.map +1 -1
- package/lib/elements/shapes/base-shape.d.ts +51 -2
- package/lib/elements/shapes/base-shape.js +23 -5
- package/lib/elements/shapes/base-shape.js.map +1 -1
- package/lib/exports.d.ts +3 -2
- package/lib/exports.js +3 -1
- package/lib/exports.js.map +1 -1
- package/lib/plugins/edge-filter-lens/index.d.ts +125 -0
- package/lib/plugins/edge-filter-lens/index.js +240 -0
- package/lib/plugins/edge-filter-lens/index.js.map +1 -0
- package/lib/plugins/index.d.ts +4 -0
- package/lib/plugins/index.js +5 -1
- package/lib/plugins/index.js.map +1 -1
- package/lib/plugins/snapline/index.d.ts +95 -0
- package/lib/plugins/snapline/index.js +272 -0
- package/lib/plugins/snapline/index.js.map +1 -0
- package/lib/registry/build-in.js +20 -1
- package/lib/registry/build-in.js.map +1 -1
- package/lib/registry/store.js +1 -0
- package/lib/registry/store.js.map +1 -1
- package/lib/registry/types.d.ts +4 -0
- package/lib/runtime/element.d.ts +1 -0
- package/lib/runtime/element.js +9 -3
- package/lib/runtime/element.js.map +1 -1
- package/lib/runtime/plugin.d.ts +1 -1
- package/lib/runtime/plugin.js +8 -1
- package/lib/runtime/plugin.js.map +1 -1
- package/lib/runtime/viewport.d.ts +8 -0
- package/lib/runtime/viewport.js +34 -1
- package/lib/runtime/viewport.js.map +1 -1
- package/lib/types/index.d.ts +1 -0
- package/lib/types/router.d.ts +103 -0
- package/lib/types/router.js +3 -0
- package/lib/types/router.js.map +1 -0
- package/lib/utils/bbox.d.ts +8 -0
- package/lib/utils/bbox.js +20 -0
- package/lib/utils/bbox.js.map +1 -1
- package/lib/utils/router/orth.d.ts +8 -8
- package/lib/utils/router/orth.js +13 -7
- package/lib/utils/router/orth.js.map +1 -1
- package/lib/utils/router/shortest-path.d.ts +57 -0
- package/lib/utils/router/shortest-path.js +394 -0
- package/lib/utils/router/shortest-path.js.map +1 -0
- package/lib/utils/text.d.ts +1 -1
- package/lib/utils/visibility.d.ts +2 -1
- package/lib/utils/visibility.js +3 -2
- package/lib/utils/visibility.js.map +1 -1
- package/lib/version.d.ts +1 -1
- package/lib/version.js +1 -1
- package/package.json +1 -1
- package/src/behaviors/brush-select.ts +12 -5
- package/src/behaviors/drag-canvas.ts +24 -1
- package/src/behaviors/optimize-viewport-transform.ts +4 -9
- package/src/behaviors/scroll-canvas.ts +9 -1
- package/src/behaviors/zoom-canvas.ts +9 -1
- package/src/constants/registry.ts +6 -0
- package/src/elements/edges/base-edge.ts +19 -5
- package/src/elements/edges/polyline.ts +36 -65
- package/src/elements/shapes/base-shape.ts +76 -6
- package/src/exports.ts +5 -0
- package/src/plugins/edge-filter-lens/index.ts +391 -0
- package/src/plugins/grid-line.ts +1 -1
- package/src/plugins/index.ts +4 -0
- package/src/plugins/snapline/index.ts +383 -0
- package/src/registry/build-in.ts +33 -1
- package/src/registry/store.ts +1 -0
- package/src/registry/types.ts +2 -0
- package/src/runtime/element.ts +11 -4
- package/src/runtime/plugin.ts +8 -1
- package/src/runtime/viewport.ts +42 -3
- package/src/types/index.ts +1 -0
- package/src/types/router.ts +107 -0
- package/src/utils/bbox.ts +24 -0
- package/src/utils/router/orth.ts +19 -10
- package/src/utils/router/shortest-path.ts +470 -0
- package/src/utils/text.ts +1 -1
- package/src/utils/visibility.ts +3 -1
- package/src/version.ts +1 -1
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
import { CommonEvent } from '../../constants';
|
|
2
|
+
import { Circle } from '../../elements';
|
|
3
|
+
import { idOf } from '../../utils/id';
|
|
4
|
+
import { parsePoint } from '../../utils/point';
|
|
5
|
+
import { positionOf } from '../../utils/position';
|
|
6
|
+
import { distance } from '../../utils/vector';
|
|
7
|
+
import { BasePlugin } from '../base-plugin';
|
|
8
|
+
const defaultLensStyle = {
|
|
9
|
+
fill: '#fff',
|
|
10
|
+
fillOpacity: 1,
|
|
11
|
+
lineWidth: 1,
|
|
12
|
+
stroke: '#000',
|
|
13
|
+
strokeOpacity: 0.8,
|
|
14
|
+
};
|
|
15
|
+
const DELTA = 0.05;
|
|
16
|
+
export class EdgeFilterLens extends BasePlugin {
|
|
17
|
+
static defaultOptions = {
|
|
18
|
+
trigger: 'pointermove',
|
|
19
|
+
r: 60,
|
|
20
|
+
nodeType: 'both',
|
|
21
|
+
filter: () => true,
|
|
22
|
+
style: { lineWidth: 2 },
|
|
23
|
+
nodeStyle: { label: false },
|
|
24
|
+
edgeStyle: { label: true },
|
|
25
|
+
scaleRByWheel: true,
|
|
26
|
+
preventDefault: true,
|
|
27
|
+
};
|
|
28
|
+
constructor(context, options) {
|
|
29
|
+
super(context, Object.assign({}, EdgeFilterLens.defaultOptions, options));
|
|
30
|
+
this.bindEvents();
|
|
31
|
+
}
|
|
32
|
+
lens;
|
|
33
|
+
shapes = new Map();
|
|
34
|
+
r = this.options.r;
|
|
35
|
+
get canvas() {
|
|
36
|
+
return this.context.canvas.getLayer('transient');
|
|
37
|
+
}
|
|
38
|
+
get isLensOn() {
|
|
39
|
+
return this.lens && !this.lens.destroyed;
|
|
40
|
+
}
|
|
41
|
+
onEdgeFilter = (event) => {
|
|
42
|
+
if (this.options.trigger === 'drag' && this.isLensOn)
|
|
43
|
+
return;
|
|
44
|
+
const origin = parsePoint(event.canvas);
|
|
45
|
+
this.renderLens(origin);
|
|
46
|
+
this.renderFocusElements();
|
|
47
|
+
};
|
|
48
|
+
renderLens = (origin) => {
|
|
49
|
+
const [x, y] = origin;
|
|
50
|
+
const positionStyle = { size: this.r * 2, x, y };
|
|
51
|
+
if (!this.isLensOn) {
|
|
52
|
+
const style = Object.assign({}, defaultLensStyle, this.options.style, positionStyle);
|
|
53
|
+
this.lens = new Circle({ style });
|
|
54
|
+
}
|
|
55
|
+
else {
|
|
56
|
+
this.lens.update(positionStyle);
|
|
57
|
+
}
|
|
58
|
+
this.canvas.appendChild(this.lens);
|
|
59
|
+
};
|
|
60
|
+
getFilterData = () => {
|
|
61
|
+
const { filter } = this.options;
|
|
62
|
+
const { model } = this.context;
|
|
63
|
+
const data = model.getData();
|
|
64
|
+
if (!filter)
|
|
65
|
+
return data;
|
|
66
|
+
const { nodes, edges, combos } = data;
|
|
67
|
+
return {
|
|
68
|
+
nodes: nodes.filter((node) => filter(idOf(node), 'node')),
|
|
69
|
+
edges: edges.filter((edge) => filter(idOf(edge), 'edge')),
|
|
70
|
+
combos: combos.filter((combo) => filter(idOf(combo), 'combo')),
|
|
71
|
+
};
|
|
72
|
+
};
|
|
73
|
+
getFocusElements = (origin) => {
|
|
74
|
+
const { nodes, edges } = this.getFilterData();
|
|
75
|
+
const focusNodes = nodes.filter((datum) => distance(positionOf(datum), origin) < this.r);
|
|
76
|
+
const focusNodeIds = focusNodes.map((node) => idOf(node));
|
|
77
|
+
const focusEdges = edges.filter((datum) => {
|
|
78
|
+
const { source, target } = datum;
|
|
79
|
+
const isSourceFocus = focusNodeIds.includes(source);
|
|
80
|
+
const isTargetFocus = focusNodeIds.includes(target);
|
|
81
|
+
switch (this.options.nodeType) {
|
|
82
|
+
case 'both':
|
|
83
|
+
return isSourceFocus && isTargetFocus;
|
|
84
|
+
case 'either':
|
|
85
|
+
return isSourceFocus !== isTargetFocus;
|
|
86
|
+
case 'source':
|
|
87
|
+
return isSourceFocus && !isTargetFocus;
|
|
88
|
+
case 'target':
|
|
89
|
+
return !isSourceFocus && isTargetFocus;
|
|
90
|
+
default:
|
|
91
|
+
return false;
|
|
92
|
+
}
|
|
93
|
+
});
|
|
94
|
+
return { nodes: focusNodes, edges: focusEdges };
|
|
95
|
+
};
|
|
96
|
+
renderFocusElements = () => {
|
|
97
|
+
const { element, graph } = this.context;
|
|
98
|
+
if (!this.isLensOn)
|
|
99
|
+
return;
|
|
100
|
+
const origin = this.lens.getCenter();
|
|
101
|
+
const { nodes, edges } = this.getFocusElements(origin);
|
|
102
|
+
const ids = new Set();
|
|
103
|
+
const { nodeStyle, edgeStyle } = this.options;
|
|
104
|
+
const iterate = (datum) => {
|
|
105
|
+
const id = idOf(datum);
|
|
106
|
+
ids.add(id);
|
|
107
|
+
const shape = element.getElement(id);
|
|
108
|
+
if (!shape)
|
|
109
|
+
return;
|
|
110
|
+
const cloneShape = this.shapes.get(id) || shape.cloneNode();
|
|
111
|
+
cloneShape.setPosition(shape.getPosition());
|
|
112
|
+
cloneShape.id = shape.id;
|
|
113
|
+
if (!this.shapes.has(id)) {
|
|
114
|
+
this.canvas.appendChild(cloneShape);
|
|
115
|
+
this.shapes.set(id, cloneShape);
|
|
116
|
+
}
|
|
117
|
+
else {
|
|
118
|
+
Object.entries(shape.attributes).forEach(([key, value]) => {
|
|
119
|
+
if (cloneShape.style[key] !== value)
|
|
120
|
+
cloneShape.style[key] = value;
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
const elementType = graph.getElementType(id);
|
|
124
|
+
const style = this.getElementStyle(elementType, datum);
|
|
125
|
+
// @ts-ignore
|
|
126
|
+
cloneShape.update(style);
|
|
127
|
+
};
|
|
128
|
+
nodes.forEach(iterate);
|
|
129
|
+
edges.forEach(iterate);
|
|
130
|
+
this.shapes.forEach((shape, id) => {
|
|
131
|
+
if (!ids.has(id)) {
|
|
132
|
+
shape.destroy();
|
|
133
|
+
this.shapes.delete(id);
|
|
134
|
+
}
|
|
135
|
+
});
|
|
136
|
+
};
|
|
137
|
+
getElementStyle(elementType, datum) {
|
|
138
|
+
const styler = elementType === 'node' ? this.options.nodeStyle : this.options.edgeStyle;
|
|
139
|
+
if (typeof styler === 'function')
|
|
140
|
+
return styler(datum);
|
|
141
|
+
return styler;
|
|
142
|
+
}
|
|
143
|
+
scaleRByWheel = (event) => {
|
|
144
|
+
if (this.options.preventDefault)
|
|
145
|
+
event.preventDefault();
|
|
146
|
+
const { clientX, clientY, deltaX, deltaY } = event;
|
|
147
|
+
const { graph, canvas } = this.context;
|
|
148
|
+
const scaleOrigin = graph.getCanvasByClient([clientX, clientY]);
|
|
149
|
+
const origin = this.lens?.getCenter();
|
|
150
|
+
if (!this.isLensOn || distance(scaleOrigin, origin) > this.r) {
|
|
151
|
+
return;
|
|
152
|
+
}
|
|
153
|
+
const { maxR, minR } = this.options;
|
|
154
|
+
const ratio = deltaX + deltaY > 0 ? 1 / (1 - DELTA) : 1 - DELTA;
|
|
155
|
+
const canvasR = Math.min(...canvas.getSize()) / 2;
|
|
156
|
+
this.r = Math.max(minR || 0, Math.min(maxR || canvasR, this.r * ratio));
|
|
157
|
+
this.renderLens(origin);
|
|
158
|
+
this.renderFocusElements();
|
|
159
|
+
};
|
|
160
|
+
get graphDom() {
|
|
161
|
+
return this.context.graph.getCanvas().getContextService().getDomElement();
|
|
162
|
+
}
|
|
163
|
+
isLensDragging = false;
|
|
164
|
+
onDragStart = (event) => {
|
|
165
|
+
const dragOrigin = parsePoint(event.canvas);
|
|
166
|
+
const origin = this.lens?.getCenter();
|
|
167
|
+
if (!this.isLensOn || distance(dragOrigin, origin) > this.r)
|
|
168
|
+
return;
|
|
169
|
+
this.isLensDragging = true;
|
|
170
|
+
};
|
|
171
|
+
onDrag = (event) => {
|
|
172
|
+
if (!this.isLensDragging)
|
|
173
|
+
return;
|
|
174
|
+
const dragOrigin = parsePoint(event.canvas);
|
|
175
|
+
this.renderLens(dragOrigin);
|
|
176
|
+
this.renderFocusElements();
|
|
177
|
+
};
|
|
178
|
+
onDragEnd = () => {
|
|
179
|
+
this.isLensDragging = false;
|
|
180
|
+
};
|
|
181
|
+
bindEvents() {
|
|
182
|
+
const { graph } = this.context;
|
|
183
|
+
const { trigger, scaleRByWheel } = this.options;
|
|
184
|
+
const canvas = graph.getCanvas().getLayer();
|
|
185
|
+
if (['click', 'drag'].includes(trigger)) {
|
|
186
|
+
canvas.addEventListener(CommonEvent.CLICK, this.onEdgeFilter);
|
|
187
|
+
}
|
|
188
|
+
if (trigger === 'pointermove') {
|
|
189
|
+
canvas.addEventListener(CommonEvent.POINTER_MOVE, this.onEdgeFilter);
|
|
190
|
+
}
|
|
191
|
+
else if (trigger === 'drag') {
|
|
192
|
+
canvas.addEventListener(CommonEvent.DRAG_START, this.onDragStart);
|
|
193
|
+
canvas.addEventListener(CommonEvent.DRAG, this.onDrag);
|
|
194
|
+
canvas.addEventListener(CommonEvent.DRAG_END, this.onDragEnd);
|
|
195
|
+
}
|
|
196
|
+
if (scaleRByWheel) {
|
|
197
|
+
this.graphDom?.addEventListener(CommonEvent.WHEEL, this.scaleRByWheel, { passive: false });
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
unbindEvents() {
|
|
201
|
+
const { graph } = this.context;
|
|
202
|
+
const { trigger, scaleRByWheel } = this.options;
|
|
203
|
+
const canvas = graph.getCanvas().getLayer();
|
|
204
|
+
if (['click', 'drag'].includes(trigger)) {
|
|
205
|
+
canvas.removeEventListener(CommonEvent.CLICK, this.onEdgeFilter);
|
|
206
|
+
}
|
|
207
|
+
if (trigger === 'pointermove') {
|
|
208
|
+
canvas.removeEventListener(CommonEvent.POINTER_MOVE, this.onEdgeFilter);
|
|
209
|
+
}
|
|
210
|
+
else if (trigger === 'drag') {
|
|
211
|
+
canvas.removeEventListener(CommonEvent.DRAG_START, this.onDragStart);
|
|
212
|
+
canvas.removeEventListener(CommonEvent.DRAG, this.onDrag);
|
|
213
|
+
canvas.removeEventListener(CommonEvent.DRAG_END, this.onDragEnd);
|
|
214
|
+
}
|
|
215
|
+
if (scaleRByWheel) {
|
|
216
|
+
this.graphDom?.removeEventListener(CommonEvent.WHEEL, this.scaleRByWheel);
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
update(options) {
|
|
220
|
+
this.unbindEvents();
|
|
221
|
+
super.update(options);
|
|
222
|
+
this.bindEvents();
|
|
223
|
+
}
|
|
224
|
+
destroy() {
|
|
225
|
+
this.unbindEvents();
|
|
226
|
+
if (this.isLensOn) {
|
|
227
|
+
this.lens.destroy();
|
|
228
|
+
}
|
|
229
|
+
this.shapes.forEach((shape, id) => {
|
|
230
|
+
shape.destroy();
|
|
231
|
+
this.shapes.delete(id);
|
|
232
|
+
});
|
|
233
|
+
super.destroy();
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"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C,YAAY,EAAE,CAAC;QACpB,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;YAClB,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC;QACtB,CAAC;QACD,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE,EAAE,EAAE;YAChC,KAAK,CAAC,OAAO,EAAE,CAAC;YAChB,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;QACzB,CAAC,CAAC,CAAC;QACH,KAAK,CAAC,OAAO,EAAE,CAAC;IAClB,CAAC"}
|
package/esm/plugins/index.d.ts
CHANGED
|
@@ -3,12 +3,14 @@ export { BasePlugin } from './base-plugin';
|
|
|
3
3
|
export { BubbleSets } from './bubble-sets';
|
|
4
4
|
export { CameraSetting } from './camera-setting';
|
|
5
5
|
export { Contextmenu } from './contextmenu';
|
|
6
|
+
export { EdgeFilterLens } from './edge-filter-lens';
|
|
6
7
|
export { Fullscreen } from './fullscreen';
|
|
7
8
|
export { GridLine } from './grid-line';
|
|
8
9
|
export { History } from './history';
|
|
9
10
|
export { Hull } from './hull';
|
|
10
11
|
export { Legend } from './legend';
|
|
11
12
|
export { Minimap } from './minimap';
|
|
13
|
+
export { Snapline } from './snapline';
|
|
12
14
|
export { Timebar } from './timebar';
|
|
13
15
|
export { Toolbar } from './toolbar';
|
|
14
16
|
export { Tooltip } from './tooltip';
|
|
@@ -18,12 +20,14 @@ export type { BasePluginOptions } from './base-plugin';
|
|
|
18
20
|
export type { BubbleSetsOptions } from './bubble-sets';
|
|
19
21
|
export type { CameraSettingOptions } from './camera-setting';
|
|
20
22
|
export type { ContextmenuOptions } from './contextmenu';
|
|
23
|
+
export type { EdgeFilterLensOptions } from './edge-filter-lens';
|
|
21
24
|
export type { FullscreenOptions } from './fullscreen';
|
|
22
25
|
export type { GridLineOptions } from './grid-line';
|
|
23
26
|
export type { HistoryOptions } from './history';
|
|
24
27
|
export type { HullOptions } from './hull';
|
|
25
28
|
export type { LegendOptions } from './legend';
|
|
26
29
|
export type { MinimapOptions } from './minimap';
|
|
30
|
+
export type { SnaplineOptions } from './snapline';
|
|
27
31
|
export type { TimebarOptions } from './timebar';
|
|
28
32
|
export type { ToolbarOptions } from './toolbar';
|
|
29
33
|
export type { TooltipOptions } from './tooltip';
|
package/esm/plugins/index.js
CHANGED
|
@@ -3,12 +3,14 @@ export { BasePlugin } from './base-plugin';
|
|
|
3
3
|
export { BubbleSets } from './bubble-sets';
|
|
4
4
|
export { CameraSetting } from './camera-setting';
|
|
5
5
|
export { Contextmenu } from './contextmenu';
|
|
6
|
+
export { EdgeFilterLens } from './edge-filter-lens';
|
|
6
7
|
export { Fullscreen } from './fullscreen';
|
|
7
8
|
export { GridLine } from './grid-line';
|
|
8
9
|
export { History } from './history';
|
|
9
10
|
export { Hull } from './hull';
|
|
10
11
|
export { Legend } from './legend';
|
|
11
12
|
export { Minimap } from './minimap';
|
|
13
|
+
export { Snapline } from './snapline';
|
|
12
14
|
export { Timebar } from './timebar';
|
|
13
15
|
export { Toolbar } from './toolbar';
|
|
14
16
|
export { Tooltip } from './tooltip';
|
package/esm/plugins/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"src/","sources":["plugins/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE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
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { BaseStyleProps, DisplayObject } from '@antv/g';
|
|
2
|
+
import type { RuntimeContext } from '../../runtime/types';
|
|
3
|
+
import type { IDragEvent, Node } from '../../types';
|
|
4
|
+
import type { BasePluginOptions } from '../base-plugin';
|
|
5
|
+
import { BasePlugin } from '../base-plugin';
|
|
6
|
+
export interface SnaplineOptions extends BasePluginOptions {
|
|
7
|
+
/**
|
|
8
|
+
* <zh/> 对齐精度,即移动节点时与目标位置的距离小于 tolerance 时触发显示对齐线
|
|
9
|
+
*
|
|
10
|
+
* <en/> The alignment accuracy, that is, when the distance between the moved node and the target position is less than tolerance, the alignment line is displayed
|
|
11
|
+
* @defaultValue 5
|
|
12
|
+
*/
|
|
13
|
+
tolerance?: number;
|
|
14
|
+
/**
|
|
15
|
+
* <zh/> 对齐线头尾的延伸距离。取值范围:[0, Infinity]
|
|
16
|
+
*
|
|
17
|
+
* <en/> The extension distance of the snapline. The value range is [0, Infinity]
|
|
18
|
+
* @defaultValue 20
|
|
19
|
+
*/
|
|
20
|
+
offset?: number;
|
|
21
|
+
/**
|
|
22
|
+
* <zh/> 是否启用自动吸附
|
|
23
|
+
*
|
|
24
|
+
* <en/> Whether to enable automatic adsorption
|
|
25
|
+
* @defaultValue true
|
|
26
|
+
*/
|
|
27
|
+
autoSnap?: boolean;
|
|
28
|
+
/**
|
|
29
|
+
* <zh/> 指定元素上的哪个图形作为参照图形
|
|
30
|
+
*
|
|
31
|
+
* <en/> Specifies which shape on the element to use as the reference shape
|
|
32
|
+
* @defaultValue `'key'`
|
|
33
|
+
* @remarks
|
|
34
|
+
* <zh/>
|
|
35
|
+
* - 'key' 使用元素的主图形作为参照图形
|
|
36
|
+
* - 也可以传入一个函数,接收元素对象,返回一个图形
|
|
37
|
+
*
|
|
38
|
+
* <en/>
|
|
39
|
+
* - `'key'` uses the key shape of the element as the reference shape
|
|
40
|
+
* - You can also pass in a function that receives the element and returns a shape
|
|
41
|
+
*/
|
|
42
|
+
shape?: string | ((node: Node) => DisplayObject);
|
|
43
|
+
/**
|
|
44
|
+
* <zh/> 垂直对齐线样式
|
|
45
|
+
*
|
|
46
|
+
* <en/> Vertical snapline style
|
|
47
|
+
* @defaultValue `{ stroke: '#1783FF' }`
|
|
48
|
+
*/
|
|
49
|
+
verticalLineStyle?: BaseStyleProps;
|
|
50
|
+
/**
|
|
51
|
+
* <zh/> 水平对齐线样式
|
|
52
|
+
*
|
|
53
|
+
* <en/> Horizontal snapline style
|
|
54
|
+
* @defaultValue `{ stroke: '#1783FF' }`
|
|
55
|
+
*/
|
|
56
|
+
horizontalLineStyle?: BaseStyleProps;
|
|
57
|
+
/**
|
|
58
|
+
* <zh/> 过滤器,用于过滤不需要作为参考的节点
|
|
59
|
+
*
|
|
60
|
+
* <en/> Filter, used to filter nodes that do not need to be used as references
|
|
61
|
+
* @defaultValue `() => true`
|
|
62
|
+
*/
|
|
63
|
+
filter?: (node: Node) => boolean;
|
|
64
|
+
}
|
|
65
|
+
export declare class Snapline extends BasePlugin<SnaplineOptions> {
|
|
66
|
+
static defaultOptions: Partial<SnaplineOptions>;
|
|
67
|
+
private horizontalLine;
|
|
68
|
+
private verticalLine;
|
|
69
|
+
constructor(context: RuntimeContext, options: SnaplineOptions);
|
|
70
|
+
private initSnapline;
|
|
71
|
+
private getNodes;
|
|
72
|
+
private hideSnapline;
|
|
73
|
+
private getLineWidth;
|
|
74
|
+
private updateSnapline;
|
|
75
|
+
private isHorizontalSticking;
|
|
76
|
+
private isVerticalSticking;
|
|
77
|
+
private enableStick;
|
|
78
|
+
private autoSnapToLine;
|
|
79
|
+
/**
|
|
80
|
+
* Get the delta of the drag
|
|
81
|
+
* @param event - drag event object
|
|
82
|
+
* @returns delta
|
|
83
|
+
* @internal
|
|
84
|
+
*/
|
|
85
|
+
protected getDelta(event: IDragEvent<Node>): [number, number] | Float32Array | [number, number, number];
|
|
86
|
+
private enableSnap;
|
|
87
|
+
private calcSnaplineMetadata;
|
|
88
|
+
protected onDragStart: () => void;
|
|
89
|
+
protected onDrag: (event: IDragEvent<Node>) => Promise<void>;
|
|
90
|
+
protected onDragEnd: () => void;
|
|
91
|
+
private bindEvents;
|
|
92
|
+
private unbindEvents;
|
|
93
|
+
private destroyElements;
|
|
94
|
+
destroy(): void;
|
|
95
|
+
}
|
|
@@ -0,0 +1,268 @@
|
|
|
1
|
+
import { Line } from '@antv/g';
|
|
2
|
+
import { isEqual } from '@antv/util';
|
|
3
|
+
import { NodeEvent } from '../../constants';
|
|
4
|
+
import { isVisible } from '../../utils/element';
|
|
5
|
+
import { divide } from '../../utils/vector';
|
|
6
|
+
import { BasePlugin } from '../base-plugin';
|
|
7
|
+
const defaultLineStyle = { x1: 0, y1: 0, x2: 0, y2: 0, visibility: 'hidden' };
|
|
8
|
+
export class Snapline extends BasePlugin {
|
|
9
|
+
static defaultOptions = {
|
|
10
|
+
tolerance: 5,
|
|
11
|
+
offset: 20,
|
|
12
|
+
autoSnap: true,
|
|
13
|
+
shape: 'key',
|
|
14
|
+
verticalLineStyle: { stroke: '#1783FF' },
|
|
15
|
+
horizontalLineStyle: { stroke: '#1783FF' },
|
|
16
|
+
filter: () => true,
|
|
17
|
+
};
|
|
18
|
+
horizontalLine;
|
|
19
|
+
verticalLine;
|
|
20
|
+
constructor(context, options) {
|
|
21
|
+
super(context, Object.assign({}, Snapline.defaultOptions, options));
|
|
22
|
+
this.bindEvents();
|
|
23
|
+
}
|
|
24
|
+
initSnapline = () => {
|
|
25
|
+
const canvas = this.context.canvas.getLayer('transient');
|
|
26
|
+
if (!this.horizontalLine) {
|
|
27
|
+
this.horizontalLine = canvas.appendChild(new Line({ style: { ...defaultLineStyle, ...this.options.horizontalLineStyle } }));
|
|
28
|
+
}
|
|
29
|
+
if (!this.verticalLine) {
|
|
30
|
+
this.verticalLine = canvas.appendChild(new Line({ style: { ...defaultLineStyle, ...this.options.verticalLineStyle } }));
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
getNodes() {
|
|
34
|
+
const { filter } = this.options;
|
|
35
|
+
const allNodes = this.context.element?.getNodes() || [];
|
|
36
|
+
// 不考虑超出画布视口范围、不可见的节点
|
|
37
|
+
// Nodes that are out of the canvas viewport range, invisible are not considered
|
|
38
|
+
const nodes = allNodes.filter((node) => {
|
|
39
|
+
return isVisible(node) && this.context.viewport?.isInViewport(node.getRenderBounds());
|
|
40
|
+
});
|
|
41
|
+
if (!filter)
|
|
42
|
+
return nodes;
|
|
43
|
+
return nodes.filter((node) => filter(node));
|
|
44
|
+
}
|
|
45
|
+
hideSnapline() {
|
|
46
|
+
this.horizontalLine.style.visibility = 'hidden';
|
|
47
|
+
this.verticalLine.style.visibility = 'hidden';
|
|
48
|
+
}
|
|
49
|
+
getLineWidth(direction) {
|
|
50
|
+
const { lineWidth } = this.options[`${direction}LineStyle`];
|
|
51
|
+
return +(lineWidth || defaultLineStyle.lineWidth || 1) / this.context.graph.getZoom();
|
|
52
|
+
}
|
|
53
|
+
updateSnapline(metadata) {
|
|
54
|
+
const { verticalX, verticalMinY, verticalMaxY, horizontalY, horizontalMinX, horizontalMaxX } = metadata;
|
|
55
|
+
const [canvasWidth, canvasHeight] = this.context.canvas.getSize();
|
|
56
|
+
const { offset } = this.options;
|
|
57
|
+
if (horizontalY !== null) {
|
|
58
|
+
Object.assign(this.horizontalLine.style, {
|
|
59
|
+
x1: offset === Infinity ? 0 : horizontalMinX - offset,
|
|
60
|
+
y1: horizontalY,
|
|
61
|
+
x2: offset === Infinity ? canvasWidth : horizontalMaxX + offset,
|
|
62
|
+
y2: horizontalY,
|
|
63
|
+
visibility: 'visible',
|
|
64
|
+
lineWidth: this.getLineWidth('horizontal'),
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
else {
|
|
68
|
+
this.horizontalLine.style.visibility = 'hidden';
|
|
69
|
+
}
|
|
70
|
+
if (verticalX !== null) {
|
|
71
|
+
Object.assign(this.verticalLine.style, {
|
|
72
|
+
x1: verticalX,
|
|
73
|
+
y1: offset === Infinity ? 0 : verticalMinY - offset,
|
|
74
|
+
x2: verticalX,
|
|
75
|
+
y2: offset === Infinity ? canvasHeight : verticalMaxY + offset,
|
|
76
|
+
visibility: 'visible',
|
|
77
|
+
lineWidth: this.getLineWidth('vertical'),
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
else {
|
|
81
|
+
this.verticalLine.style.visibility = 'hidden';
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
isHorizontalSticking = false;
|
|
85
|
+
isVerticalSticking = false;
|
|
86
|
+
enableStick = true;
|
|
87
|
+
autoSnapToLine = async (nodeId, bbox, metadata) => {
|
|
88
|
+
const { verticalX, horizontalY } = metadata;
|
|
89
|
+
const { tolerance } = this.options;
|
|
90
|
+
const { min: [nodeMinX, nodeMinY], max: [nodeMaxX, nodeMaxY], center: [nodeCenterX, nodeCenterY], } = bbox;
|
|
91
|
+
let dx = 0;
|
|
92
|
+
let dy = 0;
|
|
93
|
+
if (verticalX !== null) {
|
|
94
|
+
if (distance(nodeMaxX, verticalX) < tolerance)
|
|
95
|
+
dx = verticalX - nodeMaxX;
|
|
96
|
+
if (distance(nodeMinX, verticalX) < tolerance)
|
|
97
|
+
dx = verticalX - nodeMinX;
|
|
98
|
+
if (distance(nodeCenterX, verticalX) < tolerance)
|
|
99
|
+
dx = verticalX - nodeCenterX;
|
|
100
|
+
if (dx !== 0)
|
|
101
|
+
this.isVerticalSticking = true;
|
|
102
|
+
}
|
|
103
|
+
if (horizontalY !== null) {
|
|
104
|
+
if (distance(nodeMaxY, horizontalY) < tolerance)
|
|
105
|
+
dy = horizontalY - nodeMaxY;
|
|
106
|
+
if (distance(nodeMinY, horizontalY) < tolerance)
|
|
107
|
+
dy = horizontalY - nodeMinY;
|
|
108
|
+
if (distance(nodeCenterY, horizontalY) < tolerance)
|
|
109
|
+
dy = horizontalY - nodeCenterY;
|
|
110
|
+
if (dy !== 0)
|
|
111
|
+
this.isHorizontalSticking = true;
|
|
112
|
+
}
|
|
113
|
+
if (dx !== 0 || dy !== 0) {
|
|
114
|
+
// Stick to the line
|
|
115
|
+
await this.context.graph.translateElementBy({ [nodeId]: [dx, dy] }, false);
|
|
116
|
+
}
|
|
117
|
+
};
|
|
118
|
+
/**
|
|
119
|
+
* Get the delta of the drag
|
|
120
|
+
* @param event - drag event object
|
|
121
|
+
* @returns delta
|
|
122
|
+
* @internal
|
|
123
|
+
*/
|
|
124
|
+
getDelta(event) {
|
|
125
|
+
const zoom = this.context.graph.getZoom();
|
|
126
|
+
return divide([event.dx, event.dy], zoom);
|
|
127
|
+
}
|
|
128
|
+
enableSnap = (event) => {
|
|
129
|
+
const { target } = event;
|
|
130
|
+
const threshold = 0.5;
|
|
131
|
+
if (this.isHorizontalSticking || this.isVerticalSticking) {
|
|
132
|
+
const [dx, dy] = this.getDelta(event);
|
|
133
|
+
if (this.isHorizontalSticking &&
|
|
134
|
+
this.isVerticalSticking &&
|
|
135
|
+
Math.abs(dx) <= threshold &&
|
|
136
|
+
Math.abs(dy) <= threshold) {
|
|
137
|
+
this.context.graph.translateElementBy({ [target.id]: [-dx, -dy] }, false);
|
|
138
|
+
return false;
|
|
139
|
+
}
|
|
140
|
+
else if (this.isHorizontalSticking && Math.abs(dy) <= threshold) {
|
|
141
|
+
this.context.graph.translateElementBy({ [target.id]: [0, -dy] }, false);
|
|
142
|
+
return false;
|
|
143
|
+
}
|
|
144
|
+
else if (this.isVerticalSticking && Math.abs(dx) <= threshold) {
|
|
145
|
+
this.context.graph.translateElementBy({ [target.id]: [-dx, 0] }, false);
|
|
146
|
+
return false;
|
|
147
|
+
}
|
|
148
|
+
else {
|
|
149
|
+
this.isHorizontalSticking = false;
|
|
150
|
+
this.isVerticalSticking = false;
|
|
151
|
+
this.enableStick = false;
|
|
152
|
+
setTimeout(() => {
|
|
153
|
+
this.enableStick = true;
|
|
154
|
+
}, 200);
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
return this.enableStick;
|
|
158
|
+
};
|
|
159
|
+
calcSnaplineMetadata = (target, nodeBBox) => {
|
|
160
|
+
const { tolerance, shape } = this.options;
|
|
161
|
+
const { min: [nodeMinX, nodeMinY], max: [nodeMaxX, nodeMaxY], center: [nodeCenterX, nodeCenterY], } = nodeBBox;
|
|
162
|
+
let verticalX = null;
|
|
163
|
+
let verticalMinY = null;
|
|
164
|
+
let verticalMaxY = null;
|
|
165
|
+
let horizontalY = null;
|
|
166
|
+
let horizontalMinX = null;
|
|
167
|
+
let horizontalMaxX = null;
|
|
168
|
+
this.getNodes().some((snapNode) => {
|
|
169
|
+
if (isEqual(target.id, snapNode.id))
|
|
170
|
+
return false;
|
|
171
|
+
const snapBBox = getShape(snapNode, shape).getRenderBounds();
|
|
172
|
+
const { min: [snapMinX, snapMinY], max: [snapMaxX, snapMaxY], center: [snapCenterX, snapCenterY], } = snapBBox;
|
|
173
|
+
if (verticalX === null) {
|
|
174
|
+
if (distance(snapCenterX, nodeCenterX) < tolerance) {
|
|
175
|
+
verticalX = snapCenterX;
|
|
176
|
+
}
|
|
177
|
+
else if (distance(snapMinX, nodeMinX) < tolerance) {
|
|
178
|
+
verticalX = snapMinX;
|
|
179
|
+
}
|
|
180
|
+
else if (distance(snapMinX, nodeMaxX) < tolerance) {
|
|
181
|
+
verticalX = snapMinX;
|
|
182
|
+
}
|
|
183
|
+
else if (distance(snapMaxX, nodeMaxX) < tolerance) {
|
|
184
|
+
verticalX = snapMaxX;
|
|
185
|
+
}
|
|
186
|
+
else if (distance(snapMaxX, nodeMinX) < tolerance) {
|
|
187
|
+
verticalX = snapMaxX;
|
|
188
|
+
}
|
|
189
|
+
if (verticalX !== null) {
|
|
190
|
+
verticalMinY = Math.min(snapMinY, nodeMinY);
|
|
191
|
+
verticalMaxY = Math.max(snapMaxY, nodeMaxY);
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
if (horizontalY === null) {
|
|
195
|
+
if (distance(snapCenterY, nodeCenterY) < tolerance) {
|
|
196
|
+
horizontalY = snapCenterY;
|
|
197
|
+
}
|
|
198
|
+
else if (distance(snapMinY, nodeMinY) < tolerance) {
|
|
199
|
+
horizontalY = snapMinY;
|
|
200
|
+
}
|
|
201
|
+
else if (distance(snapMinY, nodeMaxY) < tolerance) {
|
|
202
|
+
horizontalY = snapMinY;
|
|
203
|
+
}
|
|
204
|
+
else if (distance(snapMaxY, nodeMaxY) < tolerance) {
|
|
205
|
+
horizontalY = snapMaxY;
|
|
206
|
+
}
|
|
207
|
+
else if (distance(snapMaxY, nodeMinY) < tolerance) {
|
|
208
|
+
horizontalY = snapMaxY;
|
|
209
|
+
}
|
|
210
|
+
if (horizontalY !== null) {
|
|
211
|
+
horizontalMinX = Math.min(snapMinX, nodeMinX);
|
|
212
|
+
horizontalMaxX = Math.max(snapMaxX, nodeMaxX);
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
return verticalX !== null && horizontalY !== null;
|
|
216
|
+
});
|
|
217
|
+
return { verticalX, verticalMinY, verticalMaxY, horizontalY, horizontalMinX, horizontalMaxX };
|
|
218
|
+
};
|
|
219
|
+
onDragStart = () => {
|
|
220
|
+
this.initSnapline();
|
|
221
|
+
};
|
|
222
|
+
onDrag = async (event) => {
|
|
223
|
+
const { target } = event;
|
|
224
|
+
if (this.options.autoSnap) {
|
|
225
|
+
const enable = this.enableSnap(event);
|
|
226
|
+
if (!enable)
|
|
227
|
+
return;
|
|
228
|
+
}
|
|
229
|
+
const nodeBBox = getShape(target, this.options.shape).getRenderBounds();
|
|
230
|
+
const metadata = this.calcSnaplineMetadata(target, nodeBBox);
|
|
231
|
+
this.hideSnapline();
|
|
232
|
+
if (metadata.verticalX !== null || metadata.horizontalY !== null) {
|
|
233
|
+
this.updateSnapline(metadata);
|
|
234
|
+
}
|
|
235
|
+
if (this.options.autoSnap) {
|
|
236
|
+
await this.autoSnapToLine(target.id, nodeBBox, metadata);
|
|
237
|
+
}
|
|
238
|
+
};
|
|
239
|
+
onDragEnd = () => {
|
|
240
|
+
this.hideSnapline();
|
|
241
|
+
};
|
|
242
|
+
async bindEvents() {
|
|
243
|
+
const { graph } = this.context;
|
|
244
|
+
graph.on(NodeEvent.DRAG_START, this.onDragStart);
|
|
245
|
+
graph.on(NodeEvent.DRAG, this.onDrag);
|
|
246
|
+
graph.on(NodeEvent.DRAG_END, this.onDragEnd);
|
|
247
|
+
}
|
|
248
|
+
unbindEvents() {
|
|
249
|
+
const { graph } = this.context;
|
|
250
|
+
graph.off(NodeEvent.DRAG_START, this.onDragStart);
|
|
251
|
+
graph.off(NodeEvent.DRAG, this.onDrag);
|
|
252
|
+
graph.off(NodeEvent.DRAG_END, this.onDragEnd);
|
|
253
|
+
}
|
|
254
|
+
destroyElements() {
|
|
255
|
+
this.horizontalLine?.destroy();
|
|
256
|
+
this.verticalLine?.destroy();
|
|
257
|
+
}
|
|
258
|
+
destroy() {
|
|
259
|
+
this.destroyElements();
|
|
260
|
+
this.unbindEvents();
|
|
261
|
+
super.destroy();
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
const distance = (a, b) => Math.abs(a - b);
|
|
265
|
+
const getShape = (node, shapeFilter) => {
|
|
266
|
+
return typeof shapeFilter === 'function' ? shapeFilter(node) : node.getShape(shapeFilter);
|
|
267
|
+
};
|
|
268
|
+
//# sourceMappingURL=index.js.map
|