I have several types of nodes and I would like to prevent overlapping them while they resize.
I would like to avoid overriding each’s object Resize method to prevent overlapping over surrounding nodes. Instead I would place a generic functionality to prevent this, in a custom resizing tool and override the ‘OnResize’ function. (of course I would use document’s ‘IsUnoccupied’ function to see if the new area is empty)
The problem is that I can’t find the final size of the CurrentObject in order to test for it.
The GoToolResizing provides a OriginalSize/Point but I would like to get the object’s current size in order to test for it.
Any help is greatly appreciated
Yes, that sounds right – if you can’t override GoObject.DoResize you should override GoToolResizing.DoResizing.
I guess the issue is if GoObject.ResizesRealtime is true or not in your application. If it were true, you could just look at the GoToolResizing.CurrentObject.Bounds.
So I infer that you aren’t doing realtime resizing of objects – the user sees a “box” that is resized, until the mouse up finishes the resizing. So to figure out the bounds for that “box”, you can call GoObject.ComputeResize.
GoToolResizing.DoResizing basically does:
GoInputEventArgs last = this.LastInput;
last.DocPoint = this.View.SnapPoint(last.DocPoint, this.CurrentObject);
last.ViewPoint = this.View.ConvertDocToView(last.DocPoint);
GoObject obj = this.CurrentObject;
evttype, this.MinimumSize, this.MaximumSize);
GoObject.DoResize calls ComputeResize as follows:
RectangleF box = ComputeResize(origRect, newPoint, whichHandle, min, max,
CanReshape() && view.CanReshapeObjects() && !view.LastInput.Shift);