@tmagic/stage 1.0.0-rc.11 → 1.0.0-rc.12
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 +13 -15
- package/dist/tmagic-stage.es.js.map +1 -1
- package/dist/tmagic-stage.umd.js +13 -15
- package/dist/tmagic-stage.umd.js.map +1 -1
- package/dist/types/src/StageCore.d.ts +1 -1
- package/dist/types/src/const.d.ts +1 -1
- package/package.json +4 -4
- package/src/StageCore.ts +2 -2
- package/src/StageDragResize.ts +5 -5
- package/src/StageRender.ts +7 -0
- package/src/const.ts +1 -1
- package/src/util.ts +6 -4
package/dist/tmagic-stage.umd.js
CHANGED
|
@@ -86,11 +86,6 @@
|
|
|
86
86
|
return true;
|
|
87
87
|
return getHost(targetUrl) === source;
|
|
88
88
|
};
|
|
89
|
-
const isAbsolute = (el) => {
|
|
90
|
-
if (!el)
|
|
91
|
-
return false;
|
|
92
|
-
return getComputedStyle(el).position === "absolute";
|
|
93
|
-
};
|
|
94
89
|
const isRelative = (el) => {
|
|
95
90
|
if (!el)
|
|
96
91
|
return false;
|
|
@@ -131,15 +126,15 @@
|
|
|
131
126
|
};
|
|
132
127
|
const getScrollParent = (element, includeHidden = false) => {
|
|
133
128
|
let style = getComputedStyle(element);
|
|
129
|
+
const excludeStaticParent = style.position === "absolute";
|
|
134
130
|
const overflowRegex = includeHidden ? /(auto|scroll|hidden)/ : /(auto|scroll)/;
|
|
135
|
-
if (
|
|
131
|
+
if (style.position === "fixed")
|
|
136
132
|
return null;
|
|
137
133
|
for (let parent = element; parent.parentElement; ) {
|
|
138
134
|
parent = parent.parentElement;
|
|
139
135
|
style = getComputedStyle(parent);
|
|
140
|
-
if (
|
|
136
|
+
if (excludeStaticParent && style.position === "static")
|
|
141
137
|
continue;
|
|
142
|
-
}
|
|
143
138
|
if (overflowRegex.test(style.overflow + style.overflowY + style.overflowX))
|
|
144
139
|
return parent;
|
|
145
140
|
}
|
|
@@ -222,7 +217,7 @@
|
|
|
222
217
|
if (!this.moveable)
|
|
223
218
|
throw new Error("\u672A\u521D\u59CB\u5316moveable");
|
|
224
219
|
if (!el)
|
|
225
|
-
throw new Error("\
|
|
220
|
+
throw new Error("\u672A\u9009\u4E2D\u4EFB\u4F55\u8282\u70B9");
|
|
226
221
|
this.target = el;
|
|
227
222
|
this.init(el);
|
|
228
223
|
Object.entries(this.moveableOptions).forEach(([key, value]) => {
|
|
@@ -297,7 +292,7 @@
|
|
|
297
292
|
}
|
|
298
293
|
bindResizeEvent() {
|
|
299
294
|
if (!this.moveable)
|
|
300
|
-
throw new Error("moveable \
|
|
295
|
+
throw new Error("moveable \u672A\u521D\u59CB\u5316");
|
|
301
296
|
const frame = {
|
|
302
297
|
left: 0,
|
|
303
298
|
top: 0
|
|
@@ -331,7 +326,7 @@
|
|
|
331
326
|
}
|
|
332
327
|
bindDragEvent() {
|
|
333
328
|
if (!this.moveable)
|
|
334
|
-
throw new Error("moveable \
|
|
329
|
+
throw new Error("moveable \u672A\u521D\u59CB\u5316");
|
|
335
330
|
const frame = {
|
|
336
331
|
left: 0,
|
|
337
332
|
top: 0
|
|
@@ -373,7 +368,7 @@
|
|
|
373
368
|
}
|
|
374
369
|
bindRotateEvent() {
|
|
375
370
|
if (!this.moveable)
|
|
376
|
-
throw new Error("moveable \
|
|
371
|
+
throw new Error("moveable \u672A\u521D\u59CB\u5316");
|
|
377
372
|
this.moveable.on("rotateStart", (e) => {
|
|
378
373
|
this.dragStatus = "start" /* START */;
|
|
379
374
|
this.moveableHelper?.onRotateStart(e);
|
|
@@ -397,7 +392,7 @@
|
|
|
397
392
|
}
|
|
398
393
|
bindScaleEvent() {
|
|
399
394
|
if (!this.moveable)
|
|
400
|
-
throw new Error("moveable \
|
|
395
|
+
throw new Error("moveable \u672A\u521D\u59CB\u5316");
|
|
401
396
|
this.moveable.on("scaleStart", (e) => {
|
|
402
397
|
this.dragStatus = "start" /* START */;
|
|
403
398
|
this.moveableHelper?.onScaleStart(e);
|
|
@@ -1084,6 +1079,9 @@
|
|
|
1084
1079
|
}
|
|
1085
1080
|
}
|
|
1086
1081
|
this.emit("onload");
|
|
1082
|
+
this.contentWindow.postMessage({
|
|
1083
|
+
tmagicRuntimeReady: true
|
|
1084
|
+
}, "*");
|
|
1087
1085
|
};
|
|
1088
1086
|
this.core = core;
|
|
1089
1087
|
this.runtimeUrl = core.config.runtimeUrl || "";
|
|
@@ -1250,10 +1248,10 @@
|
|
|
1250
1248
|
setZoom(zoom = DEFAULT_ZOOM) {
|
|
1251
1249
|
this.zoom = zoom;
|
|
1252
1250
|
}
|
|
1253
|
-
mount(el) {
|
|
1251
|
+
async mount(el) {
|
|
1254
1252
|
this.container = el;
|
|
1255
1253
|
const { mask, renderer } = this;
|
|
1256
|
-
renderer.mount(el);
|
|
1254
|
+
await renderer.mount(el);
|
|
1257
1255
|
mask.mount(el);
|
|
1258
1256
|
this.emit("mounted");
|
|
1259
1257
|
}
|