DrawSquadCombat.js
import{CreateSquadCombat}from"./CreateSquadCombat";import createVertex from"@mapbox/mapbox-gl-draw/src/lib/create_vertex";const Constants=require("@mapbox/mapbox-gl-draw/src/constants");import*as CommonSelectors from"@mapbox/mapbox-gl-draw/src/lib/common_selectors";import isEventAtCoordinates from"@mapbox/mapbox-gl-draw/src/lib/is_event_at_coordinates";const doubleClickZoom={enable(t){setTimeout(()=>{t.map&&t.map.doubleClickZoom&&t._ctx&&t._ctx.store&&t._ctx.store.getInitialConfigValue&&t._ctx.store.getInitialConfigValue("doubleClickZoom")&&t.map.doubleClickZoom.enable()},0)},disable(t){setTimeout(()=>{t.map&&t.map.doubleClickZoom&&t.map.doubleClickZoom.disable()},0)}},DrawSquadCombat={onSetup:function(t){const e=this.newFeature({type:Constants.geojsonTypes.FEATURE,properties:{isSquadCombat:!0},geometry:{type:Constants.geojsonTypes.POLYGON,coordinates:[[]]}});return this.addFeature(e),this.clearSelectedFeatures(),doubleClickZoom.disable(this),this.updateUIClasses({mouse:Constants.cursors.ADD}),this.activateUIButton(Constants.types.POLYGON),this.setActionableState({trash:!0}),{squadCombat:e,currentVertexPosition:0}},onTap:function(t,e){t.squadCombat.properties.squadCombatPoint1&&this.onMouseMove(t,e),this.onClick(t,e)},onKeyUp:function(t,e){CommonSelectors.isEscapeKey(e)?(this.deleteFeature([t.squadCombat.id],{silent:!0}),this.changeMode(Constants.modes.SIMPLE_SELECT)):CommonSelectors