|
@@ -74,12 +74,28 @@ export const actionClearCanvas = register({
|
74
|
74
|
export const actionZoomIn = register({
|
75
|
75
|
name: "zoomIn",
|
76
|
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
|
89
|
const zoom = getNewZoom(
|
78
|
90
|
getNormalizedZoom(appState.zoom.value + ZOOM_STEP),
|
79
|
91
|
appState.zoom,
|
80
|
92
|
{ left: appState.offsetLeft, top: appState.offsetTop },
|
81
|
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
|
99
|
return {
|
84
|
100
|
appState: {
|
85
|
101
|
...appState,
|
|
@@ -95,6 +111,10 @@ export const actionZoomIn = register({
|
95
|
111
|
title={`${t("buttons.zoomIn")} — ${getShortcutKey("CtrlOrCmd++")}`}
|
96
|
112
|
aria-label={t("buttons.zoomIn")}
|
97
|
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
|
118
|
updateData(null);
|
99
|
119
|
}}
|
100
|
120
|
size="small"
|
|
@@ -130,6 +150,8 @@ export const actionZoomOut = register({
|
130
|
150
|
title={`${t("buttons.zoomOut")} — ${getShortcutKey("CtrlOrCmd+-")}`}
|
131
|
151
|
aria-label={t("buttons.zoomOut")}
|
132
|
152
|
onClick={() => {
|
|
153
|
+ window.tmp_hooks ? tmp_hooks.zoomOut_onclick = {that:this,updateData} : 0
|
|
154
|
+ console.log("xcal_dev ZoomOut:",{that:this,updateData})
|
133
|
155
|
updateData(null);
|
134
|
156
|
}}
|
135
|
157
|
size="small"
|
|
@@ -184,6 +206,12 @@ const zoomValueToFitBoundsOnViewport = (
|
184
|
206
|
bounds: [number, number, number, number],
|
185
|
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
|
215
|
const [x1, y1, x2, y2] = bounds;
|
188
|
216
|
const commonBoundsWidth = x2 - x1;
|
189
|
217
|
const zoomValueForWidth = viewportDimensions.width / commonBoundsWidth;
|
|
@@ -191,10 +219,10 @@ const zoomValueToFitBoundsOnViewport = (
|
191
|
219
|
const zoomValueForHeight = viewportDimensions.height / commonBoundsHeight;
|
192
|
220
|
const smallestZoomValue = Math.min(zoomValueForWidth, zoomValueForHeight);
|
193
|
221
|
const zoomAdjustedToSteps =
|
194
|
|
- Math.floor(smallestZoomValue / ZOOM_STEP) * ZOOM_STEP;
|
|
222
|
+ Math.floor(smallestZoomValue / _ZOOM_STEP) * _ZOOM_STEP;
|
195
|
223
|
const clampedZoomValueToFitElements = Math.min(
|
196
|
|
- Math.max(zoomAdjustedToSteps, ZOOM_STEP),
|
197
|
|
- 1,
|
|
224
|
+ Math.max(zoomAdjustedToSteps, _ZOOM_STEP),
|
|
225
|
+ // 1,
|
198
|
226
|
);
|
199
|
227
|
return clampedZoomValueToFitElements as NormalizedZoomValue;
|
200
|
228
|
};
|
|
@@ -285,3 +313,34 @@ export const actionToggleTheme = register({
|
285
|
313
|
),
|
286
|
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
|