@tmagic/stage 1.0.0-rc.7 → 1.0.0-rc.8
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.es.js +10 -2
- package/dist/tmagic-stage.es.js.map +1 -1
- package/dist/tmagic-stage.umd.js +10 -2
- package/dist/tmagic-stage.umd.js.map +1 -1
- package/dist/types/src/StageDragResize.d.ts +1 -1
- package/dist/types/src/TargetCalibrate.d.ts +3 -1
- package/dist/types/src/types.d.ts +2 -0
- package/package.json +4 -4
- package/src/StageDragResize.ts +6 -3
- package/src/StageHighlight.ts +1 -0
- package/src/TargetCalibrate.ts +9 -1
- package/src/types.ts +2 -0
package/src/StageDragResize.ts
CHANGED
|
@@ -48,7 +48,7 @@ export default class StageDragResize extends EventEmitter {
|
|
|
48
48
|
/** 目标节点 */
|
|
49
49
|
public target?: HTMLElement;
|
|
50
50
|
/** 目标节点在蒙层中的占位节点 */
|
|
51
|
-
public dragEl:
|
|
51
|
+
public dragEl: HTMLDivElement;
|
|
52
52
|
/** Moveable拖拽类实例 */
|
|
53
53
|
public moveable?: Moveable;
|
|
54
54
|
/** 水平参考线 */
|
|
@@ -87,10 +87,9 @@ export default class StageDragResize extends EventEmitter {
|
|
|
87
87
|
const oldTarget = this.target;
|
|
88
88
|
this.target = el;
|
|
89
89
|
|
|
90
|
-
this.init(el);
|
|
91
|
-
|
|
92
90
|
// 从不能拖动到能拖动的节点之间切换,要重新创建moveable,不然dragStart不生效
|
|
93
91
|
if (!this.moveable || this.target !== oldTarget) {
|
|
92
|
+
this.init(el);
|
|
94
93
|
this.moveableHelper = MoveableHelper.create({
|
|
95
94
|
useBeforeRender: true,
|
|
96
95
|
useRender: false,
|
|
@@ -430,6 +429,10 @@ export default class StageDragResize extends EventEmitter {
|
|
|
430
429
|
`;
|
|
431
430
|
|
|
432
431
|
this.dragEl.id = `${DRAG_EL_ID_PREFIX}${el.id}`;
|
|
432
|
+
|
|
433
|
+
if (typeof this.core.config.updateDragEl === 'function') {
|
|
434
|
+
this.core.config.updateDragEl(this.dragEl, el);
|
|
435
|
+
}
|
|
433
436
|
}
|
|
434
437
|
|
|
435
438
|
private destroyDragEl(): void {
|
package/src/StageHighlight.ts
CHANGED
package/src/TargetCalibrate.ts
CHANGED
|
@@ -20,6 +20,7 @@
|
|
|
20
20
|
import { EventEmitter } from 'events';
|
|
21
21
|
|
|
22
22
|
import { Mode } from './const';
|
|
23
|
+
import StageCore from './StageCore';
|
|
23
24
|
import StageDragResize from './StageDragResize';
|
|
24
25
|
import StageMask from './StageMask';
|
|
25
26
|
import type { Offset, TargetCalibrateConfig } from './types';
|
|
@@ -32,7 +33,8 @@ export default class TargetCalibrate extends EventEmitter {
|
|
|
32
33
|
public parent: HTMLElement;
|
|
33
34
|
public mask: StageMask;
|
|
34
35
|
public dr: StageDragResize;
|
|
35
|
-
public
|
|
36
|
+
public core: StageCore;
|
|
37
|
+
public operationEl: HTMLDivElement;
|
|
36
38
|
|
|
37
39
|
constructor(config: TargetCalibrateConfig) {
|
|
38
40
|
super();
|
|
@@ -40,6 +42,7 @@ export default class TargetCalibrate extends EventEmitter {
|
|
|
40
42
|
this.parent = config.parent;
|
|
41
43
|
this.mask = config.mask;
|
|
42
44
|
this.dr = config.dr;
|
|
45
|
+
this.core = config.core;
|
|
43
46
|
|
|
44
47
|
this.operationEl = globalThis.document.createElement('div');
|
|
45
48
|
this.parent.append(this.operationEl);
|
|
@@ -58,6 +61,11 @@ export default class TargetCalibrate extends EventEmitter {
|
|
|
58
61
|
`;
|
|
59
62
|
|
|
60
63
|
this.operationEl.id = `${prefix}${el.id}`;
|
|
64
|
+
|
|
65
|
+
if (typeof this.core.config.updateDragEl === 'function') {
|
|
66
|
+
this.core.config.updateDragEl(this.operationEl, el);
|
|
67
|
+
}
|
|
68
|
+
|
|
61
69
|
return this.operationEl;
|
|
62
70
|
}
|
|
63
71
|
|
package/src/types.ts
CHANGED
|
@@ -39,6 +39,7 @@ export type StageCoreConfig = {
|
|
|
39
39
|
runtimeUrl?: string;
|
|
40
40
|
render?: (renderer: StageCore) => Promise<HTMLElement> | HTMLElement;
|
|
41
41
|
autoScrollIntoView?: boolean;
|
|
42
|
+
updateDragEl?: (el: HTMLDivElement, target: HTMLElement) => void;
|
|
42
43
|
};
|
|
43
44
|
|
|
44
45
|
export interface StageRenderConfig {
|
|
@@ -133,4 +134,5 @@ export interface TargetCalibrateConfig {
|
|
|
133
134
|
parent: HTMLElement;
|
|
134
135
|
mask: StageMask;
|
|
135
136
|
dr: StageDragResize;
|
|
137
|
+
core: StageCore;
|
|
136
138
|
}
|