UNPKG

@arcgis/core

Version:

ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API

3 lines (2 loc) 1.4 kB
/* COPYRIGHT Esri - https://js.arcgis.com/5.0.8/LICENSE.txt */ import{__decorate as e}from"tslib";import{watch as t,sync as n,syncAndInitial as a}from"../../../core/reactiveUtils.js";import{property as i,subclass as s}from"../../../core/accessorSupport/decorators.js";import{PluginBase as r}from"./PluginBase.js";const o=Symbol("primary-vertex");let p=class extends r{constructor(){super(...arguments),this.completeOnDragEnd=!0}get helpMessageKey(){return this._interactiveHandle?.dragging?"freehandEnd":"freehandStart"}start(e){super.start(e);const{session:i,positionOfLastUserInput:s}=e;s&&i.appendOrReplacePoint(o,s),this._interactiveHandle||(this._interactiveHandle=e.createInteractiveHandle({defaultCaptureMode:"capture-when-engaged",snappingEnabled:!1,selfSnappingEnabled:!1},{disableDefaultXYFields:!0}),this.addHandles([t(()=>this._interactiveHandle?.outputMapPosition,e=>{e&&!this._isComplete&&this._session?.appendOrReplacePoint(o,e,{forceAppend:!!this._interactiveHandle?.dragging})},n)],this._ownHandlesKey),this.completeOnDragEnd&&this.addHandles(t(()=>this._interactiveHandle?.dragging,(t,n)=>{!t&&n&&e.requestComplete()},a),this._ownHandlesKey))}};e([i()],p.prototype,"_interactiveHandle",void 0),e([i()],p.prototype,"completeOnDragEnd",void 0),e([i()],p.prototype,"helpMessageKey",null),p=e([s("esri.views.draw.plugins.FreehandSegmentPlugin")],p);export{p as FreehandSegmentPlugin};