Remove last get/setTransform (#964)
My original hack to put the scale when we create the canvas element doesn't make much sense. It should be done when we are rendering the scene. I moved it there in this PR. The rest was all about forwarding the scale to where it's needed.
This commit is contained in:
committed by
GitHub
parent
79ea76b48b
commit
2937efacde
@ -157,8 +157,9 @@ export function viewportCoordsToSceneCoords(
|
||||
zoom: number;
|
||||
},
|
||||
canvas: HTMLCanvasElement | null,
|
||||
scale: number,
|
||||
) {
|
||||
const zoomOrigin = getZoomOrigin(canvas);
|
||||
const zoomOrigin = getZoomOrigin(canvas, scale);
|
||||
const clientXWithZoom = zoomOrigin.x + (clientX - zoomOrigin.x) / zoom;
|
||||
const clientYWithZoom = zoomOrigin.y + (clientY - zoomOrigin.y) / zoom;
|
||||
|
||||
@ -180,8 +181,9 @@ export function sceneCoordsToViewportCoords(
|
||||
zoom: number;
|
||||
},
|
||||
canvas: HTMLCanvasElement | null,
|
||||
scale: number,
|
||||
) {
|
||||
const zoomOrigin = getZoomOrigin(canvas);
|
||||
const zoomOrigin = getZoomOrigin(canvas, scale);
|
||||
const sceneXWithZoomAndScroll =
|
||||
zoomOrigin.x - (zoomOrigin.x - sceneX - scrollX) * zoom;
|
||||
const sceneYWithZoomAndScroll =
|
||||
|
Reference in New Issue
Block a user