English中文

SvgPathBindingHandler

为单个 SVG 路径创建 DOM 元素的 Knockout 绑定处理程序。该绑定处理程序将注册为 cesiumSvgPath。 A Knockout binding handler that creates a DOM element for a single SVG path. This binding handler will be registered as cesiumSvgPath.

此绑定的参数是具有以下属性的对象: The parameter to this binding is an object with the following properties:

  • 路径:字符串形式的 SVG 路径。 path: The SVG path as a string.
  • width:未应用转换的 SVG 路径的宽度。 width: The width of the SVG path with no transformations applied.
  • height:未应用转换的 SVG 路径的高度。 height: The height of the SVG path with no transformations applied.
  • css:可选。包含要应用于 SVG 的附加 CSS 类的字符串。始终应用“cesium-svgPath-svg”。 css: Optional. A string containing additional CSS classes to apply to the SVG. 'cesium-svgPath-svg' is always applied.
示例: Example:
// Create an SVG as a child of a div
<div data-bind="cesiumSvgPath: { path: 'M 100 100 L 300 100 L 200 300 z', width: 28, height: 28 }"></div>

// parameters can be observable from the view model
<div data-bind="cesiumSvgPath: { path: currentPath, width: currentWidth, height: currentHeight }"></div>

// or the whole object can be observable from the view model
<div data-bind="cesiumSvgPath: svgPathOptions"></div>

方法 Methods

static Cesium.SvgPathBindingHandler.register()

需要帮助吗?获得答案的最快方法是从社区和团队那里获得答案 Need help? The fastest way to get answers is from the community and team on the Cesium Forum.