fix: remove angle flip

This commit is contained in:
Alex Kim 2023-02-16 20:23:42 +03:00
parent 9e1131cf42
commit 61d86b88eb
No known key found for this signature in database
GPG key ID: CEE74CFA44D238D7

View file

@ -631,7 +631,7 @@ export const resizeMultipleElements = (
}; };
// anchor point must be on the opposite side of the dragged selection handle // anchor point must be on the opposite side of the dragged selection handle
// or be the center of the selection if alt is pressed // or be the center of the selection if shouldResizeFromCenter
const [anchorX, anchorY]: Point = shouldResizeFromCenter const [anchorX, anchorY]: Point = shouldResizeFromCenter
? [midX, midY] ? [midX, midY]
: mapDirectionsToAnchors[direction]; : mapDirectionsToAnchors[direction];
@ -707,23 +707,10 @@ export const resizeMultipleElements = (
...rescaledPoints, ...rescaledPoints,
}; };
// don't flip text vertically
// flip a single image horizontally & vertically (angle & content)
// flip images in a multiple selection - only horizontally (angle)
// currently linear & free draw elements are not rotated
if (
isFlippedByY &&
!isTextElement(element) &&
!(isImageElement(element) && targetElements.length > 1) &&
!isLinearOrFreeDraw
) {
update.angle = normalizeAngle(Math.PI + angle);
}
if (isImageElement(element) && targetElements.length === 1) { if (isImageElement(element) && targetElements.length === 1) {
update.scale = [ update.scale = [
(element.scale[0] * flipFactorX * flipFactorY) as -1 | 1, (element.scale[0] * flipFactorX) as -1 | 1,
1, (element.scale[1] * flipFactorY) as -1 | 1,
]; ];
} }
@ -744,7 +731,7 @@ export const resizeMultipleElements = (
); );
if (!textMeasurements) { if (!textMeasurements) {
return; return; // FIXME
} }
if (isTextElement(element)) { if (isTextElement(element)) {
@ -758,7 +745,7 @@ export const resizeMultipleElements = (
boundTextUpdates = { angle, fontSize, baseline }; boundTextUpdates = { angle, fontSize, baseline };
} else { } else {
boundTextUpdates = { boundTextUpdates = {
angle: update.angle, angle,
fontSize: textMeasurements.size, fontSize: textMeasurements.size,
baseline: textMeasurements.baseline, baseline: textMeasurements.baseline,
}; };