Skip to content

Commit

Permalink
[Fix #151] Fix zoom crash using production mode
Browse files Browse the repository at this point in the history
  • Loading branch information
LaChope committed Jan 25, 2024
1 parent 90bcc77 commit 798765e
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 6 deletions.
4 changes: 1 addition & 3 deletions src/components/editor/faultTree/canvas/EditorCanvas.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {FaultEvent} from "@models/eventModel";
import FaultEventMenu from "@components/editor/faultTree/menu/faultEvent/FaultEventMenu";
import {CurrentFaultTreeTableProvider} from "@hooks/useCurrentFaultTreeTable";
import SidebarMenuHeader from "@components/editor/faultTree/menu/SidebarMenuHeader";
import * as svgPanZoomImport from "svg-pan-zoom";
import svgPanZoom from "svg-pan-zoom";
import {SVG_PAN_ZOOM_OPTIONS} from "@utils/constants";
import {saveSvgAsPng} from "save-svg-as-png";
import renderTree from "@components/editor/faultTree/shapes/RenderTree";
Expand Down Expand Up @@ -60,8 +60,6 @@ const EditorCanvas = ({
const [currentZoom, setCurrentZoom] = useState(1);
const [isExportingImage, setIsExportingImage] = useState(false);

const svgPanZoom = svgPanZoomImport;

let dragStartPosition = null;

useEffect(() => {
Expand Down
4 changes: 1 addition & 3 deletions src/components/editor/system/canvas/EditorCanvas.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import DiagramOptions from "@components/editor/menu/DiagramOptions";
import SidebarMenu from "@components/editor/faultTree/menu/SidebarMenu";
import ComponentSidebarMenu from "@components/editor/system/menu/component/ComponentSidebarMenu";
import {SystemLink} from "@components/editor/system/shapes/shapesDefinitions";
import * as svgPanZoomImport from "svg-pan-zoom";
import svgPanZoom from "svg-pan-zoom";
import {SVG_PAN_ZOOM_OPTIONS} from "@utils/constants";
import {saveSvgAsPng} from "save-svg-as-png";

Expand Down Expand Up @@ -48,8 +48,6 @@ const EditorCanvas = ({
const [currentZoom, setCurrentZoom] = useState(1);
const [isExportingImage, setIsExportingImage] = useState(false);

const svgPanZoom = svgPanZoomImport;

useEffect(() => {
const canvasWidth = containerRef.current.clientWidth;
const canvasHeight = containerRef.current.clientHeight;
Expand Down
1 change: 1 addition & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"jsx": "react",
"target": "es6",
"moduleResolution": "node",
"allowSyntheticDefaultImports": true,
// Paths mapping and aliasing
"baseUrl": "./",
"paths": {
Expand Down

0 comments on commit 798765e

Please sign in to comment.