mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
init width and height when dragging to create img
This commit is contained in:
parent
06a7a51baa
commit
afdf38e47c
1 changed files with 10 additions and 0 deletions
|
@ -16,6 +16,7 @@ import {
|
|||
isArrowElement,
|
||||
isElbowArrow,
|
||||
isFrameLikeElement,
|
||||
isImageElement,
|
||||
isTextElement,
|
||||
} from "./typeChecks";
|
||||
import { getFontString } from "../utils";
|
||||
|
@ -258,6 +259,14 @@ export const dragNewElement = ({
|
|||
}
|
||||
|
||||
if (width !== 0 && height !== 0) {
|
||||
let imageInitialDimension = null;
|
||||
if (isImageElement(newElement)) {
|
||||
imageInitialDimension = {
|
||||
initialWidth: width,
|
||||
initialHeight: height,
|
||||
};
|
||||
}
|
||||
|
||||
mutateElement(
|
||||
newElement,
|
||||
{
|
||||
|
@ -266,6 +275,7 @@ export const dragNewElement = ({
|
|||
width,
|
||||
height,
|
||||
...textAutoResize,
|
||||
...imageInitialDimension,
|
||||
},
|
||||
informMutation,
|
||||
);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue