mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-01-28 07:03:17 +08:00
updated imageSquare shape
This commit is contained in:
parent
fd372941c7
commit
6a649d347d
@ -161,11 +161,9 @@ export const addVertex = function (
|
|||||||
if (!doc.label?.trim() && vertex.text === id) {
|
if (!doc.label?.trim() && vertex.text === id) {
|
||||||
vertex.text = '';
|
vertex.text = '';
|
||||||
}
|
}
|
||||||
if (doc?.constraint) {
|
}
|
||||||
vertex.constraint = doc.constraint;
|
if (doc?.constraint) {
|
||||||
} else {
|
vertex.constraint = doc.constraint;
|
||||||
vertex.constraint = 'off';
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (doc.w) {
|
if (doc.w) {
|
||||||
vertex.assetWidth = Number(doc.w);
|
vertex.assetWidth = Number(doc.w);
|
||||||
|
@ -26,10 +26,18 @@ export const imageSquare = async (
|
|||||||
const defaultWidth = flowchart?.wrappingWidth;
|
const defaultWidth = flowchart?.wrappingWidth;
|
||||||
node.defaultWidth = flowchart?.wrappingWidth;
|
node.defaultWidth = flowchart?.wrappingWidth;
|
||||||
|
|
||||||
const imageWidth = Math.max(
|
const imageRawWidth = Math.max(
|
||||||
node.label ? (defaultWidth ?? 0) : 0,
|
node.label ? (defaultWidth ?? 0) : 0,
|
||||||
node?.assetWidth ?? imageNaturalWidth
|
node?.assetWidth ?? imageNaturalWidth
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const imageWidth =
|
||||||
|
node.constraint === 'on'
|
||||||
|
? node?.assetHeight
|
||||||
|
? node.assetHeight * node.imageAspectRatio
|
||||||
|
: imageRawWidth
|
||||||
|
: imageRawWidth;
|
||||||
|
|
||||||
const imageHeight =
|
const imageHeight =
|
||||||
node.constraint === 'on'
|
node.constraint === 'on'
|
||||||
? imageWidth / node.imageAspectRatio
|
? imageWidth / node.imageAspectRatio
|
||||||
|
Loading…
x
Reference in New Issue
Block a user