SVGPreserveAspectRatio:meetOrSlice 属性
meetOrSlice
是 SVGPreserveAspectRatio
接口的一个只读属性,它反映了该接口中 SVG_MEETORSLICE_*
常量所指定的 meet-or-slice 值的类型。
值
以下之一:
SVGPreserveAspectRatio.SVG_MEETORSLICE_UNKNOWN
(0)SVGPreserveAspectRatio.SVG_MEETORSLICE_MEET
(1)SVGPreserveAspectRatio.SVG_MEETORSLICE_SLICE
(2)
示例
访问 meetOrSlice
属性
html
<svg
xmlns="http://www.w3.org/2000/svg"
width="400"
height="200"
preserveAspectRatio="xMidYMid slice">
<circle cx="100" cy="100" r="50" fill="blue" />
</svg>
js
const svgElement = document.querySelector("svg");
// Access the meetOrSlice property
console.log(svgElement.preserveAspectRatio.baseVal.meetOrSlice); // Output: 2 (SVG_MEETORSLICE_SLICE)
规范
规范 |
---|
Scalable Vector Graphics (SVG) 2 # __svg__SVGPreserveAspectRatio__meetOrSlice |
浏览器兼容性
加载中…