0

In diagrams.net (formerly known as draw.io), I can easily group an image and label together. There are even built-in shapes which accomplish this. For example:

good_resize

I would like to resize the shape, such that:

  • The image continues to fill the container
  • The space between the label and image remain constant
  • The font-size of the label remains constant

However, even when holding shift to keep the aspect-ratio, the image remains the same size with awkward whitespace occurring:

bad_resize

How do I achieve the desired resizing? This seems possible in other diagramming software, such as whimsical.com.

Here is the full diagram code:

<mxGraphModel dx="782" dy="447" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="827" pageHeight="1169" math="0" shadow="0">
  <root>
    <mxCell id="0" />
    <mxCell id="1" parent="0" />
    <mxCell id="agnOd5MOz-EUEwHnS-w4-2" value="Label" style="label;whiteSpace=wrap;html=1;align=center;verticalAlign=bottom;spacingLeft=0;spacingBottom=4;imageAlign=center;imageVerticalAlign=top;image=img/clipart/Gear_128x128.png" parent="1" vertex="1">
      <mxGeometry x="110" y="40" width="80" height="80" as="geometry" />
    </mxCell>
  </root>
</mxGraphModel>
0

Create two shapes, the rectangle and the image (child). Now for the child shape enable the resizeWidth and resizeHeight properties.

Try entering this example as the diagram: https://pastebin.com/ayBstZ14

0

If you tick "Constrain proportion" (can be seen in Arrange tab on the right when a shape is selected), does it help?

If not, could you copy/paste diagram data so it can be tested directly? You can make a test diagram only with shapes in question (just click Extras > Edit diagram and copy/paste the code).

1
  • Constraining the diagram has the same effect as holding down shift, which unfortunately does not solve my problem. – Seanny123 Jun 11 '20 at 14:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.