@codingfactory/mediables-vue 2.4.0 → 2.4.1

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.
@@ -292,17 +292,17 @@ class ve extends B {
292
292
  */
293
293
  async loadTexture(e) {
294
294
  var l, c, u;
295
- if (this._mountPromise && await this._mountPromise, !((l = this.app) != null && l.renderer)) return;
295
+ if (this._mountPromise && await this._mountPromise, !((l = this.app) != null && l.renderer)) return !1;
296
296
  const t = window.PIXI, i = await this._loadImageElement(e);
297
- if (!i || !((c = this.app) != null && c.renderer)) return;
297
+ if (!i || !((c = this.app) != null && c.renderer)) return !1;
298
298
  const r = t.Texture.from(i);
299
299
  if (!r)
300
- return;
300
+ return !1;
301
301
  this.originalTexture = r, this.baseTexture = r, this.sprite && (this.app.stage.removeChild(this.sprite), this.sprite.destroy()), this.sprite = new t.Sprite(r), this.app.stage.addChild(this.sprite), this.fitScale = this.getFitScaleFor(r), this.zoom = 1;
302
302
  const { w: a, h: o } = this._getCssSize();
303
- if (this.applyViewTransform({ center: { x: a / 2, y: o / 2 } }), await new Promise(requestAnimationFrame), !((u = this.app) != null && u.renderer)) return;
303
+ if (this.applyViewTransform({ center: { x: a / 2, y: o / 2 } }), await new Promise(requestAnimationFrame), !((u = this.app) != null && u.renderer)) return !1;
304
304
  const n = this.getFitScaleFor(r);
305
- Math.abs(n - this.fitScale) / Math.max(1e-6, n) > 0.02 && (this.fitScale = n, this.applyViewTransform({ center: { x: a / 2, y: o / 2 } })), this.render(), this.emit("textureLoaded", { width: r.width, height: r.height });
305
+ return Math.abs(n - this.fitScale) / Math.max(1e-6, n) > 0.02 && (this.fitScale = n, this.applyViewTransform({ center: { x: a / 2, y: o / 2 } })), this.render(), this.emit("textureLoaded", { width: r.width, height: r.height }), !0;
306
306
  }
307
307
  /**
308
308
  * Export the current image with filters applied
@@ -2696,7 +2696,15 @@ class ei extends B {
2696
2696
  if (this._destroyed) return;
2697
2697
  const i = ++this._loadVersion;
2698
2698
  let r = e;
2699
- this._resetEditorState(), e instanceof Blob && (r = URL.createObjectURL(e), this._objectUrls.add(r)), await this._renderer.loadTexture(r), !(this._destroyed || this._loadVersion !== i) && (this._state.set("hasImage", !0), this._state.set("imageUrl", r), t.state && this._hydrateState(t.state), this._options.initialMode === "crop" && this.setMode("crop"), this.emit("imageLoaded", { url: r }));
2699
+ this._resetEditorState(), e instanceof Blob && (r = URL.createObjectURL(e), this._objectUrls.add(r));
2700
+ const a = await this._renderer.loadTexture(r);
2701
+ if (!(this._destroyed || this._loadVersion !== i)) {
2702
+ if (!a) {
2703
+ this.emit("error", new Error("Failed to load image"));
2704
+ return;
2705
+ }
2706
+ this._state.set("hasImage", !0), this._state.set("imageUrl", r), t.state && this._hydrateState(t.state), this._options.initialMode === "crop" && this.setMode("crop"), this.emit("imageLoaded", { url: r });
2707
+ }
2700
2708
  }
2701
2709
  /**
2702
2710
  * Reset all editor state (filters + crop) to a clean baseline.
@@ -8522,4 +8530,4 @@ export {
8522
8530
  ri as i,
8523
8531
  f as r
8524
8532
  };
8525
- //# sourceMappingURL=editor-624YYYUE.js.map
8533
+ //# sourceMappingURL=editor-DiiyShiW.js.map