@vnejs/plugins.canvas.image 0.1.1 → 0.1.2
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/modules/change.js +16 -4
- package/package.json +1 -1
package/modules/change.js
CHANGED
|
@@ -9,8 +9,20 @@ export class LayerImageChange extends Module {
|
|
|
9
9
|
this.on(this.EVENTS.LAYER_IMAGE.CHANGE, this.onImageChange);
|
|
10
10
|
};
|
|
11
11
|
|
|
12
|
-
onImageChange = async ({ id, name, layer, duration, args = {} } = {}) => {
|
|
13
|
-
if (!
|
|
12
|
+
onImageChange = async ({ id: argId, name, layer, duration, args = {} } = {}) => {
|
|
13
|
+
if (!name || !layer) return;
|
|
14
|
+
|
|
15
|
+
let id;
|
|
16
|
+
|
|
17
|
+
if (argId) {
|
|
18
|
+
id = argId;
|
|
19
|
+
} else {
|
|
20
|
+
const oldChilds = await this.emitOne(this.EVENTS.LAYER_IMAGE.STATE_GET, { layer });
|
|
21
|
+
|
|
22
|
+
if (oldChilds.length !== 1) return;
|
|
23
|
+
|
|
24
|
+
id = oldChilds[0].id;
|
|
25
|
+
}
|
|
14
26
|
|
|
15
27
|
const src = await this.emitOne(this.EVENTS.LAYER_IMAGE.SRC_GET, { name, layer, args });
|
|
16
28
|
|
|
@@ -18,14 +30,14 @@ export class LayerImageChange extends Module {
|
|
|
18
30
|
|
|
19
31
|
await this.emit(this.EVENTS.LAYER_IMAGE.STATE_UPDATE, { id, name, args });
|
|
20
32
|
|
|
21
|
-
if (!duration || this.shared.viewForceAnimationSources.length) return this.emitChildChange(layer, id, 0, changeArgs);
|
|
33
|
+
if (!duration || this.shared.viewForceAnimationSources.length) return this.emitChildChange(layer, id, 0, { ...changeArgs, transition: 0 });
|
|
22
34
|
|
|
23
35
|
const { resolve: skipResolve, promise: skipPromise } = getPromiseAndResolve();
|
|
24
36
|
|
|
25
37
|
return this.emit(this.EVENTS.INTERACT.PUSH_POP, {
|
|
26
38
|
key: `${this.name}_${layer}_${name}`,
|
|
27
39
|
skipHandler: () => this.emit(this.EVENTS.LAYER.FORCE_UPDATE, { layer }).then(skipResolve),
|
|
28
|
-
handler: () => Promise.race([this.emitChildChange(layer, id, Number(duration), changeArgs), skipPromise]),
|
|
40
|
+
handler: () => Promise.race([this.emitChildChange(layer, id, Number(duration), { ...changeArgs, transition: duration }), skipPromise]),
|
|
29
41
|
});
|
|
30
42
|
};
|
|
31
43
|
|