Proportionally resizing the node


When I resize any node , I am able to increase a node’s size both horizontally and vertically. It would be better to keep all the nodes size same.
How can I resize a node proportionally?


Hold down the Shift key?


Holding the shift key does not resize the node proportionally. It works the same as you resize with the mouse, i.e. I can resize it any way with respect to just height or just width.

I want to resize in such a way that when the height increases, the width should also increase (proportionally)

The below scenario is expected.

This is the output

As you can see, I am able to resize it anyway. I want to do it similar to the first scenario.


Sorry, I was too brief in my earlier reply.

Did you want the user to be able to control whether resizing should maintain aspect ratio, for example by holding down the Shift key? Or did you want resizing to always maintain aspect ratio? Or did you want to control it on a node-by-node basis, controlled by the model data?

All of these scenarios can be implemented by overriding ResizingTool.ComputeResize. Note the last argument, which controls whether the resizing computation may change the aspect ratio or not. Your override should call the base method with all of the same arguments, except you need to determine the value of that reshape argument to be whatever you want: perhaps always false, perhaps dependent on whether Keyboard.isKeyDown(Key.LeftShift) or Keyboard.isKeyDown(Key.RightShift) are true, or whether some property on the node data is true.