NOTE: TinyMCE 5 reached End of Support in April 2023. No more bug fixes, security updates, or new features will be introduced to TinyMCE 5. We recommend you upgrade to TinyMCE 6 or consider TinyMCE 5 Long Term Support (LTS) if you need more time.
tinymce.geom.Rect
Contains various tools for rect/position calculation.
Methods
name | summary | defined by |
---|---|---|
clamp() | Returns a rect clamped within the specified clamp rect. This forces the rect to be inside the clamp rect. | tinymce.geom.Rect |
create() | Creates a new rectangle object. | tinymce.geom.Rect |
findBestRelativePosition() | Tests various positions to get the most suitable one. | tinymce.geom.Rect |
fromClientRect() | Creates a new rectangle object form a clientRects object. | tinymce.geom.Rect |
inflate() | Inflates the rect in all directions. | tinymce.geom.Rect |
intersect() | Returns the intersection of the specified rectangles. | tinymce.geom.Rect |
relativePosition() | Returns the rect positioned based on the relative position name to the target rect. | tinymce.geom.Rect |
Methods
clamp
Returns a rect clamped within the specified clamp rect. This forces the rect to be inside the clamp rect.
Parameters
- rect (Rect) - Rectangle to force within clamp rect.
- clampRect (Rect) - Rectable to force within.
- fixedSize (Boolean) - True/false if size should be fixed.
Return value
- Rect - Clamped rect.
create
Creates a new rectangle object.
Parameters
- x (Number) - Rectangle x location.
- y (Number) - Rectangle y location.
- w (Number) - Rectangle width.
- h (Number) - Rectangle height.
Return value
- Rect - New rectangle object.
findBestRelativePosition
Tests various positions to get the most suitable one.
Parameters
- rect (Rect) - Rect to use as source.
- targetRect (Rect) - Rect to move relative to.
- constrainRect (Rect) - Rect to constrain within.
- rels (Array) - Array of relative positions to test against.
fromClientRect
Creates a new rectangle object form a clientRects object.
Parameters
- clientRect (ClientRect) - DOM ClientRect object.
Return value
- Rect - New rectangle object.
inflate
Inflates the rect in all directions.
Parameters
- rect (Rect) - Rect to expand.
- w (Number) - Relative width to expand by.
- h (Number) - Relative height to expand by.
Return value
- Rect - New expanded rect.
intersect
Returns the intersection of the specified rectangles.
Parameters
- rect (Rect) - The first rectangle to compare.
- cropRect (Rect) - The second rectangle to compare.
Return value
- Rect - The intersection of the two rectangles or null if they don't intersect.
relativePosition
Returns the rect positioned based on the relative position name to the target rect.
Parameters
- rect (Rect) - Source rect to modify into a new rect.
- targetRect (Rect) - Rect to move relative to based on the rel option.
- rel (String) - Relative position. For example: tr-bl.
Can't find what you're looking for? Let us know.
Except as otherwise noted, the content of this page is licensed under the Creative Commons BY-NC-SA 3.0 License, and code samples are licensed under the Apache 2.0 License.