@tmagic/stage 1.3.0-beta.0 → 1.3.0-beta.1
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 +27 -0
- package/dist/tmagic-stage.js.map +1 -1
- package/dist/tmagic-stage.umd.cjs +27 -0
- package/dist/tmagic-stage.umd.cjs.map +1 -1
- package/package.json +4 -4
- package/src/ActionManager.ts +13 -1
- 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);
|
|
@@ -2448,6 +2459,9 @@
|
|
|
2448
2459
|
getMoveableOption(key) {
|
|
2449
2460
|
return this.actionManager.getMoveableOption(key);
|
|
2450
2461
|
}
|
|
2462
|
+
getDragStatus() {
|
|
2463
|
+
return this.actionManager.getDragStatus();
|
|
2464
|
+
}
|
|
2451
2465
|
/**
|
|
2452
2466
|
* 销毁实例
|
|
2453
2467
|
*/
|
|
@@ -2513,6 +2527,7 @@
|
|
|
2513
2527
|
this.initDrEvent();
|
|
2514
2528
|
this.initMulDrEvent();
|
|
2515
2529
|
this.initHighlightEvent();
|
|
2530
|
+
this.initMouseEvent();
|
|
2516
2531
|
}
|
|
2517
2532
|
/**
|
|
2518
2533
|
* 初始化ActionManager类本身抛出来的事件监听
|
|
@@ -2561,6 +2576,18 @@
|
|
|
2561
2576
|
this.emit("highlight", highlightEl);
|
|
2562
2577
|
});
|
|
2563
2578
|
}
|
|
2579
|
+
/**
|
|
2580
|
+
* 初始化Highlight类通过ActionManager抛出来的事件监听
|
|
2581
|
+
*/
|
|
2582
|
+
initMouseEvent() {
|
|
2583
|
+
this.actionManager.on("mousemove", async (event) => {
|
|
2584
|
+
this.emit("mousemove", event);
|
|
2585
|
+
}).on("mouseleave", async (event) => {
|
|
2586
|
+
this.emit("mouseleave", event);
|
|
2587
|
+
}).on("drag-start", (e) => {
|
|
2588
|
+
this.emit("drag-start", e);
|
|
2589
|
+
});
|
|
2590
|
+
}
|
|
2564
2591
|
}
|
|
2565
2592
|
|
|
2566
2593
|
exports.AbleActionEventType = AbleActionEventType;
|