computeReshape method
Decide whether to allow arbitrary reshaping or whether to keep the same aspect ratio of the object being resized. If the #adornedObject is a Shape, then if the Shape#geometryStretch is GraphObject.Uniform, this method will return false to restrict reshaping to maintain the object's current ratio of height to width. Also, if the user is holding down the Shift key, this method will return false.
This is called on each mouse-move and on mouse-up; the result is passed to the call to #resize. This permits the user to change the behavior dynamically during resizing.
This method may be overridden. Please read the Introduction page on Extensions for how to override methods and how to call this base method.
For example, to always keep the object's original aspect ratio, override this method to return false. When initializing a Diagram:
const diagram = new go.Diagram, "myDiagramDiv"
{
"resizingTool.computeReshape": function() { return false; },
// ... rest of Diagram init
})
Or when overriding the method dynamically:
myDiagram.toolManager.resizingTool.computeReshape = function() { return false; }
Your override might want to look at the this.adornedObject.part.data
properties to decide whether to allow reshaping.
@expose
@return {boolean} true to allow any aspect ratio; false to preserve the #adornedObject's height/width ratio
@since 1.7
Implementation
_i2.bool computeReshape() => _i4.callMethod(
this,
'computeReshape',
[],
);