xinrui-3d 1.0.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +32 -0
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -250,6 +250,38 @@ scene3d.replaceDeviceIcon('/resource/device/offline.png', 'code-1', {
250
250
  scene3d.replaceIcon(...args)
251
251
  ```
252
252
 
253
+ ## 运行时标签
254
+
255
+ ### createLabel
256
+
257
+ ```ts
258
+ scene3d.createLabel(component: Component, props?: object | (() => object), scale?: number): CSS3DSprite
259
+ ```
260
+
261
+ 创建一个基于 Vue 组件的 CSS3D 标签。
262
+
263
+ | 参数 | 类型 | 必选 | 描述 |
264
+ | --- | --- | --- | --- |
265
+ | component | Component | √ | Vue 组件。 |
266
+ | props | object \| (() => object) | | 传给 Vue 组件的属性;支持对象或返回对象的函数。 |
267
+ | scale | number | | CSS3DSprite 缩放比例。 |
268
+
269
+ 返回值为 `THREE` 的 `CSS3DSprite`,方法只负责创建标签对象,不会自动加入场景。调用方需要设置位置并添加到对应场景或分组。
270
+
271
+ 示例:
272
+
273
+ ```js
274
+ import DeviceLabel from './DeviceLabel.vue'
275
+
276
+ const label = scene3d.createLabel(DeviceLabel, {
277
+ name: '监控 1',
278
+ status: '在线'
279
+ }, 0.02)
280
+
281
+ label.position.set(x, y, z)
282
+ scene3d.scene.add(label)
283
+ ```
284
+
253
285
  ## 设备移动
254
286
 
255
287
  ### moveDeviceIcon
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "xinrui-3d",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "3D scene renderer for floor resources",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",