當前位置: 首頁>>編程示例 >>用法及示例精選 >>正文


JavaScript ArcGIS SegmentDrawAction cursor-update事件用法及代碼示例

基本信息

以下是所在類或對象的基本信息。

AMD: require(["esri/views/draw/SegmentDrawAction"], (SegmentDrawAction) => { /* code goes here */ });

ESM: import SegmentDrawAction from "@arcgis/core/views/draw/SegmentDrawAction";

類: esri/views/draw/SegmentDrawAction

繼承: SegmentDrawAction > DrawAction > Accessor

自從:用於 JavaScript 4.7 的 ArcGIS API

用法說明

SegmentDrawAction cursor-update事件的定義如下:

cursor-update


在指針在視圖上移動後觸發。

屬性:

類型說明
vertices Number[][]

一個二維數字數組,表示構成幾何的每個頂點的坐標。

vertexIndex Number

添加到頂點數組的最後一個頂點的索引。

preventDefault Function

防止事件傳播在事件鏈上冒泡。

defaultPrevented Boolean

調用 preventDefault() 時設置為 true。

type String

事件的類型。

值永遠是"cursor-update".

例子:

// listen to SegmentDrawAction.cursor-update
// give a visual feedback to the user on the view
// as user moving the pointer.
action.on("cursor-update", function (evt) {
  view.graphics.removeAll();
  let polygon = new Polygon({
    rings: evt.vertices,
    spatialReference: view.spatialReference
  });
  graphic = createGraphic(polygon);
  view.graphics.add(graphic);
});

相關用法


注:本文由純淨天空篩選整理自arcgis.com大神的英文原創作品 SegmentDrawAction cursor-update event。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。