返回介绍

tinymce-geom-Rect

发布于 2019-05-06 06:49:59 字数 4302 浏览 1015 评论 0 收藏 0

Methods

namesummarydefined 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):Rect

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

create(x:Number, y:Number, w:Number, h:Number):Rect

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

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):Rect

Creates 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):Rect

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

intersect(rect:Rect, cropRect:Rect):Rect

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

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文