Use meta key + wheel to zoom in/out (#769)
This commit is contained in:
src
@ -27,4 +27,4 @@ export {
|
||||
hasText,
|
||||
} from "./comparisons";
|
||||
export { createScene } from "./createScene";
|
||||
export { getZoomOrigin, getZoomTranslation } from "./zoom";
|
||||
export { getZoomOrigin, getZoomTranslation, getNormalizedZoom } from "./zoom";
|
||||
|
@ -28,3 +28,9 @@ export function getZoomTranslation(canvas: HTMLCanvasElement, zoom: number) {
|
||||
y: parseFloat(diffMiddleOfTheCanvas.y.toFixed(8)),
|
||||
};
|
||||
}
|
||||
|
||||
export function getNormalizedZoom(zoom: number): number {
|
||||
const normalizedZoom = parseFloat(zoom.toFixed(2));
|
||||
const clampedZoom = Math.max(0.1, Math.min(normalizedZoom, 2));
|
||||
return clampedZoom;
|
||||
}
|
||||
|
Reference in New Issue
Block a user