tinymce-geom-Rect
优质
小牛编辑
127浏览
2023-12-01
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
clamp(rect:Rect, clampRect:Rect, fixedSize:Boolean):RectReturns 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
create(x:Number, y:Number, w:Number, h:Number):RectCreates 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
findBestRelativePosition(rect:Rect, targetRect:Rect, constrainRect:Rect, rels:Array)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
fromClientRect(clientRect:ClientRect):RectCreates a new rectangle object form a clientRects object.
Parameters
- clientRect (ClientRect) - DOM ClientRect object.
Return value
- Rect - New rectangle object.
inflate
inflate(rect:Rect, w:Number, h:Number):RectInflates 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
intersect(rect:Rect, cropRect:Rect):RectReturns 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
relativePosition(rect:Rect, targetRect:Rect, rel:String)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.