mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
scale embeddable and fix youtube start bug
This commit is contained in:
parent
23b24ea5c3
commit
e2982a2968
7 changed files with 31 additions and 13 deletions
|
@ -27,6 +27,7 @@ import {
|
|||
import {
|
||||
isArrowElement,
|
||||
isBoundToContainer,
|
||||
isEmbeddableElement,
|
||||
isFrameElement,
|
||||
isFreeDrawElement,
|
||||
isImageElement,
|
||||
|
@ -586,15 +587,24 @@ export const resizeSingleElement = (
|
|||
};
|
||||
|
||||
if ("scale" in element && "scale" in stateAtResizeStart) {
|
||||
mutateElement(element, {
|
||||
scale: [
|
||||
// defaulting because scaleX/Y can be 0/-0
|
||||
(Math.sign(newBoundsX2 - stateAtResizeStart.x) ||
|
||||
stateAtResizeStart.scale[0]) * stateAtResizeStart.scale[0],
|
||||
(Math.sign(newBoundsY2 - stateAtResizeStart.y) ||
|
||||
stateAtResizeStart.scale[1]) * stateAtResizeStart.scale[1],
|
||||
],
|
||||
});
|
||||
if (isEmbeddableElement(element) && shouldMaintainAspectRatio) {
|
||||
const scale: [number, number] = [
|
||||
eleNewWidth / (stateAtResizeStart.width / stateAtResizeStart.scale[0]),
|
||||
eleNewHeight /
|
||||
(stateAtResizeStart.height / stateAtResizeStart.scale[1]),
|
||||
];
|
||||
mutateElement(element, { scale });
|
||||
} else {
|
||||
mutateElement(element, {
|
||||
scale: [
|
||||
// defaulting because scaleX/Y can be 0/-0
|
||||
(Math.sign(newBoundsX2 - stateAtResizeStart.x) ||
|
||||
stateAtResizeStart.scale[0]) * stateAtResizeStart.scale[0],
|
||||
(Math.sign(newBoundsY2 - stateAtResizeStart.y) ||
|
||||
stateAtResizeStart.scale[1]) * stateAtResizeStart.scale[1],
|
||||
],
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
if (
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue