fix: remove rounding to fix jitter when shift-editing (#5543)

Co-authored-by: Ryan Di <ryan.weihao.di@gmail.com>
This commit is contained in:
David Luzar 2022-08-05 16:52:46 +02:00 committed by GitHub
parent b818df1098
commit 45b592227d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 22 additions and 26 deletions

View file

@ -37,9 +37,7 @@ export const getPerfectElementSize = (
} else if (lockedAngle === Math.PI / 2) {
width = 0;
} else {
height =
Math.round(absWidth * Math.tan(lockedAngle)) * Math.sign(height) ||
height;
height = absWidth * Math.tan(lockedAngle) * Math.sign(height) || height;
}
} else if (elementType !== "selection") {
height = absWidth * Math.sign(height);
@ -76,8 +74,8 @@ export const getLockedLinearCursorAlignSize = (
const c2 = y - a2 * x;
// intersection of the two lines above
const intersectX = Math.round((b1 * c2 - b2 * c1) / (a1 * b2 - a2 * b1));
const intersectY = Math.round((c1 * a2 - c2 * a1) / (a1 * b2 - a2 * b1));
const intersectX = (b1 * c2 - b2 * c1) / (a1 * b2 - a2 * b1);
const intersectY = (c1 * a2 - c2 * a1) / (a1 * b2 - a2 * b1);
// delta
width = intersectX - originX;