From 738f814ecbf2ba644f6648c1d37ffe092c1af1c6 Mon Sep 17 00:00:00 2001 From: Jim Richter Date: Tue, 16 Mar 2021 16:30:07 +0100 Subject: [PATCH] fix: lazy load 3d view --- view/src/components/Editor/Painter.svelte | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/view/src/components/Editor/Painter.svelte b/view/src/components/Editor/Painter.svelte index f0cb55d..18d1f77 100644 --- a/view/src/components/Editor/Painter.svelte +++ b/view/src/components/Editor/Painter.svelte @@ -7,7 +7,6 @@ imageToArray, } from "helpers"; import { images as imageStore } from "stores"; - import OrbView from "./OrbView"; import { onMount } from "svelte"; import Toast from "components/Toast"; import { throttle } from "lodash"; @@ -263,11 +262,14 @@ polygonPoints.length === 2 ? cx1.stroke() : cx1.fill(); } - function switchViewMode(e: MouseEvent) { + let OrbView; + async function switchViewMode(e: MouseEvent) { e.stopPropagation(); e.stopImmediatePropagation(); e.preventDefault(); + if (!OrbView) OrbView = (await import("./OrbView")).default; + mode = mode === "2d" ? "3d" : "2d"; if (mode === "3d") {