lint
This commit is contained in:
parent
5dded6112c
commit
ffbd4a5dc8
@ -51,16 +51,22 @@ import {
|
|||||||
import { isElementLink } from "@excalidraw/element/elementLink";
|
import { isElementLink } from "@excalidraw/element/elementLink";
|
||||||
import { restore, restoreAppState } from "@excalidraw/excalidraw/data/restore";
|
import { restore, restoreAppState } from "@excalidraw/excalidraw/data/restore";
|
||||||
import { newElementWith } from "@excalidraw/element/mutateElement";
|
import { newElementWith } from "@excalidraw/element/mutateElement";
|
||||||
import {
|
import { isInitializedImageElement } from "@excalidraw/element/typeChecks";
|
||||||
isFrameLikeElement,
|
|
||||||
isInitializedImageElement,
|
|
||||||
} from "@excalidraw/element/typeChecks";
|
|
||||||
import clsx from "clsx";
|
import clsx from "clsx";
|
||||||
import {
|
import {
|
||||||
parseLibraryTokensFromUrl,
|
parseLibraryTokensFromUrl,
|
||||||
useHandleLibrary,
|
useHandleLibrary,
|
||||||
} from "@excalidraw/excalidraw/data/library";
|
} from "@excalidraw/excalidraw/data/library";
|
||||||
|
|
||||||
|
import { getSelectedElements } from "@excalidraw/element/selection";
|
||||||
|
|
||||||
|
import {
|
||||||
|
decodeConstraints,
|
||||||
|
encodeConstraints,
|
||||||
|
} from "@excalidraw/excalidraw/scene/scrollConstraints";
|
||||||
|
|
||||||
|
import { useApp } from "@excalidraw/excalidraw/components/App";
|
||||||
|
|
||||||
import type { RemoteExcalidrawElement } from "@excalidraw/excalidraw/data/reconcile";
|
import type { RemoteExcalidrawElement } from "@excalidraw/excalidraw/data/reconcile";
|
||||||
import type { RestoredDataState } from "@excalidraw/excalidraw/data/restore";
|
import type { RestoredDataState } from "@excalidraw/excalidraw/data/restore";
|
||||||
import type {
|
import type {
|
||||||
@ -144,11 +150,6 @@ import { ExcalidrawPlusIframeExport } from "./ExcalidrawPlusIframeExport";
|
|||||||
import "./index.scss";
|
import "./index.scss";
|
||||||
|
|
||||||
import type { CollabAPI } from "./collab/Collab";
|
import type { CollabAPI } from "./collab/Collab";
|
||||||
import { getSelectedElements } from "@excalidraw/element/selection";
|
|
||||||
import {
|
|
||||||
decodeConstraints,
|
|
||||||
encodeConstraints,
|
|
||||||
} from "@excalidraw/excalidraw/scene/scrollConstraints";
|
|
||||||
|
|
||||||
polyfill();
|
polyfill();
|
||||||
|
|
||||||
@ -167,9 +168,8 @@ const ConstraintsSettings = ({
|
|||||||
const [constraints, setConstraints] =
|
const [constraints, setConstraints] =
|
||||||
useState<DebugScrollConstraints>(initialConstraints);
|
useState<DebugScrollConstraints>(initialConstraints);
|
||||||
|
|
||||||
const frames = excalidrawAPI
|
const app = useApp();
|
||||||
.getSceneElements()
|
const frames = app.scene.getNonDeletedFramesLikes();
|
||||||
.filter((e) => isFrameLikeElement(e));
|
|
||||||
const [activeFrameId, setActiveFrameId] = useState<string | null>(null);
|
const [activeFrameId, setActiveFrameId] = useState<string | null>(null);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@ -180,7 +180,7 @@ const ConstraintsSettings = ({
|
|||||||
constraints.enabled
|
constraints.enabled
|
||||||
? excalidrawAPI.setScrollConstraints(constraints)
|
? excalidrawAPI.setScrollConstraints(constraints)
|
||||||
: excalidrawAPI.setScrollConstraints(null);
|
: excalidrawAPI.setScrollConstraints(null);
|
||||||
}, [constraints]);
|
}, [constraints, excalidrawAPI]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const frame = frames.find((frame) => frame.id === activeFrameId);
|
const frame = frames.find((frame) => frame.id === activeFrameId);
|
||||||
@ -196,7 +196,7 @@ const ConstraintsSettings = ({
|
|||||||
lockZoom: s.lockZoom,
|
lockZoom: s.lockZoom,
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
}, [activeFrameId]);
|
}, [activeFrameId, frames]);
|
||||||
|
|
||||||
const [selection, setSelection] = useState<ExcalidrawElement[]>([]);
|
const [selection, setSelection] = useState<ExcalidrawElement[]>([]);
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@ -471,8 +471,6 @@ const initializeScene = async (opts: {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log({ shareableLink });
|
|
||||||
|
|
||||||
const externalUrlMatch = window.location.hash.match(/^#url=(.*)$/);
|
const externalUrlMatch = window.location.hash.match(/^#url=(.*)$/);
|
||||||
|
|
||||||
const localDataState = importFromLocalStorage();
|
const localDataState = importFromLocalStorage();
|
||||||
@ -498,7 +496,6 @@ const initializeScene = async (opts: {
|
|||||||
shareableLink[1],
|
shareableLink[1],
|
||||||
localDataState,
|
localDataState,
|
||||||
);
|
);
|
||||||
console.log(">>>>", scene);
|
|
||||||
}
|
}
|
||||||
scene.scrollToContent = true;
|
scene.scrollToContent = true;
|
||||||
if (!roomLinkData) {
|
if (!roomLinkData) {
|
||||||
|
@ -464,6 +464,12 @@ import { isMaybeMermaidDefinition } from "../mermaid";
|
|||||||
|
|
||||||
import { LassoTrail } from "../lasso";
|
import { LassoTrail } from "../lasso";
|
||||||
|
|
||||||
|
import {
|
||||||
|
constrainScrollState,
|
||||||
|
calculateConstrainedScrollCenter,
|
||||||
|
areCanvasTranslatesClose,
|
||||||
|
} from "../scene/scrollConstraints";
|
||||||
|
|
||||||
import { activeConfirmDialogAtom } from "./ActiveConfirmDialog";
|
import { activeConfirmDialogAtom } from "./ActiveConfirmDialog";
|
||||||
import BraveMeasureTextError from "./BraveMeasureTextError";
|
import BraveMeasureTextError from "./BraveMeasureTextError";
|
||||||
import { ContextMenu, CONTEXT_MENU_SEPARATOR } from "./ContextMenu";
|
import { ContextMenu, CONTEXT_MENU_SEPARATOR } from "./ContextMenu";
|
||||||
@ -528,11 +534,6 @@ import type {
|
|||||||
} from "../types";
|
} from "../types";
|
||||||
import type { RoughCanvas } from "roughjs/bin/canvas";
|
import type { RoughCanvas } from "roughjs/bin/canvas";
|
||||||
import type { Action, ActionResult } from "../actions/types";
|
import type { Action, ActionResult } from "../actions/types";
|
||||||
import {
|
|
||||||
constrainScrollState,
|
|
||||||
calculateConstrainedScrollCenter,
|
|
||||||
areCanvasTranslatesClose,
|
|
||||||
} from "../scene/scrollConstraints";
|
|
||||||
|
|
||||||
const AppContext = React.createContext<AppClassProperties>(null!);
|
const AppContext = React.createContext<AppClassProperties>(null!);
|
||||||
const AppPropsContext = React.createContext<AppProps>(null!);
|
const AppPropsContext = React.createContext<AppProps>(null!);
|
||||||
|
@ -1,10 +1,12 @@
|
|||||||
import { isShallowEqual } from "@excalidraw/common";
|
import { isShallowEqual } from "@excalidraw/common";
|
||||||
import {
|
|
||||||
|
import { getNormalizedZoom } from "./normalize";
|
||||||
|
|
||||||
|
import type {
|
||||||
AnimateTranslateCanvasValues,
|
AnimateTranslateCanvasValues,
|
||||||
AppState,
|
AppState,
|
||||||
ScrollConstraints,
|
ScrollConstraints,
|
||||||
} from "../types";
|
} from "../types";
|
||||||
import { getNormalizedZoom } from "./normalize";
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Calculates the scroll center coordinates and the optimal zoom level to fit the constrained scrollable area within the viewport.
|
* Calculates the scroll center coordinates and the optimal zoom level to fit the constrained scrollable area within the viewport.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user