@arcgis/map-components
Version:
ArcGIS Map Components
69 lines (68 loc) • 6.55 kB
JavaScript
import { c as l } from "../../chunks/runtime.js";
import { usePropertyChange as o } from "@arcgis/lumina/controllers";
import { reEmitEvent as i } from "@arcgis/lumina/controllers/accessor";
import a from "@arcgis/core/layers/GraphicsLayer.js";
import n from "@arcgis/core/widgets/Sketch.js";
import { LitElement as h, createEvent as d, noShadowRoot as r } from "@arcgis/lumina";
import { m as g } from "../../chunks/useWidget.js";
import { css as p } from "@lit/reactive-element/css-tag.js";
import { watch as c } from "@arcgis/core/core/reactiveUtils.js";
/*! All material copyright Esri, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
v4.33.13 */
const m = p`{arcgis-sketch{display:block}}`, y = g(n);
class w extends h {
constructor() {
super(), this.widget = y(this), this.viewModel = this.widget.viewModel, this._defaultGraphicsLayer = null, this.activeTool = this.widget.activeTool, this.autoDestroyDisabled = !1, this.availableCreateTools = this.widget.availableCreateTools, this.createGraphic = this.widget.createGraphic, this.creationMode = this.widget.creationMode, this.defaultCreateOptions = this.widget.defaultCreateOptions, this.defaultGraphicsLayerDisabled = !1, this.defaultUpdateOptions = this.widget.defaultUpdateOptions, this.hideCreateToolsCircle = this.widget.visibleElements.createTools.circle, this.hideCreateToolsPoint = this.widget.visibleElements.createTools.point, this.hideCreateToolsPolygon = this.widget.visibleElements.createTools.polygon, this.hideCreateToolsPolyline = this.widget.visibleElements.createTools.polyline, this.hideCreateToolsRectangle = this.widget.visibleElements.createTools.rectangle, this.hideDuplicateButton = this.widget.visibleElements.duplicateButton, this.hideDeleteButton = this.widget.visibleElements.deleteButton, this.hideSelectionCountLabel = this.widget.visibleElements.selectionCountLabel, this.hideLabelsToggle = this.widget.visibleElements.labelsToggle, this.hideSelectionToolsLassoSelection = this.widget.visibleElements.selectionTools["lasso-selection"], this.hideSelectionToolsRectangleSelection = this.widget.visibleElements.selectionTools["rectangle-selection"], this.hideSettingsMenu = this.widget.visibleElements.settingsMenu, this.hideSnappingControls = this.widget.visibleElements.snappingControls, this.hideSnappingControlsElementsEnabledToggle = this.widget.visibleElements.snappingControlsElements.enabledToggle, this.hideSnappingControlsElementsFeatureEnabledToggle = this.widget.visibleElements.snappingControlsElements.featureEnabledToggle, this.hideSnappingControlsElementsLayerList = this.widget.visibleElements.snappingControlsElements.layerList, this.hideSnappingControlsElementsSelfEnabledToggle = this.widget.visibleElements.snappingControlsElements.selfEnabledToggle, this.hideTooltipsToggle = this.widget.visibleElements.tooltipsToggle, this.hideUndoRedoMenu = this.widget.visibleElements.undoRedoMenu, this.icon = this.widget.icon, this.label = this.widget.label, this.labelOptions = this.widget.labelOptions, this.layer = this.widget.layer, this.layout = this.widget.layout, this.pointSymbol = this.viewModel.pointSymbol, this.polygonSymbol = this.viewModel.polygonSymbol, this.polylineSymbol = this.viewModel.polylineSymbol, this.position = "bottom-left", this.scale = this.widget.scale, this.toolbarKind = this.widget.toolbarKind, this.showSnappingControlsElementsHeader = this.widget.visibleElements.snappingControlsElements.header, this.snappingOptions = this.widget.snappingOptions, this.state = this.widget.state, this.tooltipOptions = this.widget.tooltipOptions, this.updateGraphics = this.widget.updateGraphics, this.arcgisCreate = i(() => this.widget, "create"), this.arcgisDelete = i(() => this.widget, "delete"), this.arcgisPropertyChange = o()("state"), this.arcgisReady = d(), this.arcgisRedo = i(() => this.widget, "redo"), this.arcgisUndo = i(() => this.widget, "undo"), this.arcgisUpdate = i(() => this.widget, "update"), this.listen("arcgisReady", this._arcgisReadyHandler);
}
static {
this.properties = { activeTool: 3, autoDestroyDisabled: 5, availableCreateTools: 0, createGraphic: 0, creationMode: 1, defaultCreateOptions: 0, defaultGraphicsLayerDisabled: 5, defaultUpdateOptions: 0, hideCreateToolsCircle: 5, hideCreateToolsPoint: 5, hideCreateToolsPolygon: 5, hideCreateToolsPolyline: 5, hideCreateToolsRectangle: 5, hideDuplicateButton: 5, hideDeleteButton: 5, hideSelectionCountLabel: 5, hideLabelsToggle: 5, hideSelectionToolsLassoSelection: 5, hideSelectionToolsRectangleSelection: 5, hideSettingsMenu: 5, hideSnappingControls: 5, hideSnappingControlsElementsEnabledToggle: 5, hideSnappingControlsElementsFeatureEnabledToggle: 5, hideSnappingControlsElementsLayerList: 5, hideSnappingControlsElementsSelfEnabledToggle: 5, hideTooltipsToggle: 5, hideUndoRedoMenu: 5, icon: 1, label: 1, labelOptions: 0, layer: 0, layout: 1, pointSymbol: 0, polygonSymbol: 0, polylineSymbol: 0, position: 1, referenceElement: 1, scale: 1, toolbarKind: 1, showSnappingControlsElementsHeader: 5, snappingOptions: 0, state: 3, tooltipOptions: 0, updateGraphics: 0 };
}
static {
this.shadowRootOptions = r;
}
static {
this.styles = m;
}
async cancel() {
this.widget?.cancel();
}
async complete() {
this.widget?.complete();
}
async create(t, e) {
await this.widget?.create(t, e);
}
async delete() {
this.widget?.delete();
}
async destroy() {
await this.manager.destroy();
}
async duplicate() {
this.widget?.duplicate();
}
async redo() {
this.widget?.redo();
}
async triggerUpdate(t, e) {
this.widget?.update(t, e);
}
async undo() {
this.widget?.undo();
}
_arcgisReadyHandler() {
this.defaultGraphicsLayerDisabled || (this._defaultGraphicsLayer = new a({ title: "Sketch Layer" }), this.widget.layer = this._defaultGraphicsLayer, this.el.view?.map?.add(this.widget.layer), this.manager.onLifecycle(() => c(() => this.el.view?.map, (t, e) => {
if (this.widget.layer !== this._defaultGraphicsLayer)
return;
const s = this._defaultGraphicsLayer;
e?.allLayers.includes(s) && e.allLayers.remove(s), t?.add(s);
})), this.manager.onDestroy(() => {
this._defaultGraphicsLayer && this.el.view?.map?.allLayers.includes(this._defaultGraphicsLayer) && this.el.view?.map?.remove(this._defaultGraphicsLayer), this._defaultGraphicsLayer?.destroy(), this._defaultGraphicsLayer = null;
}));
}
}
l("arcgis-sketch", w);
export {
w as ArcgisSketch
};