@tmagic/stage 1.1.3 → 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.
@@ -22,6 +22,7 @@ var ZIndex = /* @__PURE__ */ ((ZIndex2) => {
22
22
  ZIndex2["SELECTED_EL"] = "666";
23
23
  ZIndex2["GHOST_EL"] = "700";
24
24
  ZIndex2["DRAG_EL"] = "9";
25
+ ZIndex2["HIGHLIGHT_EL"] = "8";
25
26
  return ZIndex2;
26
27
  })(ZIndex || {});
27
28
  var MouseButton = /* @__PURE__ */ ((MouseButton2) => {
@@ -252,6 +253,10 @@ class StageDragResize extends EventEmitter {
252
253
  select(el, event) {
253
254
  const oldTarget = this.target;
254
255
  this.target = el;
256
+ if (!this.dragEl) {
257
+ this.dragEl = globalThis.document.createElement("div");
258
+ this.container.append(this.dragEl);
259
+ }
255
260
  if (!this.moveable || this.target !== oldTarget) {
256
261
  this.init(el);
257
262
  this.moveableHelper = MoveableHelper.create({
@@ -302,6 +307,7 @@ class StageDragResize extends EventEmitter {
302
307
  if (!this.moveable)
303
308
  return;
304
309
  this.destroyDragEl();
310
+ this.dragEl = void 0;
305
311
  this.moveable.target = null;
306
312
  this.moveable.updateTarget();
307
313
  }
@@ -321,9 +327,9 @@ class StageDragResize extends EventEmitter {
321
327
  }
322
328
  this.mode = getMode(el);
323
329
  this.destroyGhostEl();
324
- this.destroyDragEl();
325
- this.dragEl = globalThis.document.createElement("div");
326
- this.container.append(this.dragEl);
330
+ if (!this.dragEl) {
331
+ return;
332
+ }
327
333
  this.dragEl.style.cssText = getTargetElStyle(el);
328
334
  this.dragEl.id = `${DRAG_EL_ID_PREFIX}${el.id}`;
329
335
  if (typeof this.core.config.updateDragEl === "function") {
@@ -680,7 +686,7 @@ class TargetCalibrate extends EventEmitter {
680
686
  top: ${top}px;
681
687
  width: ${el.clientWidth}px;
682
688
  height: ${el.clientHeight}px;
683
- z-index: ${ZIndex.DRAG_EL};
689
+ z-index: ${ZIndex.HIGHLIGHT_EL};
684
690
  `;
685
691
  this.operationEl.id = `${prefix}${el.id}`;
686
692
  if (typeof this.core.config.updateDragEl === "function") {