SvgPathBindingHandler

创建用于单个 SVG 路径 DOM 元素的 Knockout 绑定处理器。 此绑定处理器将注册为 cesiumSvgPath。

此绑定的参数是一个具有以下属性的对象:

  • path: SVG 路径字符串。
  • width: 未应用变换时 SVG 路径的宽度。
  • height: 未应用变换时 SVG 路径的高度。
  • css: 可选。包含要应用于 SVG 的额外 CSS 类的字符串。始终会应用 'cesium-svgPath-svg'。
Example:
// 在 div 内创建 SVG
<div data-bind="cesiumSvgPath: { path: 'M 100 100 L 300 100 L 200 300 z', width: 28, height: 28 }"></div>

// 参数可以来自视图模型的 observable
<div data-bind="cesiumSvgPath: { path: currentPath, width: currentWidth, height: currentHeight }"></div>

// 或整个对象可以来自视图模型的 observable
<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.