update docs and verson

This commit is contained in:
ethan 2024-05-20 19:58:10 +08:00
parent c8b7d15d6e
commit 7f7d052901
5 changed files with 48 additions and 9 deletions

View File

@ -1,3 +1,27 @@
## 0.0.6
---
#### ✨ New Features
- 新增: 绘制扇形
- 新增: 根据数据回显图形
- 新增: 获取图形关键点位方法:`getPoints`
#### 🐞 Bug fixes
- 修复:绘制过程中临时创建的线没有被删除的问题
- 修复:双击控制点导致图形无法拖拽的问题
- 修复:双箭头执行生长动画后,编辑状态无法拖拽的问题
- 修复:双箭头整体被拖拽后生长动画路径不正确的问题
## 0.0.5
---

View File

@ -57,6 +57,7 @@ import CesiumPlot from 'cesium-plot-js';
| Reactangle | 'polygon' | 矩形 | ❌ |
| Triangle | 'polygon' | 三角形 | ❌ |
| Circle | 'polygon' | 圆形 | ❌ |
| Sector | 'polygon' | 扇形 | ❌ |
| StraightArrow | 'line' | 细直箭头 | ✔️ |
| CurvedArrow | 'line' | 曲线箭头 | ✔️ |
| FineArrow | 'polygon' | 直箭头 | ✔️ |
@ -119,6 +120,7 @@ const geometry = new CesiumPlot.FineArrow(Cesium, viewer, {
| hide | options?: [AnimationOpts](#AnimationOpts) | 隐藏options 可配置动画参数,参数缺省时,不显示动画 |
| show | options?: [AnimationOpts](#AnimationOpts) | 显示options 可配置动画参数,参数缺省时,不显示动画 |
| startGrowthAnimation | options?: [AnimationOpts](#AnimationOpts) | 生长动画options 可配置动画参数 |
| getPoints | | 获取图形关键点位 |
| remove | | 删除 |
| on | (event: [EventType](#EventType), listener: (eventData?: any) => void) | 绑定事件 |
| off | (event: [EventType](#EventType)) | 解绑事件 |
@ -145,6 +147,22 @@ geometry.on('drawEnd', (data)=>{
});
```
### 静态方法
**CesiumPlot.createGeometryFromData(cesium: Cesium, viewer: Cesium.Viewer, options:[CreateGeometryFromDataOpts](#CreateGeometryFromDataOpts))**
根据图形的关键点位重新生成图形
<h5 id='CreateGeometryFromDataOpts'>CreateGeometryFromDataOpts参数类型</h5>
```
{
type: 'FineArrow'|'AttackArrow'|'SwallowtailAttackArrow'|'SquadCombat'|'SwallowtailSquadCombat'|'StraightArrow'|'CurvedArrow'|'AssaultDirection'|'DoubleArrow'|'FreehandLine'|'FreehandPolygon'|'Curve'|'Ellipse'|'Lune'|'Reactangle'|'Triangle'|'Polygon'|'Circle'|'Sector', // 图形类型
cartesianPoints: Cesium.Cartesian3[], // 图形关键点位可通过实例方法getPoints或者drawEnd事件获得
style?: PolygonStyle | LineStyle // 样式
}
```
<h3 id='EventType'>Events</h3>
- **drawStart**

View File

@ -107,6 +107,11 @@ operationButtonGroup.onclick = (evt) => {
geometry = CesiumPlot.createGeometryFromData(Cesium, viewer, {
type: geometryType,
cartesianPoints: points,
style: {
material: Cesium.Color.fromCssColorString('rgba(59, 178, 208, 0.5)'),
outlineMaterial: Cesium.Color.fromCssColorString('rgba(59, 178, 208, 1)'),
outlineWidth: 3,
},
});
}
break;

View File

@ -64,14 +64,6 @@
<button id="Curve">曲线</button>
<button id="Ellipse">椭圆</button>
<button id="Lune">半月面</button>
<!-- <button id="hide">隐藏</button>
<button id="show">显示</button>
<button id="remove">删除</button>
<button id="addEvent">绑定事件</button>
<button id="removeEvent">解绑事件</button>
<button id="startGrowthAnimation">生长动画</button>
<button id="createGeometryFromData">根据数据生成图形</button>
<button id="cancelDraw">取消绘制</button> -->
</div>
<div class="button-container" id="operation-button-group" style="top: 50px;">
<button id="hide">隐藏</button>

View File

@ -1,6 +1,6 @@
{
"name": "cesium-plot-js",
"version": "0.0.5",
"version": "0.0.6",
"main": "dist/CesiumPlot.umd.js",
"homepage": "https://github.com/ethan-zf/cesium-plot-js",
"repository": {