Browse Source

auto commit

master
jfinn 3 years ago
parent
commit
263c7776ef
1 changed files with 62 additions and 3 deletions
  1. 62
    3
      src/actions/actionCanvas.tsx

+ 62
- 3
src/actions/actionCanvas.tsx View File

74
 export const actionZoomIn = register({
74
 export const actionZoomIn = register({
75
   name: "zoomIn",
75
   name: "zoomIn",
76
   perform: (_elements, appState) => {
76
   perform: (_elements, appState) => {
77
+    /*
78
+    var z = {
79
+      ZOOM_STEP,
80
+      offsetTop:appState.offsetTop,
81
+      offsetLeft:appState.offsetLeft,
82
+      height:appState.height,
83
+      width:appState.width,
84
+    }
85
+    var _ZOOM_STEP
86
+    */
87
+    console.log("xdev perform_zoom_in",{ left: appState.offsetLeft, top: appState.offsetTop })
88
+
77
     const zoom = getNewZoom(
89
     const zoom = getNewZoom(
78
       getNormalizedZoom(appState.zoom.value + ZOOM_STEP),
90
       getNormalizedZoom(appState.zoom.value + ZOOM_STEP),
79
       appState.zoom,
91
       appState.zoom,
80
       { left: appState.offsetLeft, top: appState.offsetTop },
92
       { left: appState.offsetLeft, top: appState.offsetTop },
81
       { x: appState.width / 2, y: appState.height / 2 },
93
       { x: appState.width / 2, y: appState.height / 2 },
82
     );
94
     );
95
+    // console.trace("perform_zoom_in")
96
+    // window.tmp_hooks ? tmp_hooks.ac2 = {NormalizedZoomValue,AppState} : 0
97
+    window.tmp_hooks ? tmp_hooks.ac2 = {NormalizedZoomValue} : 0
98
+    window.tmp_hooks ? tmp_hooks.zoomin2 = {zoom,_elements, appState,args:[...arguments],that:this} : 0
83
     return {
99
     return {
84
       appState: {
100
       appState: {
85
         ...appState,
101
         ...appState,
95
       title={`${t("buttons.zoomIn")} — ${getShortcutKey("CtrlOrCmd++")}`}
111
       title={`${t("buttons.zoomIn")} — ${getShortcutKey("CtrlOrCmd++")}`}
96
       aria-label={t("buttons.zoomIn")}
112
       aria-label={t("buttons.zoomIn")}
97
       onClick={() => {
113
       onClick={() => {
114
+        window.tmp_hooks ? tmp_hooks.zoomIn_onclick = {that:this,updateData} : 0
115
+    // window.tmp_hooks ? tmp_hooks.ac3 = {NormalizedZoomValue,AppState} : 0
116
+    window.tmp_hooks ? tmp_hooks.ac3 = {NormalizedZoomValue} : 0
117
+        console.log("xcal_dev ZoomIn:",{that:this,updateData})
98
         updateData(null);
118
         updateData(null);
99
       }}
119
       }}
100
       size="small"
120
       size="small"
130
       title={`${t("buttons.zoomOut")} — ${getShortcutKey("CtrlOrCmd+-")}`}
150
       title={`${t("buttons.zoomOut")} — ${getShortcutKey("CtrlOrCmd+-")}`}
131
       aria-label={t("buttons.zoomOut")}
151
       aria-label={t("buttons.zoomOut")}
132
       onClick={() => {
152
       onClick={() => {
153
+        window.tmp_hooks ? tmp_hooks.zoomOut_onclick = {that:this,updateData} : 0
154
+        console.log("xcal_dev ZoomOut:",{that:this,updateData})
133
         updateData(null);
155
         updateData(null);
134
       }}
156
       }}
135
       size="small"
157
       size="small"
184
   bounds: [number, number, number, number],
206
   bounds: [number, number, number, number],
185
   viewportDimensions: { width: number; height: number },
207
   viewportDimensions: { width: number; height: number },
186
 ) => {
208
 ) => {
209
+  // const _ZOOM_STEP
210
+  var _ZOOM_STEP = ZOOM_STEP
211
+  if (window?.glob_dev_fns?.get_zoom_step){
212
+    _ZOOM_STEP=window.glob_dev_fns.get_zoom_step({that:this,bounds,viewportDimensions})
213
+  }
214
+
187
   const [x1, y1, x2, y2] = bounds;
215
   const [x1, y1, x2, y2] = bounds;
188
   const commonBoundsWidth = x2 - x1;
216
   const commonBoundsWidth = x2 - x1;
189
   const zoomValueForWidth = viewportDimensions.width / commonBoundsWidth;
217
   const zoomValueForWidth = viewportDimensions.width / commonBoundsWidth;
191
   const zoomValueForHeight = viewportDimensions.height / commonBoundsHeight;
219
   const zoomValueForHeight = viewportDimensions.height / commonBoundsHeight;
192
   const smallestZoomValue = Math.min(zoomValueForWidth, zoomValueForHeight);
220
   const smallestZoomValue = Math.min(zoomValueForWidth, zoomValueForHeight);
193
   const zoomAdjustedToSteps =
221
   const zoomAdjustedToSteps =
194
-    Math.floor(smallestZoomValue / ZOOM_STEP) * ZOOM_STEP;
222
+    Math.floor(smallestZoomValue / _ZOOM_STEP) * _ZOOM_STEP;
195
   const clampedZoomValueToFitElements = Math.min(
223
   const clampedZoomValueToFitElements = Math.min(
196
-    Math.max(zoomAdjustedToSteps, ZOOM_STEP),
197
-    1,
224
+    Math.max(zoomAdjustedToSteps, _ZOOM_STEP),
225
+    // 1,
198
   );
226
   );
199
   return clampedZoomValueToFitElements as NormalizedZoomValue;
227
   return clampedZoomValueToFitElements as NormalizedZoomValue;
200
 };
228
 };
285
   ),
313
   ),
286
   keyTest: (event) => event.altKey && event.shiftKey && event.code === CODES.D,
314
   keyTest: (event) => event.altKey && event.shiftKey && event.code === CODES.D,
287
 });
315
 });
316
+
317
+
318
+
319
+
320
+
321
+
322
+
323
+
324
+window.tmp_hooks ? tmp_hooks.actionZoomIn = actionZoomIn : 0
325
+window.tmp_hooks ? tmp_hooks.actionZoomOut = actionZoomOut : 0
326
+
327
+window.tmp_hooks ? tmp_hooks.ac = {
328
+// AppState,
329
+getDefaultAppState,
330
+getNormalizedZoom,
331
+centerScrollOn,
332
+getNewZoom,
333
+// NormalizedZoomValue,
334
+getShortcutKey,
335
+register,
336
+zoomValueToFitBoundsOnViewport,
337
+
338
+
339
+} : 0
340
+// tmp_hooks.ac2
341
+
342
+
343
+
344
+
345
+console.log("?QWERTYUIO")
346
+window.tmp_hooks ? tmp_hooks.ac2 = {}: 0

Loading…
Cancel
Save