@tmagic/stage 1.1.2 → 1.1.4

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/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.1.2",
2
+ "version": "1.1.4",
3
3
  "name": "@tmagic/stage",
4
4
  "sideEffects": [
5
5
  "dist/*"
@@ -29,9 +29,9 @@
29
29
  },
30
30
  "dependencies": {
31
31
  "@scena/guides": "^0.17.0",
32
- "@tmagic/core": "1.1.2",
33
- "@tmagic/schema": "1.1.2",
34
- "@tmagic/utils": "1.1.2",
32
+ "@tmagic/core": "1.1.4",
33
+ "@tmagic/schema": "1.1.4",
34
+ "@tmagic/utils": "1.1.4",
35
35
  "events": "^3.3.0",
36
36
  "keycon": "^1.1.2",
37
37
  "lodash-es": "^4.17.21",
@@ -96,6 +96,11 @@ export default class StageDragResize extends EventEmitter {
96
96
  const oldTarget = this.target;
97
97
  this.target = el;
98
98
 
99
+ if (!this.dragEl) {
100
+ this.dragEl = globalThis.document.createElement('div');
101
+ this.container.append(this.dragEl);
102
+ }
103
+
99
104
  // 从不能拖动到能拖动的节点之间切换,要重新创建moveable,不然dragStart不生效
100
105
  if (!this.moveable || this.target !== oldTarget) {
101
106
  this.init(el);
@@ -157,6 +162,7 @@ export default class StageDragResize extends EventEmitter {
157
162
  public clearSelectStatus(): void {
158
163
  if (!this.moveable) return;
159
164
  this.destroyDragEl();
165
+ this.dragEl = undefined;
160
166
  this.moveable.target = null;
161
167
  this.moveable.updateTarget();
162
168
  }
@@ -184,9 +190,11 @@ export default class StageDragResize extends EventEmitter {
184
190
  this.mode = getMode(el);
185
191
 
186
192
  this.destroyGhostEl();
187
- this.destroyDragEl();
188
- this.dragEl = globalThis.document.createElement('div');
189
- this.container.append(this.dragEl);
193
+
194
+ if (!this.dragEl) {
195
+ return;
196
+ }
197
+
190
198
  this.dragEl.style.cssText = getTargetElStyle(el);
191
199
  this.dragEl.id = `${DRAG_EL_ID_PREFIX}${el.id}`;
192
200
 
@@ -57,7 +57,7 @@ export default class TargetCalibrate extends EventEmitter {
57
57
  top: ${top}px;
58
58
  width: ${el.clientWidth}px;
59
59
  height: ${el.clientHeight}px;
60
- z-index: ${ZIndex.DRAG_EL};
60
+ z-index: ${ZIndex.HIGHLIGHT_EL};
61
61
  `;
62
62
 
63
63
  this.operationEl.id = `${prefix}${el.id}`;
package/src/const.ts CHANGED
@@ -48,6 +48,7 @@ export enum ZIndex {
48
48
  SELECTED_EL = '666',
49
49
  GHOST_EL = '700',
50
50
  DRAG_EL = '9',
51
+ HIGHLIGHT_EL = '8',
51
52
  }
52
53
 
53
54
  /** 鼠标按键 */
package/types/const.d.ts CHANGED
@@ -22,7 +22,8 @@ export declare enum ZIndex {
22
22
  /** 选中的节点 */
23
23
  SELECTED_EL = "666",
24
24
  GHOST_EL = "700",
25
- DRAG_EL = "9"
25
+ DRAG_EL = "9",
26
+ HIGHLIGHT_EL = "8"
26
27
  }
27
28
  /** 鼠标按键 */
28
29
  export declare enum MouseButton {