editPolyline.md 1.6 KB

折线编辑类 EditPolylineItem 示例

::: details 目录 [[toc]] :::

绘制示例

::: details 示例代码

<<< @/docs/.vuepress/components/edit/items/editpolyline/editpolyline.vue

:::

源代码

::: details 查看代码

<<< @/docs/guides/edit/items/src/EditLineItem.ts

:::

代码说明

1 当 EditPolylineItem 为编辑状态时,需要将 EditPolylineItem 赋给 grabItem

``` js {4} // 编辑状态时的 LineItem this.polylineItem = new EditPolylineItem(null); this.polylineItem.status = SItemStatus.Create; this.scene.grabItem = this.polylineItem;

### 2 当 EditPolylineItem 为正常状态时,需要将 grabItem 置为 null
``` js {4}
 // 正常状态时的 LineItem
 this.polylineItem = new EditPolylineItem(null);
 this.polylineItem.status = SItemStatus.Normal;
 this.scene.grabItem = null;

3 当 EditPolylineItem 为试图垂直水平绘制时需要修改 verAndLeve 属性

``` js {3} // 编辑状态时的 LineItem this.polylineItem = new EditPolylineItem(null,); this.polylineItem.status = SItemStatus.Create; this.polylineItem.verAndLeve = true; this.scene.grabItem = this.polylineItem;

### 4 当 EditPolylineItem 修改属性但是画板尚未变化时需要刷新
``` js {4}
 // 编辑状态时的 LineItem
 this.polylineItem = new EditPolylineItem(null);
 this.polylineItem.status = SItemStatus.Create;
 this.view.update();

5 当 EditPolylineItem 需要拖动时设置 moveable = true

js {4} // 编辑状态时的 LineItem this.polylineItem = new EditPolylineItem(null); this.polylineItem.status = SItemStatus.Create; this.polylineItem.moveable = true;