Browse Source

fix zoom buttons

AykutSarac 3 năm trước cách đây
mục cha
commit
03647216bc
2 tập tin đã thay đổi với 7 bổ sung3 xóa
  1. 5 1
      src/containers/LiveEditor/index.tsx
  2. 2 2
      src/reducer/reducer.ts

+ 5 - 1
src/containers/LiveEditor/index.tsx

@@ -58,7 +58,11 @@ export const LiveEditor: React.FC = React.memo(() => {
   }, [json, settings.expand]);
 
   React.useEffect(() => {
-    wrapperRef.current?.zoomIn();
+    wrapperRef.current?.setTransform(
+      wrapperRef.current.state.positionX,
+      wrapperRef.current.state.positionY,
+      settings.zoomScale
+    );
   }, [settings.zoomScale]);
 
   React.useEffect(() => {

+ 2 - 2
src/reducer/reducer.ts

@@ -38,7 +38,7 @@ export const useConfigReducer: React.Reducer<AppConfig, ReducerAction> = (
         ...state,
         settings: {
           ...state.settings,
-          zoomScale: state.settings.zoomScale + 0.1,
+          zoomScale: state.settings.zoomScale + 0.2,
         },
       };
 
@@ -47,7 +47,7 @@ export const useConfigReducer: React.Reducer<AppConfig, ReducerAction> = (
         ...state,
         settings: {
           ...state.settings,
-          zoomScale: state.settings.zoomScale - 0.1,
+          zoomScale: state.settings.zoomScale - 0.2,
         },
       };