openvideo 0.2.17 → 0.2.18

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.
@@ -1,5 +1,5 @@
1
- import { e as a, A as e, C as i, a as s, E as t, F as n, D as d } from "./index-Gj63TxQW.js";
2
- import "./webworkerAll-S6vnaIy0.js";
1
+ import { e as a, A as e, C as i, a as s, E as t, F as n, D as d } from "./index-hudXPK2u.js";
2
+ import "./webworkerAll-DHuq-MZm.js";
3
3
  a.add(e);
4
4
  a.mixin(i, s);
5
5
  a.add(t);
@@ -57,6 +57,7 @@ export declare class Image extends BaseClip implements IClip {
57
57
  startTime: number;
58
58
  duration: number;
59
59
  }>;
60
+ getVisibleHandles(): Array<'tl' | 'tr' | 'bl' | 'br' | 'ml' | 'mr' | 'mt' | 'mb' | 'rot'>;
60
61
  /**
61
62
  * Load an image clip from a URL using PixiJS Assets
62
63
  * This is optimized for Studio as it uses Texture directly
@@ -102,6 +102,7 @@ export declare class Video extends BaseClip implements IPlaybackCapable {
102
102
  startTime: number;
103
103
  duration: number;
104
104
  }>;
105
+ getVisibleHandles(): Array<'tl' | 'tr' | 'bl' | 'br' | 'ml' | 'mr' | 'mt' | 'mb' | 'rot'>;
105
106
  /**
106
107
  * Load a video clip from a URL
107
108
  * @param url Video URL
@@ -18383,7 +18383,7 @@ const Vv = (r) => {
18383
18383
  },
18384
18384
  test: () => !0,
18385
18385
  load: async () => {
18386
- await import("./browserAll-CRgUZ3hq.js");
18386
+ await import("./browserAll-C8CHW66V.js");
18387
18387
  }
18388
18388
  }, TC = {
18389
18389
  extension: {
@@ -18393,7 +18393,7 @@ const Vv = (r) => {
18393
18393
  },
18394
18394
  test: () => typeof self < "u" && self.WorkerGlobalScope !== void 0,
18395
18395
  load: async () => {
18396
- await import("./webworkerAll-S6vnaIy0.js");
18396
+ await import("./webworkerAll-DHuq-MZm.js");
18397
18397
  }
18398
18398
  };
18399
18399
  class at {
@@ -68980,6 +68980,9 @@ let Oc = class un extends Gn {
68980
68980
  * Each effect specifies key, startTime, duration, and optional targets
68981
68981
  */
68982
68982
  effects = [];
68983
+ getVisibleHandles() {
68984
+ return ["tl", "tr", "bl", "br", "rot"];
68985
+ }
68983
68986
  /**
68984
68987
  * Load an image clip from a URL using PixiJS Assets
68985
68988
  * This is optimized for Studio as it uses Texture directly
@@ -69376,6 +69379,9 @@ class Vr extends Gn {
69376
69379
  * Each effect specifies key, startTime, duration, and optional targets
69377
69380
  */
69378
69381
  effects = [];
69382
+ getVisibleHandles() {
69383
+ return ["tl", "tr", "bl", "br", "rot"];
69384
+ }
69379
69385
  /**
69380
69386
  * Load a video clip from a URL
69381
69387
  * @param url Video URL
@@ -90034,9 +90040,9 @@ class Ni extends Qe {
90034
90040
  cursor;
90035
90041
  callbacks;
90036
90042
  constructor(e, t, i) {
90037
- super(), this.handle = e, this.cursor = t, this.callbacks = i, this.eventMode = "static", this.#l(), this.on("pointerdown", this.#r), this.on("globalpointermove", this.#n), this.on("pointerup", this.#u), this.on("pointerupoutside", this.#u);
90043
+ super(), this.handle = e, this.cursor = t, this.callbacks = i, this.eventMode = "static", this.#a(), this.on("pointerdown", this.#r), this.on("globalpointermove", this.#n), this.on("pointerup", this.#l), this.on("pointerupoutside", this.#l);
90038
90044
  }
90039
- #l() {
90045
+ #a() {
90040
90046
  this.clear();
90041
90047
  const e = 165063;
90042
90048
  if (this.handle === "rot")
@@ -90053,7 +90059,7 @@ class Ni extends Qe {
90053
90059
  #n = (e) => {
90054
90060
  this.#e && this.callbacks.updateDrag(this.handle, e.global);
90055
90061
  };
90056
- #u = (e) => {
90062
+ #l = (e) => {
90057
90063
  this.#e && (this.#e = !1, this.cursor = "pointer", this.callbacks.endDrag());
90058
90064
  };
90059
90065
  }
@@ -90173,17 +90179,17 @@ class yS extends Ie {
90173
90179
  lastPointer = new ve();
90174
90180
  activeHandle = null;
90175
90181
  #e;
90176
- #l = /* @__PURE__ */ new Map();
90182
+ #a = /* @__PURE__ */ new Map();
90177
90183
  #r = new ve();
90178
90184
  #n = 0;
90179
- #u = 0;
90180
- #c = new ce();
90181
- #i = new ve();
90185
+ #l = 0;
90182
90186
  #s = new ce();
90187
+ #i = new ve();
90188
+ #o = new ce();
90183
90189
  // Reusable points for selection bounds calculation to avoid GC
90184
90190
  #t = [new ve(), new ve(), new ve(), new ve()];
90185
- #o = 1;
90186
- #a = 1;
90191
+ #u = 1;
90192
+ #c = 1;
90187
90193
  #h;
90188
90194
  #d = new Qe();
90189
90195
  #m = new ve();
@@ -90239,7 +90245,7 @@ class yS extends Ie {
90239
90245
  let i, n;
90240
90246
  this.opts.clip ? (i = this.opts.clip.width, n = this.opts.clip.height) : (i = t.width, n = t.height);
90241
90247
  const s = e.toGlobal(new ve(0, 0));
90242
- this.#r.set(s.x, s.y), this.#s.copyFrom(
90248
+ this.#r.set(s.x, s.y), this.#o.copyFrom(
90243
90249
  new ce(-i / 2, -n / 2, i, n)
90244
90250
  );
90245
90251
  } else {
@@ -90252,7 +90258,7 @@ class yS extends Ie {
90252
90258
  u.toGlobal(h, h), this.toLocal(h, void 0, h), e = Math.min(e, h.x), t = Math.min(t, h.y), i = Math.max(i, h.x), n = Math.max(n, h.y);
90253
90259
  }
90254
90260
  const s = i - e, o = n - t, a = e + s / 2, l = t + o / 2;
90255
- if (this.#s.copyFrom(new ce(-s / 2, -o / 2, s, o)), this.parent) {
90261
+ if (this.#o.copyFrom(new ce(-s / 2, -o / 2, s, o)), this.parent) {
90256
90262
  const u = this.toGlobal(
90257
90263
  new ve(a, l)
90258
90264
  );
@@ -90336,10 +90342,10 @@ class yS extends Ie {
90336
90342
  const i = e.global.x - this.lastPointer.x, n = e.global.y - this.lastPointer.y;
90337
90343
  this.#m.x += i, this.#m.y += n;
90338
90344
  const s = this.parent.toLocal(this.#m), o = new ce(
90339
- s.x + this.#s.x,
90340
- s.y + this.#s.y,
90341
- this.#s.width,
90342
- this.#s.height
90345
+ s.x + this.#o.x,
90346
+ s.y + this.#o.y,
90347
+ this.#o.width,
90348
+ this.#o.height
90343
90349
  ), {
90344
90350
  dx: a,
90345
90351
  dy: l,
@@ -90352,10 +90358,10 @@ class yS extends Ie {
90352
90358
  return { moveDx: f, moveDy: p, newPivotWorld: m };
90353
90359
  }
90354
90360
  #A(e, t) {
90355
- this.#f(), this.isDragging = !0, this.activeHandle = e, this.#l.clear();
90361
+ this.#f(), this.isDragging = !0, this.activeHandle = e, this.#a.clear();
90356
90362
  for (const i of this.group)
90357
- this.#l.set(i, i.localTransform.clone());
90358
- this.rotation = this.#n, this.#c.copyFrom(this.#s), this.#F(e);
90363
+ this.#a.set(i, i.localTransform.clone());
90364
+ this.rotation = this.#n, this.#s.copyFrom(this.#o), this.#F(e);
90359
90365
  }
90360
90366
  #E(e, t) {
90361
90367
  this.#P(e, t);
@@ -90373,7 +90379,7 @@ class yS extends Ie {
90373
90379
  proposed: i,
90374
90380
  sx: n,
90375
90381
  sy: s
90376
- }) : this.#_(this.#D(o, this.#n, n, s)), this.#s.copyFrom(i), this.#p(), this.emit("transforming");
90382
+ }) : this.#_(this.#D(o, this.#n, n, s)), this.#o.copyFrom(i), this.#p(), this.emit("transforming");
90377
90383
  }
90378
90384
  async #I(e, t) {
90379
90385
  const i = this.#i, n = this.#M(
@@ -90388,14 +90394,14 @@ class yS extends Ie {
90388
90394
  );
90389
90395
  const { dx: o, dy: a, guides: l } = this.#h.snapMove(n);
90390
90396
  n.x += o, n.y += a, this.#b(l, s);
90391
- const u = n.width / this.#c.width, c = n.height / this.#c.height, h = this.toGlobal(i);
90397
+ const u = n.width / this.#s.width, c = n.height / this.#s.height, h = this.toGlobal(i);
90392
90398
  return { proposed: n, sx: u, sy: c, pivotWorld: h };
90393
90399
  }
90394
90400
  #B(e) {
90395
- this.#f(), this.isDragging = !0, this.activeHandle = "rot", this.#l.clear();
90401
+ this.#f(), this.isDragging = !0, this.activeHandle = "rot", this.#a.clear();
90396
90402
  for (const t of this.group)
90397
- this.#l.set(t, t.localTransform.clone());
90398
- this.#u = Math.atan2(
90403
+ this.#a.set(t, t.localTransform.clone());
90404
+ this.#l = Math.atan2(
90399
90405
  e.y - this.#r.y,
90400
90406
  e.x - this.#r.x
90401
90407
  );
@@ -90404,7 +90410,7 @@ class yS extends Ie {
90404
90410
  const i = Math.atan2(
90405
90411
  e.y - this.#r.y,
90406
90412
  e.x - this.#r.x
90407
- ) - this.#u, n = this.#n + i;
90413
+ ) - this.#l, n = this.#n + i;
90408
90414
  this.#_(this.#O(this.#r, i)), this.rotation = n, this.#p(n), this.emit("transforming");
90409
90415
  }
90410
90416
  #v() {
@@ -90421,7 +90427,7 @@ class yS extends Ie {
90421
90427
  }
90422
90428
  #p(e = this.#n) {
90423
90429
  this.parent && this.position.copyFrom(this.parent.toLocal(this.#r)), this.rotation = e;
90424
- const i = 1 / ((this.parent ? Math.abs(this.parent.worldTransform.a) : 1) || 1), n = this.#s;
90430
+ const i = 1 / ((this.parent ? Math.abs(this.parent.worldTransform.a) : 1) || 1), n = this.#o;
90425
90431
  this.wireframe.draw(n, i);
90426
90432
  const s = n.x + n.width / 2, o = n.y + n.height / 2, l = this.opts.locked ? [] : this.opts.clip?.getVisibleHandles?.() ?? [
90427
90433
  "tl",
@@ -90465,7 +90471,7 @@ class yS extends Ie {
90465
90471
  }
90466
90472
  // helpers
90467
90473
  #F(e) {
90468
- const t = this.#c;
90474
+ const t = this.#s;
90469
90475
  if (this.opts.centeredScaling) {
90470
90476
  this.#i.set(t.x + t.width / 2, t.y + t.height / 2);
90471
90477
  return;
@@ -90473,44 +90479,48 @@ class yS extends Ie {
90473
90479
  e === "tl" ? this.#i.set(t.x + t.width, t.y + t.height) : e === "tr" ? this.#i.set(t.x, t.y + t.height) : e === "bl" ? this.#i.set(t.x + t.width, t.y) : e === "br" ? this.#i.set(t.x, t.y) : e === "ml" ? this.#i.set(t.x + t.width, t.y + t.height / 2) : e === "mr" ? this.#i.set(t.x, t.y + t.height / 2) : e === "mt" ? this.#i.set(t.x + t.width / 2, t.y + t.height) : e === "mb" && this.#i.set(t.x + t.width / 2, t.y);
90474
90480
  }
90475
90481
  #M(e, t, i) {
90476
- if (this.opts.centeredScaling) {
90477
- const s = Math.max(this.#o, Math.abs(t.x - i.x) * 2), o = Math.max(this.#a, Math.abs(t.y - i.y) * 2);
90478
- return new ce(i.x - s / 2, i.y - o / 2, s, o);
90479
- }
90480
- if (e === "tl") {
90481
- const s = Math.min(t.x, i.x - this.#o), o = Math.min(t.y, i.y - this.#a);
90482
- return new ce(s, o, i.x - s, i.y - o);
90483
- }
90484
- if (e === "tr") {
90485
- const s = Math.max(t.x, i.x + this.#o), o = Math.min(t.y, i.y - this.#a);
90486
- return new ce(i.x, o, s - i.x, i.y - o);
90487
- }
90488
- if (e === "bl") {
90489
- const s = Math.min(t.x, i.x - this.#o), o = Math.max(t.y, i.y + this.#a);
90490
- return new ce(s, i.y, i.x - s, o - i.y);
90491
- }
90492
- if (e === "br") {
90493
- const s = Math.max(t.x, i.x + this.#o), o = Math.max(t.y, i.y + this.#a);
90494
- return new ce(i.x, i.y, s - i.x, o - i.y);
90495
- }
90496
- const n = this.#c;
90482
+ let n = !1;
90483
+ if (this.opts.clip && (this.opts.clip.type === "Image" || this.opts.clip.type === "Video") && (n = !0), this.opts.centeredScaling) {
90484
+ let o = Math.abs(t.x - i.x) * 2, a = Math.abs(t.y - i.y) * 2;
90485
+ if (n) {
90486
+ const l = this.#s.width, u = this.#s.height, c = l / u;
90487
+ o / l > a / u ? a = o / c : o = a * c;
90488
+ }
90489
+ return o = Math.max(this.#u, o), a = Math.max(this.#c, a), new ce(i.x - o / 2, i.y - a / 2, o, a);
90490
+ }
90491
+ if (["tl", "tr", "bl", "br"].includes(e)) {
90492
+ let o = Math.abs(t.x - i.x), a = Math.abs(t.y - i.y);
90493
+ if (n) {
90494
+ const l = this.#s.width, u = this.#s.height, c = l / u;
90495
+ o / l > a / u ? a = o / c : o = a * c;
90496
+ }
90497
+ if (o = Math.max(this.#u, o), a = Math.max(this.#c, a), e === "tl")
90498
+ return new ce(i.x - o, i.y - a, o, a);
90499
+ if (e === "tr")
90500
+ return new ce(i.x, i.y - a, o, a);
90501
+ if (e === "bl")
90502
+ return new ce(i.x - o, i.y, o, a);
90503
+ if (e === "br")
90504
+ return new ce(i.x, i.y, o, a);
90505
+ }
90506
+ const s = this.#s;
90497
90507
  if (e === "ml") {
90498
- const s = Math.min(t.x, i.x - this.#o);
90499
- return new ce(s, n.y, i.x - s, n.height);
90508
+ const o = Math.min(t.x, i.x - this.#u);
90509
+ return new ce(o, s.y, i.x - o, s.height);
90500
90510
  }
90501
90511
  if (e === "mr") {
90502
- const s = Math.max(t.x, i.x + this.#o);
90503
- return new ce(i.x, n.y, s - i.x, n.height);
90512
+ const o = Math.max(t.x, i.x + this.#u);
90513
+ return new ce(i.x, s.y, o - i.x, s.height);
90504
90514
  }
90505
90515
  if (e === "mt") {
90506
- const s = Math.min(t.y, i.y - this.#a);
90507
- return new ce(n.x, s, n.width, i.y - s);
90516
+ const o = Math.min(t.y, i.y - this.#c);
90517
+ return new ce(s.x, o, s.width, i.y - o);
90508
90518
  }
90509
90519
  if (e === "mb") {
90510
- const s = Math.max(t.y, i.y + this.#a);
90511
- return new ce(n.x, i.y, n.width, s - i.y);
90520
+ const o = Math.max(t.y, i.y + this.#c);
90521
+ return new ce(s.x, i.y, s.width, o - i.y);
90512
90522
  }
90513
- return new ce(i.x, i.y, this.#o, this.#a);
90523
+ return new ce(i.x, i.y, this.#u, this.#c);
90514
90524
  }
90515
90525
  #D(e, t, i, n) {
90516
90526
  return xS.delta.identity().translate(-e.x, -e.y).rotate(-t).scale(i, n).rotate(t).translate(e.x, e.y);
@@ -90520,7 +90530,7 @@ class yS extends Ie {
90520
90530
  }
90521
90531
  #_(e) {
90522
90532
  for (const t of this.group) {
90523
- const i = this.#l.get(t), n = t.parent;
90533
+ const i = this.#a.get(t), n = t.parent;
90524
90534
  if (!i || !n) continue;
90525
90535
  const s = n.worldTransform.clone().invert(), o = n.worldTransform.clone().append(i), a = e.clone().append(o), l = s.clone().append(a);
90526
90536
  t.setFromMatrix(l);
@@ -90771,10 +90781,10 @@ class Ste {
90771
90781
  transformer: this.activeTransformer
90772
90782
  });
90773
90783
  }), this.activeTransformer.on("pointerdown", (s) => {
90774
- if (s.button !== 0) return;
90775
- this.studio.emit("transform:start", {
90784
+ if (s.button !== 0 || (this.studio.emit("transform:start", {
90776
90785
  transformer: this.activeTransformer
90777
- });
90786
+ }), this.activeTransformer?.activeHandle !== null))
90787
+ return;
90778
90788
  const o = this.getTopmostClipAtPoint(s.global), a = Date.now();
90779
90789
  o && o === this.lastPointerDownClip && a - this.lastPointerDownTime < 350 && (o.type === "Text" || o.type === "Caption") && this.studio.emit("clip:dblclick", { clip: o }), this.lastPointerDownTime = a, this.lastPointerDownClip = o, o && !this.selectedClips.has(o) && (this.selectClip(o, s.shiftKey), s.stopPropagation());
90780
90790
  }), this.studio.artboard.addChild(this.activeTransformer), this.activeTransformer.showImmediate(), this.studio.pixiApp?.render();
@@ -90838,7 +90848,7 @@ class Ste {
90838
90848
  const g = await e.getTexture();
90839
90849
  g && (await t.updateFrame(g), e.width = u, e.height = g.height, this.textClipResizedWidth = null, e.left = f - e.width / 2, e.top = i.y - e.height / 2, n.scale.set(1, 1), i.scale.set(1, 1));
90840
90850
  } else {
90841
- let m = a, g = l;
90851
+ const m = a, g = l;
90842
90852
  e.left = i.x - m / 2, e.top = i.y - g / 2, e.width = m, e.height = g;
90843
90853
  const v = e.flip == null ? 1 : -1;
90844
90854
  e.angle = v * i.angle;
@@ -90856,9 +90866,7 @@ class Ste {
90856
90866
  if (t != null) {
90857
90867
  const i = t.getRoot(), n = t.getSprite();
90858
90868
  if (i != null && n != null && n.texture != null) {
90859
- const s = n.texture.width, o = n.texture.height, a = Math.abs(i.scale.x * n.scale.x) * s, l = Math.abs(i.scale.y * n.scale.y) * o;
90860
- let u = a, c = l;
90861
- const h = i.x - u / 2, d = i.y - c / 2;
90869
+ const s = n.texture.width, o = n.texture.height, a = Math.abs(i.scale.x * n.scale.x) * s, l = Math.abs(i.scale.y * n.scale.y) * o, u = a, c = l, h = i.x - u / 2, d = i.y - c / 2;
90862
90870
  e.left = h, e.top = d, e.width = u, e.height = c;
90863
90871
  const f = e.flip == null ? 1 : -1;
90864
90872
  e.angle = f * i.angle, t.updateTransforms(), this.studio.emit("clip:updated", { clip: e });
package/dist/index.es.js CHANGED
@@ -1,4 +1,4 @@
1
- import { a4 as t, p as e, q as i, w as o, v as n, t as r, Y as T, a2 as E, I as m, a9 as f, L as g, V as A, P as I, S as C, s as L, u as P, K as S, O as _, V as l, a8 as O, x as c, o as p, a6 as u, a5 as M, l as d, m as F, z as N, W as x, a0 as R, a7 as U, X as V, a3 as y, a1 as k, y as D, J as h, Z as w, n as B, Q as G, _ as J, r as K, U as j, $ as q } from "./index-Gj63TxQW.js";
1
+ import { a4 as t, p as e, q as i, w as o, v as n, t as r, Y as T, a2 as E, I as m, a9 as f, L as g, V as A, P as I, S as C, s as L, u as P, K as S, O as _, V as l, a8 as O, x as c, o as p, a6 as u, a5 as M, l as d, m as F, z as N, W as x, a0 as R, a7 as U, X as V, a3 as y, a1 as k, y as D, J as h, Z as w, n as B, Q as G, _ as J, r as K, U as j, $ as q } from "./index-hudXPK2u.js";
2
2
  export {
3
3
  t as ANIMATABLE_PROPERTIES,
4
4
  e as Audio,