@tmagic/stage 1.3.0-beta.0 → 1.3.0-beta.2
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/tmagic-stage.js +29 -1
- package/dist/tmagic-stage.js.map +1 -1
- package/dist/tmagic-stage.umd.cjs +29 -1
- package/dist/tmagic-stage.umd.cjs.map +1 -1
- package/package.json +4 -4
- package/src/ActionManager.ts +15 -2
- package/src/StageCore.ts +22 -1
- package/src/StageDragResize.ts +5 -0
- package/src/index.ts +1 -1
- package/types/ActionManager.d.ts +2 -1
- package/types/StageCore.d.ts +5 -0
- package/types/StageDragResize.d.ts +2 -0
- package/types/index.d.ts +1 -1
|
@@ -929,6 +929,9 @@
|
|
|
929
929
|
this.moveable.target = null;
|
|
930
930
|
this.moveable.updateRect();
|
|
931
931
|
}
|
|
932
|
+
getDragStatus() {
|
|
933
|
+
return this.dragStatus;
|
|
934
|
+
}
|
|
932
935
|
/**
|
|
933
936
|
* 销毁实例
|
|
934
937
|
*/
|
|
@@ -991,6 +994,7 @@
|
|
|
991
994
|
throw new Error("未选中组件");
|
|
992
995
|
this.dragStatus = StageDragStatus.START;
|
|
993
996
|
this.dragResizeHelper.onDragStart(e);
|
|
997
|
+
this.emit("drag-start", e);
|
|
994
998
|
}).on("drag", (e) => {
|
|
995
999
|
if (!this.target || !this.dragResizeHelper.getShadowEl())
|
|
996
1000
|
return;
|
|
@@ -1360,6 +1364,7 @@
|
|
|
1360
1364
|
this.clearHighlight();
|
|
1361
1365
|
return;
|
|
1362
1366
|
}
|
|
1367
|
+
this.emit("mousemove", event);
|
|
1363
1368
|
this.highlight(el);
|
|
1364
1369
|
}, throttleTime);
|
|
1365
1370
|
constructor(config) {
|
|
@@ -1459,6 +1464,7 @@
|
|
|
1459
1464
|
*/
|
|
1460
1465
|
async getElementFromPoint(event) {
|
|
1461
1466
|
const els = this.getElementsFromPoint(event);
|
|
1467
|
+
this.emit("get-elements-from-point", els);
|
|
1462
1468
|
let stopped = false;
|
|
1463
1469
|
const stop = () => stopped = true;
|
|
1464
1470
|
for (const el of els) {
|
|
@@ -1581,6 +1587,9 @@
|
|
|
1581
1587
|
}
|
|
1582
1588
|
return void 0;
|
|
1583
1589
|
}
|
|
1590
|
+
getDragStatus() {
|
|
1591
|
+
return this.dr.getDragStatus();
|
|
1592
|
+
}
|
|
1584
1593
|
destroy() {
|
|
1585
1594
|
this.container.removeEventListener("mousedown", this.mouseDownHandler);
|
|
1586
1595
|
this.container.removeEventListener("mousemove", this.mouseMoveHandler);
|
|
@@ -1696,6 +1705,8 @@
|
|
|
1696
1705
|
data: [{ el: drTarget }]
|
|
1697
1706
|
};
|
|
1698
1707
|
this.emit("remove", data);
|
|
1708
|
+
}).on("drag-start", (e) => {
|
|
1709
|
+
this.emit("drag-start", e);
|
|
1699
1710
|
});
|
|
1700
1711
|
this.multiDr.on("update", (data) => {
|
|
1701
1712
|
this.emit("multi-update", data);
|
|
@@ -1755,8 +1766,9 @@
|
|
|
1755
1766
|
this.emit("select", this.selectedEl);
|
|
1756
1767
|
}
|
|
1757
1768
|
};
|
|
1758
|
-
mouseLeaveHandler = () => {
|
|
1769
|
+
mouseLeaveHandler = (event) => {
|
|
1759
1770
|
setTimeout(() => this.clearHighlight(), throttleTime);
|
|
1771
|
+
this.emit("mouseleave", event);
|
|
1760
1772
|
};
|
|
1761
1773
|
mouseWheelHandler = () => {
|
|
1762
1774
|
this.clearHighlight();
|
|
@@ -2448,6 +2460,9 @@
|
|
|
2448
2460
|
getMoveableOption(key) {
|
|
2449
2461
|
return this.actionManager.getMoveableOption(key);
|
|
2450
2462
|
}
|
|
2463
|
+
getDragStatus() {
|
|
2464
|
+
return this.actionManager.getDragStatus();
|
|
2465
|
+
}
|
|
2451
2466
|
/**
|
|
2452
2467
|
* 销毁实例
|
|
2453
2468
|
*/
|
|
@@ -2513,6 +2528,7 @@
|
|
|
2513
2528
|
this.initDrEvent();
|
|
2514
2529
|
this.initMulDrEvent();
|
|
2515
2530
|
this.initHighlightEvent();
|
|
2531
|
+
this.initMouseEvent();
|
|
2516
2532
|
}
|
|
2517
2533
|
/**
|
|
2518
2534
|
* 初始化ActionManager类本身抛出来的事件监听
|
|
@@ -2561,6 +2577,18 @@
|
|
|
2561
2577
|
this.emit("highlight", highlightEl);
|
|
2562
2578
|
});
|
|
2563
2579
|
}
|
|
2580
|
+
/**
|
|
2581
|
+
* 初始化Highlight类通过ActionManager抛出来的事件监听
|
|
2582
|
+
*/
|
|
2583
|
+
initMouseEvent() {
|
|
2584
|
+
this.actionManager.on("mousemove", (event) => {
|
|
2585
|
+
this.emit("mousemove", event);
|
|
2586
|
+
}).on("mouseleave", (event) => {
|
|
2587
|
+
this.emit("mouseleave", event);
|
|
2588
|
+
}).on("drag-start", (e) => {
|
|
2589
|
+
this.emit("drag-start", e);
|
|
2590
|
+
});
|
|
2591
|
+
}
|
|
2564
2592
|
}
|
|
2565
2593
|
|
|
2566
2594
|
exports.AbleActionEventType = AbleActionEventType;
|