Maintaining Aspect Ratio of Resized Images

2 posts, 0 answers
  1. steve matheson
    steve matheson avatar
    28 posts
    Member since:
    Jul 2005

    Posted 18 Jul Link to this post

    I'm trying to figure out how to retain the aspect ratio of image elements that are resized.
    In principle it seems like this can be handled by setting the SVG image element's preserveAspectRatio property to "xMidYMid meet" or the like.
    I cant figure how to apply this property in the template (which would be the ideal place to apply it).

    I've tried manually applying the property after the itemboundschange but this doesnt seem to work until the diagram is reinitialized after a page refresh.

    Any suggestions?

  2. Vessy
    Vessy avatar
    1353 posts

    Posted 21 Jul Link to this post

    Hi steve,

    I am afraid that the desired functionality in currently not available in the diagram widget. Optionally, you can handle the Diagram's itemBoundsChange event and implement youр own logic for shape size recalculation, redrawing the Visual template of a shape depending on the changed size. This approach will need a good amount of custom logic, though, as you will need to consider different scenarios in which the size of the shape is actually changed (but not only dragged to a different position).

    In addition, you can also submit a feature request for such feature in our User Voice portal if you have some time, and our developers will consider its implementation depending on the items popularity.

    Telerik by Progress
    Get started with Kendo UI in days. Online training courses help you quickly implement components into your apps.
Back to Top