@myoc/excalidraw 0.19.533 → 0.19.535

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/dev/index.js CHANGED
@@ -63,10 +63,10 @@ import {
63
63
  serializeAsJSON,
64
64
  strokeRectWithRotation_simple,
65
65
  zoomToFitBounds
66
- } from "./chunk-AR7I2OPB.js";
66
+ } from "./chunk-X5K2WJMP.js";
67
67
  import {
68
68
  define_import_meta_env_default
69
- } from "./chunk-5CVRJMG3.js";
69
+ } from "./chunk-K3XC3WHU.js";
70
70
  import {
71
71
  en_default
72
72
  } from "./chunk-SKCAT7JG.js";
@@ -10968,7 +10968,7 @@ var exportCanvas = async (type, elements, appState, files, {
10968
10968
  let blob = canvasToBlob(tempCanvas);
10969
10969
  if (appState.exportEmbedScene) {
10970
10970
  blob = blob.then(
10971
- (blob2) => import("./data/image-XXT3R6SF.js").then(
10971
+ (blob2) => import("./data/image-MVVCJJVU.js").then(
10972
10972
  ({ encodePngMetadata: encodePngMetadata2 }) => encodePngMetadata2({
10973
10973
  blob: blob2,
10974
10974
  metadata: serializeAsJSON(elements, appState, files, "local")
@@ -24580,7 +24580,7 @@ var AppGifPlayback = class {
24580
24580
  }
24581
24581
  }
24582
24582
  if (didAdvanceFrame) {
24583
- this.app.scene.triggerUpdate();
24583
+ this.app.imagePlaceholderUpdateEmitter.trigger();
24584
24584
  }
24585
24585
  if (shouldContinue) {
24586
24586
  this.playbackRaf = requestAnimationFrame(this.tick);
@@ -31512,10 +31512,13 @@ var GifPlaybackControls = ({
31512
31512
  0
31513
31513
  );
31514
31514
  const [gifGalleryScrollLeft, setGifGalleryScrollLeft] = React32.useState(0);
31515
+ const [isGifGalleryDragging, setIsGifGalleryDragging] = React32.useState(false);
31515
31516
  const speedButtonRef = React32.useRef(null);
31516
31517
  const framesButtonRef = React32.useRef(null);
31517
31518
  const speedPickerRef = React32.useRef(null);
31518
31519
  const frameGalleryRef = React32.useRef(null);
31520
+ const frameGalleryDragRef = React32.useRef(null);
31521
+ const suppressNextFrameClickRef = React32.useRef(false);
31519
31522
  const [gifPopupPosition, setGifPopupPosition] = React32.useState(null);
31520
31523
  React32.useLayoutEffect(() => {
31521
31524
  const popup = liveAppState.openPopup;
@@ -31665,7 +31668,6 @@ var GifPlaybackControls = ({
31665
31668
  });
31666
31669
  };
31667
31670
  const wheelFrame = (event) => {
31668
- event.preventDefault();
31669
31671
  event.stopPropagation();
31670
31672
  commitFrame(frameIndex + (event.deltaY < 0 ? 1 : -1));
31671
31673
  };
@@ -31727,6 +31729,64 @@ var GifPlaybackControls = ({
31727
31729
  firstVisibleFrameIndex,
31728
31730
  lastVisibleFrameIndex
31729
31731
  );
31732
+ const beginGalleryDrag = (event) => {
31733
+ if (event.pointerType !== "mouse" || event.button !== 0) {
31734
+ return;
31735
+ }
31736
+ frameGalleryDragRef.current = {
31737
+ pointerId: event.pointerId,
31738
+ startClientX: event.clientX,
31739
+ startScrollLeft: event.currentTarget.scrollLeft,
31740
+ didDrag: false
31741
+ };
31742
+ event.stopPropagation();
31743
+ };
31744
+ const updateGalleryDrag = (event) => {
31745
+ const dragState = frameGalleryDragRef.current;
31746
+ if (!dragState || dragState.pointerId !== event.pointerId) {
31747
+ return;
31748
+ }
31749
+ const deltaX = event.clientX - dragState.startClientX;
31750
+ if (!dragState.didDrag && Math.abs(deltaX) <= 3) {
31751
+ return;
31752
+ }
31753
+ if (!dragState.didDrag) {
31754
+ dragState.didDrag = true;
31755
+ event.currentTarget.setPointerCapture?.(event.pointerId);
31756
+ setIsGifGalleryDragging(true);
31757
+ }
31758
+ event.currentTarget.scrollLeft = dragState.startScrollLeft - deltaX;
31759
+ setGifGalleryScrollLeft(event.currentTarget.scrollLeft);
31760
+ event.preventDefault();
31761
+ event.stopPropagation();
31762
+ };
31763
+ const endGalleryDrag = (event) => {
31764
+ const dragState = frameGalleryDragRef.current;
31765
+ if (!dragState || dragState.pointerId !== event.pointerId) {
31766
+ return;
31767
+ }
31768
+ suppressNextFrameClickRef.current = dragState.didDrag;
31769
+ frameGalleryDragRef.current = null;
31770
+ if (event.currentTarget.hasPointerCapture?.(event.pointerId)) {
31771
+ event.currentTarget.releasePointerCapture(event.pointerId);
31772
+ }
31773
+ setIsGifGalleryDragging(false);
31774
+ event.stopPropagation();
31775
+ };
31776
+ const cancelGalleryDrag = (event) => {
31777
+ const dragState = frameGalleryDragRef.current;
31778
+ if (!dragState || dragState.pointerId !== event.pointerId) {
31779
+ return;
31780
+ }
31781
+ frameGalleryDragRef.current = null;
31782
+ setIsGifGalleryDragging(false);
31783
+ event.stopPropagation();
31784
+ };
31785
+ const stopGalleryTouchPropagation = (event) => {
31786
+ if (event.pointerType !== "mouse") {
31787
+ event.stopPropagation();
31788
+ }
31789
+ };
31730
31790
  return /* @__PURE__ */ jsxs58(
31731
31791
  "div",
31732
31792
  {
@@ -31772,7 +31832,6 @@ var GifPlaybackControls = ({
31772
31832
  openPopup: liveAppState.openPopup === "gifSpeedPicker" ? null : "gifSpeedPicker"
31773
31833
  }),
31774
31834
  onWheel: (event) => {
31775
- event.preventDefault();
31776
31835
  event.stopPropagation();
31777
31836
  stepSpeed(event.deltaY < 0 ? 1 : -1);
31778
31837
  },
@@ -31844,7 +31903,9 @@ var GifPlaybackControls = ({
31844
31903
  liveAppState.openPopup === "gifFrameGallery" && /* @__PURE__ */ jsx112(
31845
31904
  "div",
31846
31905
  {
31847
- className: "gif-frame-gallery",
31906
+ className: clsx48("gif-frame-gallery", {
31907
+ "gif-frame-gallery--dragging": isGifGalleryDragging
31908
+ }),
31848
31909
  style: {
31849
31910
  ...gifPopupPosition ?? { left, top: galleryTop },
31850
31911
  width: galleryViewportWidth
@@ -31858,8 +31919,25 @@ var GifPlaybackControls = ({
31858
31919
  onScroll: (event) => {
31859
31920
  setGifGalleryScrollLeft(event.currentTarget.scrollLeft);
31860
31921
  },
31922
+ onPointerDownCapture: stopGalleryTouchPropagation,
31923
+ onPointerMoveCapture: stopGalleryTouchPropagation,
31924
+ onPointerUpCapture: stopGalleryTouchPropagation,
31925
+ onPointerCancelCapture: stopGalleryTouchPropagation,
31926
+ onPointerDown: beginGalleryDrag,
31927
+ onPointerMove: updateGalleryDrag,
31928
+ onPointerUp: endGalleryDrag,
31929
+ onPointerCancel: cancelGalleryDrag,
31930
+ onLostPointerCapture: cancelGalleryDrag,
31931
+ onClickCapture: (event) => {
31932
+ if (suppressNextFrameClickRef.current) {
31933
+ suppressNextFrameClickRef.current = false;
31934
+ event.preventDefault();
31935
+ event.stopPropagation();
31936
+ return;
31937
+ }
31938
+ suppressNextFrameClickRef.current = false;
31939
+ },
31861
31940
  onWheelCapture: (event) => {
31862
- event.preventDefault();
31863
31941
  event.stopPropagation();
31864
31942
  event.currentTarget.scrollLeft += event.deltaY;
31865
31943
  setGifGalleryScrollLeft(event.currentTarget.scrollLeft);
@@ -46299,6 +46377,7 @@ var polyfill_default = polyfill;
46299
46377
 
46300
46378
  // index.tsx
46301
46379
  import {
46380
+ configureGifWorkerUrl,
46302
46381
  getSceneVersion,
46303
46382
  hashElementsVersion as hashElementsVersion2,
46304
46383
  hashString as hashString2,
@@ -46683,6 +46762,7 @@ export {
46683
46762
  applyDarkModeFilter11 as applyDarkModeFilter,
46684
46763
  bumpVersion4 as bumpVersion,
46685
46764
  captureDragEventData,
46765
+ configureGifWorkerUrl,
46686
46766
  convertToExcalidrawElements2 as convertToExcalidrawElements,
46687
46767
  defaultLang,
46688
46768
  elementsOverlappingBBox3 as elementsOverlappingBBox,