@logicflow/extension 2.1.5 → 2.2.0-alpha.0
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/.turbo/turbo-build.log +7 -7
- package/CHANGELOG.md +22 -0
- package/dist/index.min.js +1 -1
- package/dist/index.min.js.map +1 -1
- package/es/components/dnd-panel/index.js +6 -2
- package/es/components/mini-map/index.js +7 -12
- package/es/components/selection-select/index.d.ts +1 -0
- package/es/components/selection-select/index.js +29 -14
- package/es/tools/label/Label.d.ts +2 -2
- package/es/tools/label/Label.js +1 -1
- package/lib/components/dnd-panel/index.js +6 -2
- package/lib/components/mini-map/index.js +7 -12
- package/lib/components/selection-select/index.d.ts +1 -0
- package/lib/components/selection-select/index.js +29 -14
- package/lib/tools/label/Label.d.ts +2 -2
- package/lib/tools/label/Label.js +1 -1
- package/package.json +5 -5
- package/src/components/dnd-panel/index.ts +10 -2
- package/src/components/menu/index.ts +0 -1
- package/src/components/mini-map/index.ts +9 -18
- package/src/components/selection-select/index.ts +33 -22
- package/src/tools/label/Label.tsx +4 -4
- package/stats.html +1 -1
|
@@ -17,6 +17,9 @@ var DndPanel = /** @class */ (function () {
|
|
|
17
17
|
}
|
|
18
18
|
this.panelEl = document.createElement('div');
|
|
19
19
|
this.panelEl.className = 'lf-dndpanel';
|
|
20
|
+
this.panelEl.addEventListener('touchmove', function (e) {
|
|
21
|
+
e.preventDefault();
|
|
22
|
+
}, { passive: false });
|
|
20
23
|
this.shapeList.forEach(function (shapeItem) {
|
|
21
24
|
var _a;
|
|
22
25
|
(_a = _this.panelEl) === null || _a === void 0 ? void 0 : _a.appendChild(_this.createDndItem(shapeItem));
|
|
@@ -63,14 +66,14 @@ var DndPanel = /** @class */ (function () {
|
|
|
63
66
|
if (shapeItem.disabled) {
|
|
64
67
|
el.classList.add('disabled');
|
|
65
68
|
// 保留callback的执行,可用于界面提示当前shapeItem的禁用状态
|
|
66
|
-
el.
|
|
69
|
+
el.onpointerdown = function () {
|
|
67
70
|
if (shapeItem.callback) {
|
|
68
71
|
shapeItem.callback(_this.lf, _this.domContainer);
|
|
69
72
|
}
|
|
70
73
|
};
|
|
71
74
|
return el;
|
|
72
75
|
}
|
|
73
|
-
el.
|
|
76
|
+
el.onpointerdown = function (e) {
|
|
74
77
|
if (shapeItem.type) {
|
|
75
78
|
_this.lf.dnd.startDrag({
|
|
76
79
|
type: shapeItem.type,
|
|
@@ -81,6 +84,7 @@ var DndPanel = /** @class */ (function () {
|
|
|
81
84
|
if (shapeItem.callback) {
|
|
82
85
|
shapeItem.callback(_this.lf, _this.domContainer);
|
|
83
86
|
}
|
|
87
|
+
e.preventDefault();
|
|
84
88
|
};
|
|
85
89
|
el.ondblclick = function (e) {
|
|
86
90
|
_this.lf.graphModel.eventCenter.emit('dnd:panel-dbclick', {
|
|
@@ -9,7 +9,6 @@ var __values = (this && this.__values) || function(o) {
|
|
|
9
9
|
};
|
|
10
10
|
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
11
11
|
};
|
|
12
|
-
import { createTeleportContainer, destroyTeleportContainer, } from '@logicflow/vue-node-registry';
|
|
13
12
|
var MiniMap = /** @class */ (function () {
|
|
14
13
|
function MiniMap(_a) {
|
|
15
14
|
var lf = _a.lf, LogicFlow = _a.LogicFlow, options = _a.options;
|
|
@@ -107,8 +106,6 @@ var MiniMap = /** @class */ (function () {
|
|
|
107
106
|
*/
|
|
108
107
|
this.hide = function () {
|
|
109
108
|
if (_this.isShow) {
|
|
110
|
-
// 隐藏小地图时摧毁实例
|
|
111
|
-
destroyTeleportContainer(_this.lfMap.graphModel.flowId);
|
|
112
109
|
_this.lf.off('graph:resize', _this.onGraphResize);
|
|
113
110
|
_this.lfMap.destroy();
|
|
114
111
|
// 保证重新创建实例时,小地图中内容偏移正确
|
|
@@ -182,8 +179,8 @@ var MiniMap = /** @class */ (function () {
|
|
|
182
179
|
}
|
|
183
180
|
};
|
|
184
181
|
this.startDrag = function (e) {
|
|
185
|
-
document.addEventListener('
|
|
186
|
-
document.addEventListener('
|
|
182
|
+
document.addEventListener('pointermove', _this.drag);
|
|
183
|
+
document.addEventListener('pointerup', _this.drop);
|
|
187
184
|
var x = e.x, y = e.y;
|
|
188
185
|
_this.startPosition = { x: x, y: y };
|
|
189
186
|
};
|
|
@@ -209,8 +206,8 @@ var MiniMap = /** @class */ (function () {
|
|
|
209
206
|
* 拖拽预览视窗结束,移除拖拽事件
|
|
210
207
|
*/
|
|
211
208
|
this.drop = function () {
|
|
212
|
-
document.removeEventListener('
|
|
213
|
-
document.removeEventListener('
|
|
209
|
+
document.removeEventListener('pointermove', _this.drag);
|
|
210
|
+
document.removeEventListener('pointerup', _this.drop);
|
|
214
211
|
};
|
|
215
212
|
/**
|
|
216
213
|
* 点击小地图中非预览视窗的区域时,移动主画布视口聚焦于点击位置
|
|
@@ -279,12 +276,11 @@ var MiniMap = /** @class */ (function () {
|
|
|
279
276
|
history: false,
|
|
280
277
|
snapline: false,
|
|
281
278
|
disabledPlugins: this.disabledPlugins,
|
|
279
|
+
isMiniMap: true,
|
|
282
280
|
});
|
|
283
281
|
// minimap中禁用adapter。
|
|
284
282
|
// this.lfMap.adapterIn = (a) => a
|
|
285
283
|
// this.lfMap.adapterOut = (a) => a
|
|
286
|
-
// 创建teleport容器(vue3中生效)
|
|
287
|
-
createTeleportContainer(miniMapWrap, this.lfMap.graphModel.flowId);
|
|
288
284
|
this.miniMapWrap = miniMapWrap;
|
|
289
285
|
this.createViewPort();
|
|
290
286
|
miniMapWrap.addEventListener('click', this.mapClick);
|
|
@@ -517,8 +513,8 @@ var MiniMap = /** @class */ (function () {
|
|
|
517
513
|
MiniMap.prototype.createViewPort = function () {
|
|
518
514
|
var div = document.createElement('div');
|
|
519
515
|
div.className = 'lf-minimap-viewport';
|
|
520
|
-
|
|
521
|
-
div.addEventListener('
|
|
516
|
+
div.style.touchAction = 'none';
|
|
517
|
+
div.addEventListener('pointerdown', this.startDrag);
|
|
522
518
|
// 禁止预览视窗的点击事件冒泡
|
|
523
519
|
div.addEventListener('click', function (e) {
|
|
524
520
|
e.stopPropagation();
|
|
@@ -526,7 +522,6 @@ var MiniMap = /** @class */ (function () {
|
|
|
526
522
|
this.viewport = div;
|
|
527
523
|
};
|
|
528
524
|
MiniMap.prototype.destroy = function () {
|
|
529
|
-
destroyTeleportContainer(this.lfMap.graphModel.flowId);
|
|
530
525
|
this.lf.off('graph:resize', this.onGraphResize);
|
|
531
526
|
};
|
|
532
527
|
MiniMap.pluginName = 'miniMap';
|
|
@@ -32,6 +32,7 @@ var SelectionSelect = /** @class */ (function () {
|
|
|
32
32
|
this.disabled = true;
|
|
33
33
|
this.isWholeNode = true;
|
|
34
34
|
this.isWholeEdge = true;
|
|
35
|
+
this.originStatusSaved = false;
|
|
35
36
|
this.exclusiveMode = false; // 框选独占模式:true 表示只能进行框选操作,false 表示可以同时进行其他画布操作
|
|
36
37
|
// 用于区分选区和点击事件
|
|
37
38
|
this.mouseDownInfo = null;
|
|
@@ -45,6 +46,12 @@ var SelectionSelect = /** @class */ (function () {
|
|
|
45
46
|
_this.handleMouseDown(e);
|
|
46
47
|
};
|
|
47
48
|
this.draw = function (ev) {
|
|
49
|
+
if (_this.lf.graphModel.editConfigModel.isPinching) {
|
|
50
|
+
_this.lf.updateEditConfig({ stopMoveGraph: _this.originalStopMoveGraph });
|
|
51
|
+
_this.originStatusSaved = false;
|
|
52
|
+
_this.cleanupSelectionState();
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
48
55
|
var _a = _this.lf.getPointByClient(ev.clientX, ev.clientY).domOverlayPosition, x1 = _a.x, y1 = _a.y;
|
|
49
56
|
_this.endPoint = {
|
|
50
57
|
x: x1,
|
|
@@ -73,6 +80,11 @@ var SelectionSelect = /** @class */ (function () {
|
|
|
73
80
|
}
|
|
74
81
|
};
|
|
75
82
|
this.drawOff = function (e) {
|
|
83
|
+
// 恢复原始的 stopMoveGraph 设置
|
|
84
|
+
_this.lf.updateEditConfig({
|
|
85
|
+
stopMoveGraph: _this.originalStopMoveGraph,
|
|
86
|
+
});
|
|
87
|
+
_this.originStatusSaved = false;
|
|
76
88
|
// 处理鼠标抬起事件
|
|
77
89
|
// 首先判断是否是点击,如果是,则清空框选
|
|
78
90
|
if (_this.mouseDownInfo) {
|
|
@@ -88,14 +100,10 @@ var SelectionSelect = /** @class */ (function () {
|
|
|
88
100
|
}
|
|
89
101
|
var curStartPoint = cloneDeep(_this.startPoint);
|
|
90
102
|
var curEndPoint = cloneDeep(_this.endPoint);
|
|
91
|
-
document.removeEventListener('
|
|
103
|
+
document.removeEventListener('pointermove', _this.draw);
|
|
92
104
|
if (!_this.exclusiveMode) {
|
|
93
|
-
document.removeEventListener('
|
|
105
|
+
document.removeEventListener('pointerup', _this.drawOff);
|
|
94
106
|
}
|
|
95
|
-
// 恢复原始的 stopMoveGraph 设置
|
|
96
|
-
_this.lf.updateEditConfig({
|
|
97
|
-
stopMoveGraph: _this.originalStopMoveGraph,
|
|
98
|
-
});
|
|
99
107
|
if (curStartPoint && curEndPoint) {
|
|
100
108
|
var x = curStartPoint.x, y = curStartPoint.y;
|
|
101
109
|
var x1 = curEndPoint.x, y1 = curEndPoint.y;
|
|
@@ -208,8 +216,8 @@ var SelectionSelect = /** @class */ (function () {
|
|
|
208
216
|
this.endPoint = undefined;
|
|
209
217
|
this.mouseDownInfo = null;
|
|
210
218
|
// 移除事件监听
|
|
211
|
-
document.removeEventListener('
|
|
212
|
-
document.removeEventListener('
|
|
219
|
+
document.removeEventListener('pointermove', this.draw);
|
|
220
|
+
document.removeEventListener('pointerup', this.drawOff);
|
|
213
221
|
};
|
|
214
222
|
/**
|
|
215
223
|
* 切换框选模式
|
|
@@ -233,7 +241,8 @@ var SelectionSelect = /** @class */ (function () {
|
|
|
233
241
|
if (this.exclusiveMode) {
|
|
234
242
|
// 独占模式:监听 container 的 mousedown 事件
|
|
235
243
|
this.container.style.pointerEvents = 'auto';
|
|
236
|
-
this.container.
|
|
244
|
+
this.container.style.touchAction = 'none';
|
|
245
|
+
this.container.addEventListener('pointerdown', this.handleMouseDown);
|
|
237
246
|
}
|
|
238
247
|
else {
|
|
239
248
|
// 非独占模式:监听画布的 blank:mousedown 事件
|
|
@@ -245,7 +254,7 @@ var SelectionSelect = /** @class */ (function () {
|
|
|
245
254
|
SelectionSelect.prototype.removeEventListeners = function () {
|
|
246
255
|
if (this.container) {
|
|
247
256
|
this.container.style.pointerEvents = 'none';
|
|
248
|
-
this.container.removeEventListener('
|
|
257
|
+
this.container.removeEventListener('pointerdown', this.handleMouseDown);
|
|
249
258
|
}
|
|
250
259
|
// 移除 blank:mousedown 事件监听
|
|
251
260
|
this.lf.off('blank:mousedown', this.handleBlankMouseDown);
|
|
@@ -257,6 +266,8 @@ var SelectionSelect = /** @class */ (function () {
|
|
|
257
266
|
var _a;
|
|
258
267
|
if (!this.container || this.disabled)
|
|
259
268
|
return;
|
|
269
|
+
if (this.lf.graphModel.editConfigModel.isPinching)
|
|
270
|
+
return;
|
|
260
271
|
// 禁用右键框选
|
|
261
272
|
var isRightClick = e.button === 2;
|
|
262
273
|
if (isRightClick)
|
|
@@ -270,7 +281,11 @@ var SelectionSelect = /** @class */ (function () {
|
|
|
270
281
|
time: Date.now(),
|
|
271
282
|
};
|
|
272
283
|
// 记录原始设置并临时禁止画布移动
|
|
273
|
-
|
|
284
|
+
if (!this.originStatusSaved) {
|
|
285
|
+
// 为了防止在开启框选时用户多次点击画布导致缓存的stopMoveGraph变化,所以只在第一次点击时记录原始的stopMoveGraph issue #2263
|
|
286
|
+
this.originalStopMoveGraph = this.lf.getEditConfig().stopMoveGraph;
|
|
287
|
+
this.originStatusSaved = true;
|
|
288
|
+
}
|
|
274
289
|
this.lf.updateEditConfig({
|
|
275
290
|
stopMoveGraph: true,
|
|
276
291
|
});
|
|
@@ -286,8 +301,8 @@ var SelectionSelect = /** @class */ (function () {
|
|
|
286
301
|
wrapper.style.left = "".concat(this.startPoint.x, "px");
|
|
287
302
|
(_a = this.container) === null || _a === void 0 ? void 0 : _a.appendChild(wrapper);
|
|
288
303
|
this.wrapper = wrapper;
|
|
289
|
-
document.addEventListener('
|
|
290
|
-
document.addEventListener('
|
|
304
|
+
document.addEventListener('pointermove', this.draw);
|
|
305
|
+
document.addEventListener('pointerup', this.drawOff);
|
|
291
306
|
};
|
|
292
307
|
/**
|
|
293
308
|
* 设置选中的灵敏度
|
|
@@ -325,7 +340,7 @@ var SelectionSelect = /** @class */ (function () {
|
|
|
325
340
|
if (this.wrapper && this.startPoint && this.endPoint) {
|
|
326
341
|
// 记录上一次的结束点,用于触发 mouseup 事件
|
|
327
342
|
var lastEndPoint = cloneDeep(this.endPoint);
|
|
328
|
-
var lastEvent = new
|
|
343
|
+
var lastEvent = new PointerEvent('pointerup', {
|
|
329
344
|
clientX: lastEndPoint.x,
|
|
330
345
|
clientY: lastEndPoint.y,
|
|
331
346
|
});
|
|
@@ -17,8 +17,8 @@ export declare class Label extends Component<ILabelProps, ILabelState> {
|
|
|
17
17
|
constructor(props: ILabelProps);
|
|
18
18
|
setHoverOn: () => void;
|
|
19
19
|
setHoverOff: () => void;
|
|
20
|
-
handleMouseDown: (e:
|
|
21
|
-
handleMouseUp: (e:
|
|
20
|
+
handleMouseDown: (e: PointerEvent) => void;
|
|
21
|
+
handleMouseUp: (e: PointerEvent) => void;
|
|
22
22
|
handleDragging: ({ deltaX, deltaY }: IDragParams) => void;
|
|
23
23
|
handleDragEnd: () => void;
|
|
24
24
|
handleClick: (e: MouseEvent) => void;
|
package/es/tools/label/Label.js
CHANGED
|
@@ -274,7 +274,7 @@ var Label = /** @class */ (function (_super) {
|
|
|
274
274
|
? "".concat(transform, " rotate(").concat(rotate, "deg)")
|
|
275
275
|
: "".concat(transform, " rotate(").concat(vertical ? -0.25 : 0, "turn)"),
|
|
276
276
|
};
|
|
277
|
-
return (_jsx("div", { id: "element-container-".concat(id), className: classNames('lf-label-editor-container'), style: containerStyle,
|
|
277
|
+
return (_jsx("div", { id: "element-container-".concat(id), className: classNames('lf-label-editor-container'), style: containerStyle, onPointerDown: this.handleMouseDown, onPointerUp: this.handleMouseUp, onClick: this.handleClick, onDblClick: this.handleDbClick, onBlur: this.handleBlur, onMouseEnter: this.setHoverOn, onMouseOver: this.setHoverOn, onMouseLeave: this.setHoverOff, children: _jsx("div", { ref: this.textRef, id: "editor-container-".concat(id), className: classNames('lf-label-editor', (_a = {
|
|
278
278
|
'lf-label-editor-dragging': isDragging,
|
|
279
279
|
'lf-label-editor-editing': isEditing,
|
|
280
280
|
'lf-label-editor-hover': !isEditing && (isHovered || isSelected)
|
|
@@ -20,6 +20,9 @@ var DndPanel = /** @class */ (function () {
|
|
|
20
20
|
}
|
|
21
21
|
this.panelEl = document.createElement('div');
|
|
22
22
|
this.panelEl.className = 'lf-dndpanel';
|
|
23
|
+
this.panelEl.addEventListener('touchmove', function (e) {
|
|
24
|
+
e.preventDefault();
|
|
25
|
+
}, { passive: false });
|
|
23
26
|
this.shapeList.forEach(function (shapeItem) {
|
|
24
27
|
var _a;
|
|
25
28
|
(_a = _this.panelEl) === null || _a === void 0 ? void 0 : _a.appendChild(_this.createDndItem(shapeItem));
|
|
@@ -66,14 +69,14 @@ var DndPanel = /** @class */ (function () {
|
|
|
66
69
|
if (shapeItem.disabled) {
|
|
67
70
|
el.classList.add('disabled');
|
|
68
71
|
// 保留callback的执行,可用于界面提示当前shapeItem的禁用状态
|
|
69
|
-
el.
|
|
72
|
+
el.onpointerdown = function () {
|
|
70
73
|
if (shapeItem.callback) {
|
|
71
74
|
shapeItem.callback(_this.lf, _this.domContainer);
|
|
72
75
|
}
|
|
73
76
|
};
|
|
74
77
|
return el;
|
|
75
78
|
}
|
|
76
|
-
el.
|
|
79
|
+
el.onpointerdown = function (e) {
|
|
77
80
|
if (shapeItem.type) {
|
|
78
81
|
_this.lf.dnd.startDrag({
|
|
79
82
|
type: shapeItem.type,
|
|
@@ -84,6 +87,7 @@ var DndPanel = /** @class */ (function () {
|
|
|
84
87
|
if (shapeItem.callback) {
|
|
85
88
|
shapeItem.callback(_this.lf, _this.domContainer);
|
|
86
89
|
}
|
|
90
|
+
e.preventDefault();
|
|
87
91
|
};
|
|
88
92
|
el.ondblclick = function (e) {
|
|
89
93
|
_this.lf.graphModel.eventCenter.emit('dnd:panel-dbclick', {
|
|
@@ -12,7 +12,6 @@ var __values = (this && this.__values) || function(o) {
|
|
|
12
12
|
};
|
|
13
13
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
14
|
exports.MiniMap = void 0;
|
|
15
|
-
var vue_node_registry_1 = require("@logicflow/vue-node-registry");
|
|
16
15
|
var MiniMap = /** @class */ (function () {
|
|
17
16
|
function MiniMap(_a) {
|
|
18
17
|
var lf = _a.lf, LogicFlow = _a.LogicFlow, options = _a.options;
|
|
@@ -110,8 +109,6 @@ var MiniMap = /** @class */ (function () {
|
|
|
110
109
|
*/
|
|
111
110
|
this.hide = function () {
|
|
112
111
|
if (_this.isShow) {
|
|
113
|
-
// 隐藏小地图时摧毁实例
|
|
114
|
-
(0, vue_node_registry_1.destroyTeleportContainer)(_this.lfMap.graphModel.flowId);
|
|
115
112
|
_this.lf.off('graph:resize', _this.onGraphResize);
|
|
116
113
|
_this.lfMap.destroy();
|
|
117
114
|
// 保证重新创建实例时,小地图中内容偏移正确
|
|
@@ -185,8 +182,8 @@ var MiniMap = /** @class */ (function () {
|
|
|
185
182
|
}
|
|
186
183
|
};
|
|
187
184
|
this.startDrag = function (e) {
|
|
188
|
-
document.addEventListener('
|
|
189
|
-
document.addEventListener('
|
|
185
|
+
document.addEventListener('pointermove', _this.drag);
|
|
186
|
+
document.addEventListener('pointerup', _this.drop);
|
|
190
187
|
var x = e.x, y = e.y;
|
|
191
188
|
_this.startPosition = { x: x, y: y };
|
|
192
189
|
};
|
|
@@ -212,8 +209,8 @@ var MiniMap = /** @class */ (function () {
|
|
|
212
209
|
* 拖拽预览视窗结束,移除拖拽事件
|
|
213
210
|
*/
|
|
214
211
|
this.drop = function () {
|
|
215
|
-
document.removeEventListener('
|
|
216
|
-
document.removeEventListener('
|
|
212
|
+
document.removeEventListener('pointermove', _this.drag);
|
|
213
|
+
document.removeEventListener('pointerup', _this.drop);
|
|
217
214
|
};
|
|
218
215
|
/**
|
|
219
216
|
* 点击小地图中非预览视窗的区域时,移动主画布视口聚焦于点击位置
|
|
@@ -282,12 +279,11 @@ var MiniMap = /** @class */ (function () {
|
|
|
282
279
|
history: false,
|
|
283
280
|
snapline: false,
|
|
284
281
|
disabledPlugins: this.disabledPlugins,
|
|
282
|
+
isMiniMap: true,
|
|
285
283
|
});
|
|
286
284
|
// minimap中禁用adapter。
|
|
287
285
|
// this.lfMap.adapterIn = (a) => a
|
|
288
286
|
// this.lfMap.adapterOut = (a) => a
|
|
289
|
-
// 创建teleport容器(vue3中生效)
|
|
290
|
-
(0, vue_node_registry_1.createTeleportContainer)(miniMapWrap, this.lfMap.graphModel.flowId);
|
|
291
287
|
this.miniMapWrap = miniMapWrap;
|
|
292
288
|
this.createViewPort();
|
|
293
289
|
miniMapWrap.addEventListener('click', this.mapClick);
|
|
@@ -520,8 +516,8 @@ var MiniMap = /** @class */ (function () {
|
|
|
520
516
|
MiniMap.prototype.createViewPort = function () {
|
|
521
517
|
var div = document.createElement('div');
|
|
522
518
|
div.className = 'lf-minimap-viewport';
|
|
523
|
-
|
|
524
|
-
div.addEventListener('
|
|
519
|
+
div.style.touchAction = 'none';
|
|
520
|
+
div.addEventListener('pointerdown', this.startDrag);
|
|
525
521
|
// 禁止预览视窗的点击事件冒泡
|
|
526
522
|
div.addEventListener('click', function (e) {
|
|
527
523
|
e.stopPropagation();
|
|
@@ -529,7 +525,6 @@ var MiniMap = /** @class */ (function () {
|
|
|
529
525
|
this.viewport = div;
|
|
530
526
|
};
|
|
531
527
|
MiniMap.prototype.destroy = function () {
|
|
532
|
-
(0, vue_node_registry_1.destroyTeleportContainer)(this.lfMap.graphModel.flowId);
|
|
533
528
|
this.lf.off('graph:resize', this.onGraphResize);
|
|
534
529
|
};
|
|
535
530
|
MiniMap.pluginName = 'miniMap';
|
|
@@ -35,6 +35,7 @@ var SelectionSelect = /** @class */ (function () {
|
|
|
35
35
|
this.disabled = true;
|
|
36
36
|
this.isWholeNode = true;
|
|
37
37
|
this.isWholeEdge = true;
|
|
38
|
+
this.originStatusSaved = false;
|
|
38
39
|
this.exclusiveMode = false; // 框选独占模式:true 表示只能进行框选操作,false 表示可以同时进行其他画布操作
|
|
39
40
|
// 用于区分选区和点击事件
|
|
40
41
|
this.mouseDownInfo = null;
|
|
@@ -48,6 +49,12 @@ var SelectionSelect = /** @class */ (function () {
|
|
|
48
49
|
_this.handleMouseDown(e);
|
|
49
50
|
};
|
|
50
51
|
this.draw = function (ev) {
|
|
52
|
+
if (_this.lf.graphModel.editConfigModel.isPinching) {
|
|
53
|
+
_this.lf.updateEditConfig({ stopMoveGraph: _this.originalStopMoveGraph });
|
|
54
|
+
_this.originStatusSaved = false;
|
|
55
|
+
_this.cleanupSelectionState();
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
51
58
|
var _a = _this.lf.getPointByClient(ev.clientX, ev.clientY).domOverlayPosition, x1 = _a.x, y1 = _a.y;
|
|
52
59
|
_this.endPoint = {
|
|
53
60
|
x: x1,
|
|
@@ -76,6 +83,11 @@ var SelectionSelect = /** @class */ (function () {
|
|
|
76
83
|
}
|
|
77
84
|
};
|
|
78
85
|
this.drawOff = function (e) {
|
|
86
|
+
// 恢复原始的 stopMoveGraph 设置
|
|
87
|
+
_this.lf.updateEditConfig({
|
|
88
|
+
stopMoveGraph: _this.originalStopMoveGraph,
|
|
89
|
+
});
|
|
90
|
+
_this.originStatusSaved = false;
|
|
79
91
|
// 处理鼠标抬起事件
|
|
80
92
|
// 首先判断是否是点击,如果是,则清空框选
|
|
81
93
|
if (_this.mouseDownInfo) {
|
|
@@ -91,14 +103,10 @@ var SelectionSelect = /** @class */ (function () {
|
|
|
91
103
|
}
|
|
92
104
|
var curStartPoint = (0, lodash_es_1.cloneDeep)(_this.startPoint);
|
|
93
105
|
var curEndPoint = (0, lodash_es_1.cloneDeep)(_this.endPoint);
|
|
94
|
-
document.removeEventListener('
|
|
106
|
+
document.removeEventListener('pointermove', _this.draw);
|
|
95
107
|
if (!_this.exclusiveMode) {
|
|
96
|
-
document.removeEventListener('
|
|
108
|
+
document.removeEventListener('pointerup', _this.drawOff);
|
|
97
109
|
}
|
|
98
|
-
// 恢复原始的 stopMoveGraph 设置
|
|
99
|
-
_this.lf.updateEditConfig({
|
|
100
|
-
stopMoveGraph: _this.originalStopMoveGraph,
|
|
101
|
-
});
|
|
102
110
|
if (curStartPoint && curEndPoint) {
|
|
103
111
|
var x = curStartPoint.x, y = curStartPoint.y;
|
|
104
112
|
var x1 = curEndPoint.x, y1 = curEndPoint.y;
|
|
@@ -211,8 +219,8 @@ var SelectionSelect = /** @class */ (function () {
|
|
|
211
219
|
this.endPoint = undefined;
|
|
212
220
|
this.mouseDownInfo = null;
|
|
213
221
|
// 移除事件监听
|
|
214
|
-
document.removeEventListener('
|
|
215
|
-
document.removeEventListener('
|
|
222
|
+
document.removeEventListener('pointermove', this.draw);
|
|
223
|
+
document.removeEventListener('pointerup', this.drawOff);
|
|
216
224
|
};
|
|
217
225
|
/**
|
|
218
226
|
* 切换框选模式
|
|
@@ -236,7 +244,8 @@ var SelectionSelect = /** @class */ (function () {
|
|
|
236
244
|
if (this.exclusiveMode) {
|
|
237
245
|
// 独占模式:监听 container 的 mousedown 事件
|
|
238
246
|
this.container.style.pointerEvents = 'auto';
|
|
239
|
-
this.container.
|
|
247
|
+
this.container.style.touchAction = 'none';
|
|
248
|
+
this.container.addEventListener('pointerdown', this.handleMouseDown);
|
|
240
249
|
}
|
|
241
250
|
else {
|
|
242
251
|
// 非独占模式:监听画布的 blank:mousedown 事件
|
|
@@ -248,7 +257,7 @@ var SelectionSelect = /** @class */ (function () {
|
|
|
248
257
|
SelectionSelect.prototype.removeEventListeners = function () {
|
|
249
258
|
if (this.container) {
|
|
250
259
|
this.container.style.pointerEvents = 'none';
|
|
251
|
-
this.container.removeEventListener('
|
|
260
|
+
this.container.removeEventListener('pointerdown', this.handleMouseDown);
|
|
252
261
|
}
|
|
253
262
|
// 移除 blank:mousedown 事件监听
|
|
254
263
|
this.lf.off('blank:mousedown', this.handleBlankMouseDown);
|
|
@@ -260,6 +269,8 @@ var SelectionSelect = /** @class */ (function () {
|
|
|
260
269
|
var _a;
|
|
261
270
|
if (!this.container || this.disabled)
|
|
262
271
|
return;
|
|
272
|
+
if (this.lf.graphModel.editConfigModel.isPinching)
|
|
273
|
+
return;
|
|
263
274
|
// 禁用右键框选
|
|
264
275
|
var isRightClick = e.button === 2;
|
|
265
276
|
if (isRightClick)
|
|
@@ -273,7 +284,11 @@ var SelectionSelect = /** @class */ (function () {
|
|
|
273
284
|
time: Date.now(),
|
|
274
285
|
};
|
|
275
286
|
// 记录原始设置并临时禁止画布移动
|
|
276
|
-
|
|
287
|
+
if (!this.originStatusSaved) {
|
|
288
|
+
// 为了防止在开启框选时用户多次点击画布导致缓存的stopMoveGraph变化,所以只在第一次点击时记录原始的stopMoveGraph issue #2263
|
|
289
|
+
this.originalStopMoveGraph = this.lf.getEditConfig().stopMoveGraph;
|
|
290
|
+
this.originStatusSaved = true;
|
|
291
|
+
}
|
|
277
292
|
this.lf.updateEditConfig({
|
|
278
293
|
stopMoveGraph: true,
|
|
279
294
|
});
|
|
@@ -289,8 +304,8 @@ var SelectionSelect = /** @class */ (function () {
|
|
|
289
304
|
wrapper.style.left = "".concat(this.startPoint.x, "px");
|
|
290
305
|
(_a = this.container) === null || _a === void 0 ? void 0 : _a.appendChild(wrapper);
|
|
291
306
|
this.wrapper = wrapper;
|
|
292
|
-
document.addEventListener('
|
|
293
|
-
document.addEventListener('
|
|
307
|
+
document.addEventListener('pointermove', this.draw);
|
|
308
|
+
document.addEventListener('pointerup', this.drawOff);
|
|
294
309
|
};
|
|
295
310
|
/**
|
|
296
311
|
* 设置选中的灵敏度
|
|
@@ -328,7 +343,7 @@ var SelectionSelect = /** @class */ (function () {
|
|
|
328
343
|
if (this.wrapper && this.startPoint && this.endPoint) {
|
|
329
344
|
// 记录上一次的结束点,用于触发 mouseup 事件
|
|
330
345
|
var lastEndPoint = (0, lodash_es_1.cloneDeep)(this.endPoint);
|
|
331
|
-
var lastEvent = new
|
|
346
|
+
var lastEvent = new PointerEvent('pointerup', {
|
|
332
347
|
clientX: lastEndPoint.x,
|
|
333
348
|
clientY: lastEndPoint.y,
|
|
334
349
|
});
|
|
@@ -17,8 +17,8 @@ export declare class Label extends Component<ILabelProps, ILabelState> {
|
|
|
17
17
|
constructor(props: ILabelProps);
|
|
18
18
|
setHoverOn: () => void;
|
|
19
19
|
setHoverOff: () => void;
|
|
20
|
-
handleMouseDown: (e:
|
|
21
|
-
handleMouseUp: (e:
|
|
20
|
+
handleMouseDown: (e: PointerEvent) => void;
|
|
21
|
+
handleMouseUp: (e: PointerEvent) => void;
|
|
22
22
|
handleDragging: ({ deltaX, deltaY }: IDragParams) => void;
|
|
23
23
|
handleDragEnd: () => void;
|
|
24
24
|
handleClick: (e: MouseEvent) => void;
|
package/lib/tools/label/Label.js
CHANGED
|
@@ -280,7 +280,7 @@ var Label = /** @class */ (function (_super) {
|
|
|
280
280
|
? "".concat(transform, " rotate(").concat(rotate, "deg)")
|
|
281
281
|
: "".concat(transform, " rotate(").concat(vertical ? -0.25 : 0, "turn)"),
|
|
282
282
|
};
|
|
283
|
-
return ((0, jsx_runtime_1.jsx)("div", { id: "element-container-".concat(id), className: (0, classnames_1.default)('lf-label-editor-container'), style: containerStyle,
|
|
283
|
+
return ((0, jsx_runtime_1.jsx)("div", { id: "element-container-".concat(id), className: (0, classnames_1.default)('lf-label-editor-container'), style: containerStyle, onPointerDown: this.handleMouseDown, onPointerUp: this.handleMouseUp, onClick: this.handleClick, onDblClick: this.handleDbClick, onBlur: this.handleBlur, onMouseEnter: this.setHoverOn, onMouseOver: this.setHoverOn, onMouseLeave: this.setHoverOff, children: (0, jsx_runtime_1.jsx)("div", { ref: this.textRef, id: "editor-container-".concat(id), className: (0, classnames_1.default)('lf-label-editor', (_a = {
|
|
284
284
|
'lf-label-editor-dragging': isDragging,
|
|
285
285
|
'lf-label-editor-editing': isEditing,
|
|
286
286
|
'lf-label-editor-hover': !isEditing && (isHovered || isSelected)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@logicflow/extension",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.2.0-alpha.0",
|
|
4
4
|
"description": "LogicFlow Extensions",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "es/index.js",
|
|
@@ -20,8 +20,8 @@
|
|
|
20
20
|
"author": "Logicflow-Team",
|
|
21
21
|
"license": "Apache-2.0",
|
|
22
22
|
"peerDependencies": {
|
|
23
|
-
"@logicflow/
|
|
24
|
-
"@logicflow/
|
|
23
|
+
"@logicflow/core": "2.2.0-alpha.0",
|
|
24
|
+
"@logicflow/vue-node-registry": "1.2.0-alpha.0"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"@antv/hierarchy": "^0.6.11",
|
|
@@ -32,8 +32,8 @@
|
|
|
32
32
|
"preact": "^10.17.1",
|
|
33
33
|
"rangy": "^1.3.1",
|
|
34
34
|
"vanilla-picker": "^2.12.3",
|
|
35
|
-
"@logicflow/core": "2.
|
|
36
|
-
"@logicflow/vue-node-registry": "1.
|
|
35
|
+
"@logicflow/core": "2.2.0-alpha.0",
|
|
36
|
+
"@logicflow/vue-node-registry": "1.2.0-alpha.0"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
39
|
"less": "^4.1.1",
|
|
@@ -36,6 +36,13 @@ export class DndPanel {
|
|
|
36
36
|
}
|
|
37
37
|
this.panelEl = document.createElement('div')
|
|
38
38
|
this.panelEl.className = 'lf-dndpanel'
|
|
39
|
+
this.panelEl.addEventListener(
|
|
40
|
+
'touchmove',
|
|
41
|
+
(e) => {
|
|
42
|
+
e.preventDefault()
|
|
43
|
+
},
|
|
44
|
+
{ passive: false },
|
|
45
|
+
)
|
|
39
46
|
this.shapeList.forEach((shapeItem) => {
|
|
40
47
|
this.panelEl?.appendChild(this.createDndItem(shapeItem))
|
|
41
48
|
})
|
|
@@ -85,14 +92,14 @@ export class DndPanel {
|
|
|
85
92
|
if (shapeItem.disabled) {
|
|
86
93
|
el.classList.add('disabled')
|
|
87
94
|
// 保留callback的执行,可用于界面提示当前shapeItem的禁用状态
|
|
88
|
-
el.
|
|
95
|
+
el.onpointerdown = () => {
|
|
89
96
|
if (shapeItem.callback) {
|
|
90
97
|
shapeItem.callback(this.lf, this.domContainer)
|
|
91
98
|
}
|
|
92
99
|
}
|
|
93
100
|
return el
|
|
94
101
|
}
|
|
95
|
-
el.
|
|
102
|
+
el.onpointerdown = (e: PointerEvent) => {
|
|
96
103
|
if (shapeItem.type) {
|
|
97
104
|
this.lf.dnd.startDrag({
|
|
98
105
|
type: shapeItem.type,
|
|
@@ -103,6 +110,7 @@ export class DndPanel {
|
|
|
103
110
|
if (shapeItem.callback) {
|
|
104
111
|
shapeItem.callback(this.lf, this.domContainer)
|
|
105
112
|
}
|
|
113
|
+
e.preventDefault()
|
|
106
114
|
}
|
|
107
115
|
el.ondblclick = (e) => {
|
|
108
116
|
this.lf.graphModel.eventCenter.emit('dnd:panel-dbclick', {
|