@tmagic/stage 1.3.0-alpha.19 → 1.3.0-alpha.20

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.3.0-alpha.19",
2
+ "version": "1.3.0-alpha.20",
3
3
  "name": "@tmagic/stage",
4
4
  "type": "module",
5
5
  "sideEffects": [
@@ -30,9 +30,9 @@
30
30
  },
31
31
  "dependencies": {
32
32
  "@scena/guides": "^0.29.2",
33
- "@tmagic/core": "1.3.0-alpha.19",
34
- "@tmagic/schema": "1.3.0-alpha.19",
35
- "@tmagic/utils": "1.3.0-alpha.19",
33
+ "@tmagic/core": "1.3.0-alpha.20",
34
+ "@tmagic/schema": "1.3.0-alpha.20",
35
+ "@tmagic/utils": "1.3.0-alpha.20",
36
36
  "events": "^3.3.0",
37
37
  "keycon": "^1.4.0",
38
38
  "lodash-es": "^4.17.21",
@@ -95,14 +95,14 @@ export default class StageDragResize extends MoveableOptionsManager {
95
95
  Object.entries(options).forEach(([key, value]) => {
96
96
  (this.moveable as any)[key] = value;
97
97
  });
98
- this.moveable.updateTarget();
98
+ this.moveable.updateRect();
99
99
  }
100
100
 
101
101
  public clearSelectStatus(): void {
102
102
  if (!this.moveable) return;
103
103
  this.dragResizeHelper.destroyShadowEl();
104
104
  this.moveable.target = null;
105
- this.moveable.updateTarget();
105
+ this.moveable.updateRect();
106
106
  }
107
107
 
108
108
  /**
@@ -28,7 +28,7 @@ export default class StageHighlight extends EventEmitter {
28
28
  public container: HTMLElement;
29
29
  public target?: HTMLElement;
30
30
  public moveable?: Moveable;
31
- public targetShadow: TargetShadow;
31
+ public targetShadow?: TargetShadow;
32
32
  private getRootContainer: GetRootContainer;
33
33
 
34
34
  constructor(config: StageHighlightConfig) {
@@ -52,14 +52,19 @@ export default class StageHighlight extends EventEmitter {
52
52
  public highlight(el: HTMLElement): void {
53
53
  if (!el || el === this.target) return;
54
54
  this.target = el;
55
- this.moveable?.destroy();
56
55
 
57
- this.moveable = new Moveable(this.container, {
58
- target: this.targetShadow.update(el),
59
- origin: false,
60
- rootContainer: this.getRootContainer(),
61
- zoom: 2,
62
- });
56
+ this.targetShadow?.update(el);
57
+ if (this.moveable) {
58
+ this.moveable.zoom = 2;
59
+ this.moveable.updateRect();
60
+ } else {
61
+ this.moveable = new Moveable(this.container, {
62
+ target: this.targetShadow?.el,
63
+ origin: false,
64
+ rootContainer: this.getRootContainer(),
65
+ zoom: 2,
66
+ });
67
+ }
63
68
  }
64
69
 
65
70
  /**
@@ -67,9 +72,9 @@ export default class StageHighlight extends EventEmitter {
67
72
  */
68
73
  public clearHighlight(): void {
69
74
  if (!this.moveable || !this.target) return;
75
+ this.moveable.zoom = 0;
76
+ this.moveable.updateRect();
70
77
  this.target = undefined;
71
- this.moveable.target = null;
72
- this.moveable.updateTarget();
73
78
  }
74
79
 
75
80
  /**
@@ -77,6 +82,8 @@ export default class StageHighlight extends EventEmitter {
77
82
  */
78
83
  public destroy(): void {
79
84
  this.moveable?.destroy();
80
- this.targetShadow.destroy();
85
+ this.targetShadow?.destroy();
86
+ this.moveable = undefined;
87
+ this.targetShadow = undefined;
81
88
  }
82
89
  }
@@ -170,8 +170,6 @@ export default class StageMultiDragResize extends MoveableOptionsManager {
170
170
  target: this.dragResizeHelper.getShadowEls(),
171
171
  });
172
172
 
173
- console.log(options);
174
-
175
173
  Object.entries(options).forEach(([key, value]) => {
176
174
  (this.moveableForMulti as any)[key] = value;
177
175
  });
@@ -7,7 +7,7 @@ export default class StageHighlight extends EventEmitter {
7
7
  container: HTMLElement;
8
8
  target?: HTMLElement;
9
9
  moveable?: Moveable;
10
- targetShadow: TargetShadow;
10
+ targetShadow?: TargetShadow;
11
11
  private getRootContainer;
12
12
  constructor(config: StageHighlightConfig);
13
13
  /**