mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
another attempt at constructor error
This commit is contained in:
parent
c428a8a7b8
commit
87732874c6
3 changed files with 27 additions and 14 deletions
|
@ -25,7 +25,10 @@ export default defineConfig(({ mode }) => {
|
|||
alias: [
|
||||
{
|
||||
find: /^@excalidraw\/common$/,
|
||||
replacement: path.resolve(__dirname, "../packages/common/src/index.ts"),
|
||||
replacement: path.resolve(
|
||||
__dirname,
|
||||
"../packages/common/src/index.ts",
|
||||
),
|
||||
},
|
||||
{
|
||||
find: /^@excalidraw\/common\/(.*?)/,
|
||||
|
@ -33,7 +36,10 @@ export default defineConfig(({ mode }) => {
|
|||
},
|
||||
{
|
||||
find: /^@excalidraw\/element$/,
|
||||
replacement: path.resolve(__dirname, "../packages/element/src/index.ts"),
|
||||
replacement: path.resolve(
|
||||
__dirname,
|
||||
"../packages/element/src/index.ts",
|
||||
),
|
||||
},
|
||||
{
|
||||
find: /^@excalidraw\/element\/(.*?)/,
|
||||
|
@ -41,7 +47,10 @@ export default defineConfig(({ mode }) => {
|
|||
},
|
||||
{
|
||||
find: /^@excalidraw\/excalidraw$/,
|
||||
replacement: path.resolve(__dirname, "../packages/excalidraw/index.tsx"),
|
||||
replacement: path.resolve(
|
||||
__dirname,
|
||||
"../packages/excalidraw/index.tsx",
|
||||
),
|
||||
},
|
||||
{
|
||||
find: /^@excalidraw\/excalidraw\/(.*?)/,
|
||||
|
@ -57,7 +66,10 @@ export default defineConfig(({ mode }) => {
|
|||
},
|
||||
{
|
||||
find: /^@excalidraw\/utils$/,
|
||||
replacement: path.resolve(__dirname, "../packages/utils/src/index.ts"),
|
||||
replacement: path.resolve(
|
||||
__dirname,
|
||||
"../packages/utils/src/index.ts",
|
||||
),
|
||||
},
|
||||
{
|
||||
find: /^@excalidraw\/utils\/(.*?)/,
|
||||
|
|
|
@ -29,10 +29,10 @@ import { type AnimationFrameHandler } from "../animation-frame-handler";
|
|||
|
||||
import { AnimatedTrail } from "../animated-trail";
|
||||
|
||||
import LassoWorker from "./lasso-worker.ts?worker";
|
||||
|
||||
import { LassoWorkerPolyfill } from "./lasso-worker-polyfill";
|
||||
|
||||
import { WorkerUrl } from "./lasso-worker.chunk";
|
||||
|
||||
import type App from "../components/App";
|
||||
import type { LassoWorkerInput, LassoWorkerOutput } from "./types";
|
||||
|
||||
|
@ -67,7 +67,7 @@ export class LassoTrail extends AnimatedTrail {
|
|||
});
|
||||
}
|
||||
|
||||
startPath(x: number, y: number, keepPreviousSelection = false) {
|
||||
async startPath(x: number, y: number, keepPreviousSelection = false) {
|
||||
// clear any existing trails just in case
|
||||
this.endPath();
|
||||
|
||||
|
@ -86,10 +86,11 @@ export class LassoTrail extends AnimatedTrail {
|
|||
}
|
||||
|
||||
try {
|
||||
this.worker =
|
||||
typeof Worker !== "undefined"
|
||||
? new LassoWorker()
|
||||
: new LassoWorkerPolyfill();
|
||||
if (typeof Worker !== "undefined" && WorkerUrl) {
|
||||
this.worker = new Worker(WorkerUrl, { type: "module" });
|
||||
} else {
|
||||
this.worker = new LassoWorkerPolyfill();
|
||||
}
|
||||
|
||||
this.worker.onmessage = (event: MessageEvent<LassoWorkerOutput>) => {
|
||||
const { selectedElementIds } = event.data;
|
||||
|
|
|
@ -2,7 +2,9 @@ import { updateSelection } from "./utils";
|
|||
|
||||
import type { LassoWorkerInput } from "./types";
|
||||
|
||||
const ctx = self as unknown as Worker;
|
||||
export const WorkerUrl: URL | undefined = import.meta.url
|
||||
? new URL(import.meta.url)
|
||||
: undefined;
|
||||
|
||||
// variables to track processing state and latest input data
|
||||
// for "backpressure" purposes
|
||||
|
@ -70,5 +72,3 @@ const processInputData = () => {
|
|||
}
|
||||
}
|
||||
};
|
||||
|
||||
export default ctx;
|
Loading…
Add table
Add a link
Reference in a new issue