MCPcopy Create free account
hub / github.com/NativeScript/SimDeck / applyZoom

Function applyZoom

packages/client/src/app/AppShell.tsx:2351–2374  ·  view source on GitHub ↗
(nextScale: number, nextPan?: Point, animate = true)

Source from the content-addressed store, hash-verified

2349 }
2350
2351 function applyZoom(nextScale: number, nextPan?: Point, animate = true) {
2352 const panForClamp = nextPan ?? {
2353 x: panRef.current.x,
2354 y: panRef.current.y + autoViewportOffsetY,
2355 };
2356 const clampedScale = clampZoom(nextScale, fitScale);
2357 const clampedPan = clampPan(
2358 panForClamp,
2359 clampedScale,
2360 canvasSize,
2361 effectiveDeviceNaturalSize,
2362 viewportChromeProfile,
2363 viewportRotationQuarterTurns,
2364 zoomDockReservedHeight,
2365 );
2366 effectiveZoomRef.current = clampedScale;
2367 panRef.current = clampedPan;
2368 if (animate) {
2369 beginZoomAnimation();
2370 }
2371 setViewMode("manual");
2372 setZoom(clampedScale);
2373 setPan(clampedPan);
2374 }
2375
2376 function applyZoomAtClientPoint(
2377 nextScale: number,

Callers 2

applyZoomAtClientPointFunction · 0.85
AppShellFunction · 0.85

Calls 3

clampZoomFunction · 0.90
clampPanFunction · 0.90
beginZoomAnimationFunction · 0.85

Tested by

no test coverage detected