此页面由社区从英文翻译而来。了解更多并加入 MDN Web Docs 社区。

View in English Always switch to English

zoomAndPan

Deprecated

Avoid using this feature in new projects. SVG 2 omittted some parts of SVG 1.1 to "improv[e] the usability and precision of the language." This feature may be a candidate for removal from web standards or browsers.

Consider using the following features instead: SVG@font-face.

zoomAndPan 属性指定 SVG 文档是否可以被放大和平移。

此语境中的放大是指对最外层 SVG 文档片段施加附加的缩放与平移变换所产生的效果。

平移表示响应用户界面操作而对 SVG 文档片段施加的平移(即移位)变换。

你可以和下面的 SVG 元素一起使用该属性:

示例

html
<svg
  viewBox="0 0 200 200"
  xmlns="http://www.w3.org/2000/svg"
  zoomAndPan="disable">
  <filter id="diffuseLighting" x="0" y="0" width="100%" height="100%">
    <feDiffuseLighting in="SourceGraphic" zoomAndPan="1">
      <fePointLight x="60" y="60" z="20" />
    </feDiffuseLighting>
  </filter>

  <rect x="0" y="0" width="200" height="200" filter="url(#diffuseLighting)" />
</svg>

使用说明

disable | magnify
默认值 magnify
动画性

规范

规范
Scalable Vector Graphics (SVG) 1.1 (Second Edition)
# ZoomAndPanAttribute

浏览器兼容性

svg.elements.svg.zoomAndPan

svg.elements.view.zoomAndPan