Explorar o código

disable dynamic canvas size

AykutSarac %!s(int64=3) %!d(string=hai) anos
pai
achega
afa6544d41
Modificáronse 1 ficheiros con 2 adicións e 13 borrados
  1. 2 13
      src/containers/LiveEditor/index.tsx

+ 2 - 13
src/containers/LiveEditor/index.tsx

@@ -44,10 +44,6 @@ export const LiveEditor: React.FC = React.memo(function LiveEditor() {
     nodes: [],
     edges: [],
   });
-  const [canvasSize, setCanvasSize] = React.useState({
-    width: 2000,
-    height: 2000,
-  });
 
   React.useEffect(() => {
     const { nodes, edges } = getEdgeNodes(json, settings.expand);
@@ -92,12 +88,6 @@ export const LiveEditor: React.FC = React.memo(function LiveEditor() {
     if (input) input.blur();
   };
 
-  const onLayoutChange = (layout: ElkRoot) =>
-    setCanvasSize({
-      width: layout.width ?? 2000,
-      height: layout.height ?? 2000,
-    });
-
   const onInit = (ref: ReactZoomPanPinchRef) => {
     dispatch({
       type: ConfigActionType.SET_ZOOM_PAN_PICNH_REF,
@@ -123,8 +113,8 @@ export const LiveEditor: React.FC = React.memo(function LiveEditor() {
                 nodes={data.nodes}
                 node={(props) => <CustomNode {...props} />}
                 edges={data.edges}
-                maxWidth={canvasSize.width}
-                maxHeight={canvasSize.height}
+                maxWidth={20000}
+                maxHeight={20000}
                 center={false}
                 zoomable={false}
                 fit={true}
@@ -132,7 +122,6 @@ export const LiveEditor: React.FC = React.memo(function LiveEditor() {
                 readonly
                 key={settings.layout}
                 onCanvasClick={onCanvasClick}
-                onLayoutChange={onLayoutChange}
               />
             </TransformComponent>
           </TransformWrapper>