This is a migrated thread and some comments may be shown as answers.

Maintaining Aspect Ratio of Resized Images

1 Answer 142 Views
Diagram
This is a migrated thread and some comments may be shown as answers.
steve matheson
Top achievements
Rank 2
steve matheson asked on 19 Jul 2016, 04:45 AM

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?

1 Answer, 1 is accepted

Sort by
0
Vessy
Telerik team
answered on 21 Jul 2016, 09:12 AM
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.

Regards,
Vessy
Telerik by Progress
 
Get started with Kendo UI in days. Online training courses help you quickly implement components into your apps.
 
Tags
Diagram
Asked by
steve matheson
Top achievements
Rank 2
Answers by
Vessy
Telerik team
Share this question
or