fix: sceneCoordsToViewportCoords, jumping text when there is an offset (#4413) (#4630)

Co-authored-by: Aakansha Doshi <aakansha1216@gmail.com>
Co-authored-by: David Luzar <luzar.david@gmail.com>
Co-authored-by: thxnder <tswwe@qq.com>
This commit is contained in:
zsviczian 2022-01-29 14:27:03 +01:00 committed by GitHub
parent ca89d47d4c
commit e4edda4555
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 28 deletions

View file

@ -244,8 +244,8 @@ export const sceneCoordsToViewportCoords = (
scrollY: number;
},
) => {
const x = (sceneX + scrollX + offsetLeft) * zoom.value + zoom.translation.x;
const y = (sceneY + scrollY + offsetTop) * zoom.value + zoom.translation.y;
const x = (sceneX + scrollX) * zoom.value + zoom.translation.x + offsetLeft;
const y = (sceneY + scrollY) * zoom.value + zoom.translation.y + offsetTop;
return { x, y };
};