mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-11-17 19:24:30 +01:00
fix: angles not flipping vertically when resizing
This commit is contained in:
@@ -52,6 +52,9 @@ import {
|
|||||||
import { getMaxContainerWidth } from "./newElement";
|
import { getMaxContainerWidth } from "./newElement";
|
||||||
|
|
||||||
export const normalizeAngle = (angle: number): number => {
|
export const normalizeAngle = (angle: number): number => {
|
||||||
|
if (angle < 0) {
|
||||||
|
return angle + 2 * Math.PI;
|
||||||
|
}
|
||||||
if (angle >= 2 * Math.PI) {
|
if (angle >= 2 * Math.PI) {
|
||||||
return angle - 2 * Math.PI;
|
return angle - 2 * Math.PI;
|
||||||
}
|
}
|
||||||
@@ -667,7 +670,10 @@ const resizeMultipleElements = (
|
|||||||
targetElements.forEach((element) => {
|
targetElements.forEach((element) => {
|
||||||
const width = element.orig.width * scale;
|
const width = element.orig.width * scale;
|
||||||
const height = element.orig.height * scale;
|
const height = element.orig.height * scale;
|
||||||
const angle = element.orig.angle * flipFactorX * flipFactorY;
|
const angle = normalizeAngle(
|
||||||
|
(isFlippedByY ? Math.PI - element.orig.angle : element.orig.angle) *
|
||||||
|
flipFactorX,
|
||||||
|
);
|
||||||
|
|
||||||
const hasPoints =
|
const hasPoints =
|
||||||
isLinearElement(element.orig) || isFreeDrawElement(element.orig);
|
isLinearElement(element.orig) || isFreeDrawElement(element.orig);
|
||||||
|
|||||||
Reference in New Issue
Block a user