updated imageSquare shape

This commit is contained in:
omkarht 2024-09-24 18:22:15 +05:30
parent fd372941c7
commit 6a649d347d
2 changed files with 12 additions and 6 deletions

View File

@ -161,11 +161,9 @@ export const addVertex = function (
if (!doc.label?.trim() && vertex.text === id) {
vertex.text = '';
}
if (doc?.constraint) {
vertex.constraint = doc.constraint;
} else {
vertex.constraint = 'off';
}
}
if (doc?.constraint) {
vertex.constraint = doc.constraint;
}
if (doc.w) {
vertex.assetWidth = Number(doc.w);

View File

@ -26,10 +26,18 @@ export const imageSquare = async (
const defaultWidth = flowchart?.wrappingWidth;
node.defaultWidth = flowchart?.wrappingWidth;
const imageWidth = Math.max(
const imageRawWidth = Math.max(
node.label ? (defaultWidth ?? 0) : 0,
node?.assetWidth ?? imageNaturalWidth
);
const imageWidth =
node.constraint === 'on'
? node?.assetHeight
? node.assetHeight * node.imageAspectRatio
: imageRawWidth
: imageRawWidth;
const imageHeight =
node.constraint === 'on'
? imageWidth / node.imageAspectRatio