SVGPreserveAspectRatio - Web APIs 编辑

SVG preserveAspectRatio interface

The SVGPreserveAspectRatio interface corresponds to the preserveAspectRatio attribute, which is available for some of SVG's elements.

An SVGPreserveAspectRatio object can be designated as read only, which means that attempts to modify the object will result in an exception being thrown.

Interface overview

Also implementNone
MethodsNone
Properties
  • unsigned short align
  • unsigned short meetOrSlice
Constants
  • SVG_PRESERVEASPECTRATIO_UNKNOWN = 0
  • SVG_PRESERVEASPECTRATIO_NONE = 1
  • SVG_PRESERVEASPECTRATIO_XMINYMIN = 2
  • SVG_PRESERVEASPECTRATIO_XMIDYMIN = 3
  • SVG_PRESERVEASPECTRATIO_XMAXYMIN = 4
  • SVG_PRESERVEASPECTRATIO_XMINYMID = 5
  • SVG_PRESERVEASPECTRATIO_XMIDYMID = 6
  • SVG_PRESERVEASPECTRATIO_XMAXYMID = 7
  • SVG_PRESERVEASPECTRATIO_XMINYMAX = 8
  • SVG_PRESERVEASPECTRATIO_XMIDYMAX = 9
  • SVG_PRESERVEASPECTRATIO_XMAXYMAX = 10
  • SVG_MEETORSLICE_UNKNOWN = 0
  • SVG_MEETORSLICE_MEET = 1
  • SVG_MEETORSLICE_SLICE = 2
Normative documentSVG 1.1 (2nd Edition)

Constants

NameValueDescription
SVG_PRESERVEASPECTRATIO_UNKNOWN0The enumeration was set to a value that is not one of predefined types. It is invalid to attempt to define a new value of this type or to attempt to switch an existing value to this type.
SVG_PRESERVEASPECTRATIO_NONE1Corresponds to value none for attribute preserveAspectRatio.
SVG_PRESERVEASPECTRATIO_XMINYMIN2Corresponds to value xMinYMin for attribute preserveAspectRatio.
SVG_PRESERVEASPECTRATIO_XMIDYMIN3Corresponds to value xMidYMin for attribute preserveAspectRatio.
SVG_PRESERVEASPECTRATIO_XMAXYMIN4Corresponds to value xMaxYMin for attribute preserveAspectRatio.
SVG_PRESERVEASPECTRATIO_XMINYMID5Corresponds to value xMinYMid for attribute preserveAspectRatio.
SVG_PRESERVEASPECTRATIO_XMIDYMID6Corresponds to value xMidYMid for attribute preserveAspectRatio.
SVG_PRESERVEASPECTRATIO_XMAXYMID7Corresponds to value xMaxYMid for attribute preserveAspectRatio.
SVG_PRESERVEASPECTRATIO_XMINYMAX8Corresponds to value xMinYMax for attribute preserveAspectRatio.
SVG_PRESERVEASPECTRATIO_XMIDYMAX9Corresponds to value xMidYMax for attribute preserveAspectRatio.
SVG_PRESERVEASPECTRATIO_XMAXYMAX10Corresponds to value xMaxYMax for attribute preserveAspectRatio.
SVG_MEETORSLICE_UNKNOWN0The enumeration was set to a value that is not one of predefined types. It is invalid to attempt to define a new value of this type or to attempt to switch an existing value to this type.
SVG_MEETORSLICE_MEET1Corresponds to value meet for attribute preserveAspectRatio.
SVG_MEETORSLICE_SLICE2Corresponds to value slice for attribute preserveAspectRatio.

Properties

NameTypeDescription
alignunsigned shortThe type of the alignment value as specified by one of the SVG_PRESERVEASPECTRATIO_* constants defined on this interface.
meetOrSliceunsigned shortThe type of the meet-or-slice value as specified by one of the SVG_MEETORSLICE_* constants defined on this interface.

Exceptions on setting: a /wiki/en-US/docs/Web/API/DOMException with code NO_MODIFICATION_ALLOWED_ERR is raised on an attempt to change the value of an attribute on a read only object.

Methods

The SVGPreserveAspectRatio interface do not provide any specific methods.

Browser compatibility

BCD tables only load in the browser

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

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

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据

词条统计

浏览:122 次

字数:8124

最后编辑:8 年前

编辑次数:0 次

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文