ResizingTool$Typings extension
Properties
-
adornedObject
↔ GraphObject?
-
Gets the GraphObject that is being resized.
This may be the same object as the selected Part or it may be contained within that Part.
getter/setter pair
-
cellSize
↔ Size
-
Gets or sets the width and height multiples with which the user must resize.
The effective cell size is computed by first looking at the Adornment#adornedPart's Part#resizeCellSize.
If either or both of its width and height are
NaN
, it will use this property, cellSize
.
If either or both of this property's width and height are NaN
, it will
consider the Diagram#grid's Panel#gridCellSize.
getter/setter pair
-
dragsMembers
↔ bool
-
Gets or sets whether the ResizingTool moves the member Parts of a Group that has no Group#placeholder.
By default this property is true.
Setting this property does not raise any events.
getter/setter pair
-
handle
↔ GraphObject?
-
Returns the GraphObject that is the tool handle being dragged by the user.
This will be contained by an Adornment whose category is "ResizingTool".
Its Adornment#adornedObject is the same as the #adornedObject.
This is normally set by #doActivate, remembering the result of the call to Tool#findToolHandleAt.
getter/setter pair
-
handleArchetype
↔ GraphObject?
-
Gets or sets a small GraphObject that is copied as a resizing handle for the selected part.
By default this is a Shape that is a small blue rectangle.
Setting this property does not raise any events.
getter/setter pair
-
isGridSnapEnabled
↔ bool
-
Gets or sets whether the ResizingTool snaps object sizes to the diagram's background grid during the resize.
By default this property is false.
Setting this property does not raise any events.
getter/setter pair
-
maxSize
↔ Size
-
Gets or sets the maximum size to which the user can resize.
The effective maximum size is the minimum of this value and the GraphObject#maxSize,
independently in each direction.
getter/setter pair
-
minSize
↔ Size
-
Gets or sets the minimum size to which the user can resize.
The effective minimum size is the maximum of this value and the GraphObject#minSize,
independently in each direction.
getter/setter pair
-
oppositePoint
↔ Point
-
Gets the Point opposite to the chosen, dragged handle of the "Resizing" Adornment.
This property has no meaning until after #doActivate has been called.
getter/setter pair
-
originalDesiredSize
↔ Size
-
This read-only property returns the Size that was the original value of the GraphObject#desiredSize
of the element that is being resized.
getter/setter pair
-
originalLocation
↔ Point
-
This read-only property returns the Point that was the original value of the Part#location
of the Part that is being resized.
getter/setter pair
Methods
-
canStart()
→ bool
-
This tool may run when there is a mouse-down event on a resize handle,
the diagram is not read-only and it allows resizing,
the left mouse button is being used,
and this tool's adornment's resize handle is at the current mouse point.
-
computeCellSize()
→ Size
-
The size should be a multiple of the value returned by this method.
-
computeMaxSize()
→ Size
-
The effective maximum resizing size is the minimum of the #maxSize and the
#adornedObject's GraphObject#maxSize.
-
computeMinSize()
→ Size
-
The effective minimum resizing size is the maximum of #minSize and the
#adornedObject's GraphObject#minSize.
-
computeReshape()
→ bool
-
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.
-
computeResize(Point newPoint, Spot spot, Size min, Size max, Size cell, bool reshape)
→ Rect
-
Given a Spot in the original bounds of the object being resized and a new Point,
compute the new Rect.
-
doActivate()
→ void
-
Find the #handle, remember the object's original bounds,
save the results of calling #computeMinSize, #computeMaxSize, and #computeCellSize,
capture the mouse, and start a transaction.
-
doCancel()
→ void
-
Restore the original size of the GraphObject.
-
doDeactivate()
→ void
-
Stop the current transaction, forget the #handle and #adornedObject, and release the mouse.
-
doMouseMove()
→ void
-
Call #resize with a new size determined by the current mouse point.
This determines the new bounds by calling #computeResize.
-
doMouseUp()
→ void
-
Call #resize with the final bounds based on the most recent mouse point,
commit the transaction, and raise the "PartResized" DiagramEvent.
This determines the new bounds by calling #computeResize.
-
makeAdornment(GraphObject resizeObj)
→ Adornment?
-
(undocumented)
Create and return an Adornment that lets the user grab a handle to resize the selected part.
The Adornment will be a "Spot" Panel with a Placeholder and eight copies of #handleArchetype.
Each handle will have one of the standard Spots as their GraphObject#alignment.
-
resize(Rect newr)
→ void
-
Change the size of the selected part's Part#resizeObject to have the given bounds.
This modifies its GraphObject#desiredSize and maybe its Part#location.
-
stopTransaction()
→ bool
-
This calls the super Tool#stopTransaction method, and if the result is
true
,
attempts to optimize the transaction by removing all changes except the first and last
by calling Transaction#optimize.
-
updateAdornments(Part part)
→ void
-
Show an Adornment with the resize handles at points along the edge of the bounds of the
selected Part's Part#resizeObject.
-
updateResizeHandles(GraphObject elt, num angle)
→ void
-
(undocumented)
@expose
@param {GraphObject} elt
@param {number} angle