@arcgis/map-components
Version:
ArcGIS Map Components
4 lines • 2.97 kB
JavaScript
/*! 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 */
import{a as f}from"./MZHKSD55.js";import b from"./2WKS6ZFG.js";import{e as g}from"./4TYQGSWG.js";import"./JDUE7Q24.js";import"./DXCYBWXJ.js";import{B as h,E as d,P as p,Q as e,S as r,U as z,a,j as l,k as u}from"./HX57SHRL.js";export default $arcgis.t(([{ignoreAbortErrors:b},{when:w},{a:y}])=>{var i={base:"arcgis-zoom",horizontalLayout:"arcgis-zoom--horizontal",button:"esri-widget--button",zoomIn:"arcgis-zoom__zoom-in",zoomOut:"arcgis-zoom__zoom-out"};function x(t){if(t.type==="3d")return!!t.ready;if(!t?.ready)return!1;let o=v(t),s=t.constraints?.effectiveMaxScale;return s===0||o>s}function I(t){if(t.type==="3d")return!!t.ready;if(!t?.ready)return!1;let o=v(t),s=t.constraints?.effectiveMinScale;return s===0||o<s}function v(t){let o=t?.animation?.target;return(o&&"then"in o?void 0:o?.scale)??t?.scale??0}var Z=l`{arcgis-zoom,.arcgis-zoom{display:flex;flex-flow:column nowrap;box-shadow:0 1px 2px #0000004d}.arcgis-zoom__zoom-out{border-block-start:solid 1px var(--calcite-color-border-1)}.arcgis-zoom--horizontal{flex-flow:row-reverse nowrap}.arcgis-zoom--horizontal .arcgis-zoom__zoom-out{border-block-start:none;border-inline-end:solid 1px var(--calcite-color-border-1)}}`,n=class extends p{constructor(){super(...arguments),this.messages=f({}),this.view=y(this),this.canZoomIn=!1,this.canZoomOut=!1,this.autoDestroyDisabled=!1,this.icon="magnifying-glass-plus",this.layout="vertical",this.position="top-left",this.state="disabled",this.arcgisPropertyChange=g()("state"),this.arcgisReady=h()}static{this.properties={canZoomIn:16,canZoomOut:16,autoDestroyDisabled:5,icon:1,label:1,layout:3,messageOverrides:0,position:1,referenceElement:1,state:3}}static{this.shadowRootOptions=d}static{this.styles=Z}async destroy(){await this.manager.destroy()}async zoomIn(){let{view:o}=this;!this.canZoomIn||!o||(o.type==="2d"?o.mapViewNavigation.zoomIn():b(o.goTo({zoomFactor:2})))}async zoomOut(){let{view:o}=this;!this.canZoomOut||!o||(o.type==="2d"?o.mapViewNavigation.zoomOut():b(o.goTo({zoomFactor:.5})))}loaded(){this.manager.onLifecycle(()=>[w(()=>this.view?.stationary,()=>{this.canZoomIn=x(this.view),this.canZoomOut=I(this.view)},{initial:!0}),w(()=>this.view?.ready?"ready":"disabled",o=>{this.state=o},{sync:!0,initial:!0})])}render(){let o={[i.horizontalLayout]:this.layout==="horizontal"},{canZoomIn:s,canZoomOut:O}=this,{zoomIn:c,zoomOut:m}=this.messages;return u`<div class=${e(a(i.base,o))}><calcite-button class=${e(a(i.button,i.zoomIn))} .disabled=${!s} icon-start=plus kind=neutral .label=${c} =${this.zoomIn} title=${c??r}></calcite-button><calcite-button class=${e(a(i.button,i.zoomOut))} .disabled=${!O} icon-start=minus kind=neutral .label=${m} =${this.zoomOut} title=${m??r}></calcite-button></div>`}};z("arcgis-zoom",n);return n},"core/promiseUtils","core/reactiveUtils",b)