@annotorious/plugin-segment-anything 0.1.10 → 0.1.11

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.
@@ -12612,6 +12612,7 @@ const qe = /* @__PURE__ */ Be(je), Ze = (W, C = [255, 255, 255, 255], e = [0, 0,
12612
12612
  const B = ke(r.sam.currentCanvas);
12613
12613
  X.postMessage({ type: "encode", data: B, viewportVersion: r.viewportVersion });
12614
12614
  }, w = (B) => {
12615
+ if (r.lastEncodingVersion !== r.viewportVersion) return;
12615
12616
  const L = o(B);
12616
12617
  L && X.postMessage({ type: "decode_preview", point: L });
12617
12618
  }, T = () => {
@@ -12631,7 +12632,7 @@ const qe = /* @__PURE__ */ Be(je), Ze = (W, C = [255, 255, 255, 255], e = [0, 0,
12631
12632
  }, E = () => {
12632
12633
  r.isAnimationInProgress = !1, i.emit("animationStart"), !(!r.isOSDReady || !t) && (x(), r.isSAMReady && v());
12633
12634
  }, P = () => {
12634
- t = !0, a.show(), s.show(), I(), r.sam || x();
12635
+ t = !0, a.show(), s.show(), I(), r.sam || (x(), r.isSAMReady && v());
12635
12636
  };
12636
12637
  Ye(e, () => {
12637
12638
  console.log("[a9s-sam] OSD canvas ready"), r.isOSDReady = !0, E();
@@ -12660,7 +12661,7 @@ const qe = /* @__PURE__ */ Be(je), Ze = (W, C = [255, 255, 255, 255], e = [0, 0,
12660
12661
  r.isSAMReady = !0, i.emit("initialized"), t && v();
12661
12662
  else if (L === "encode_success") {
12662
12663
  const { viewportVersion: k } = B.data;
12663
- k < r.viewportVersion ? console.log("[a9s-sam] Stale encoding - discarding") : (i.emit("encodingFinished"), r.lastPointerPos && w(r.lastPointerPos));
12664
+ r.lastEncodingVersion = k, k < r.viewportVersion ? console.log("[a9s-sam] Stale encoding - discarding") : (i.emit("encodingFinished"), r.lastPointerPos && w(r.lastPointerPos));
12664
12665
  } else if (L === "decode_preview_success") {
12665
12666
  if (r.sam && !r.isAnimationInProgress) {
12666
12667
  const { result: k, viewportVersion: q } = B.data;