the editable site (validation-lab)

This commit is contained in:
kpgarrod committed 2026-11-21 08:03:55 +01:00
commit 3ac81d5a52
13454 files changed
+2227005

No files matched your search

+2
View File
@@ -0,0 +1,2 @@
function t(){return t=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var i=arguments[e];for(var o in i)({}).hasOwnProperty.call(i,o)&&(t[o]=i[o])}return t},t.apply(null,arguments)}const e="draw",i="edit",o="deleteCoordinate",n="insertMidpoint";var s;!function(t){t.Commit="commit",t.Provisional="provisional",t.Finish="finish"}(s||(s={}));const r="https://raw.githubusercontent.com/JamesLMilner/terra-draw/refs/heads/main/assets/markers/marker-blue.png",a={SELECTED:"selected",MID_POINT:"midPoint",SELECTION_POINT_FEATURE_ID:"selectionPointFeatureId",SELECTION_POINT:"selectionPoint"},d={MODE:"mode",CURRENTLY_DRAWING:"currentlyDrawing",EDITED:"edited",CLOSING_POINT:"closingPoint",SNAPPING_POINT:"snappingPoint",COORDINATE_POINT:"coordinatePoint",COORDINATE_POINT_FEATURE_ID:"coordinatePointFeatureId",COORDINATE_POINT_IDS:"coordinatePointIds",PROVISIONAL_COORDINATE_COUNT:"provisionalCoordinateCount",COMMITTED_COORDINATE_COUNT:"committedCoordinateCount",MARKER:"marker"},h=10,l=20,u=30;function c(t){return Boolean(t&&"object"==typeof t&&null!==t&&!Array.isArray(t))}function p(t){return Boolean(t&&"object"==typeof t&&"properties"in t&&"object"==typeof t.properties&&null!==t.properties&&"mode"in t.properties)}function g(t){return!!function(t){return"number"==typeof t&&!isNaN(new Date(t).valueOf())}(t)}const y="Feature is not a Polygon",m="Feature mode property does not match the mode being added to",f=t=>"number"==typeof t&&t>=0&&Number.isFinite(t),C=t=>"boolean"==typeof t,P=t=>null===t,v=t=>"object"==typeof t&&null!==t,I=t=>"string"==typeof t&&t.length>0,S=t=>"click-move"===t||"click-drag"===t||"click-move-or-drag"===t;var F;!function(t){t.Drawing="drawing",t.Select="select",t.Static="static",t.Render="render"}(F||(F={}));const O={rightClick:!0,contextMenu:!1,leftClick:!0,onDragStart:!0,onDrag:!0,onDragEnd:!0};class x{get state(){return this._state}set state(t){throw new Error("Please use the modes lifecycle methods")}get styles(){return this._styles}set styles(t){if("object"!=typeof t)throw new Error("Styling must be an object");this.onStyleChange&&this.onStyleChange([],"styling"),this._styles=t}registerBehaviors(t){}constructor(e,i=!1){this._state="unregistered",this._styles={},this.pointerEvents=O,this.behaviors=[],this.validate=void 0,this.pointerDistance=40,this.coordinatePrecision=void 0,this.undoRedoMaxStackSize=void 0,this.onStyleChange=void 0,this.store=void 0,this.projection="web-mercator",this.setDoubleClickToZoom=void 0,this.unproject=void 0,this.project=void 0,this.setCursor=void 0,this.isInitialUpdate=!1,this.type=F.Drawing,this.mode="base",i?this.isInitialUpdate=!0:this.updateOptions(t({},e))}updateOptions(e){v(null==e?void 0:e.styles)&&(this.styles=t({},this._styles,e.styles)),f(null==e?void 0:e.pointerDistance)&&(this.pointerDistance=e.pointerDistance),"function"==typeof(null==e?void 0:e.validation)&&(this.validate=e.validation),I(null==e?void 0:e.projection)&&(this.projection=e.projection),v(null==e?void 0:e.pointerEvents)&&(this.pointerEvents=e.pointerEvents),I(null==e?void 0:e.modeName)&&!0===this.isInitialUpdate&&(this.mode=e.modeName),this.isInitialUpdate=!1}allowPointerEvent(t,e){return"boolean"==typeof t?t:"function"!=typeof t||t(e)}setDrawing(){if("started"!==this._state)throw new Error("Mode must be unregistered or stopped to start");this._state="drawing"}setStarted(){if("stopped"!==this._state&&"registered"!==this._state&&"drawing"!==this._state&&"selecting"!==this._state)throw new Error("Mode must be unregistered or stopped to start");this._state="started",this.setDoubleClickToZoom(!1)}setStopped(){if("started"!==this._state)throw new Error("Mode must be started to be stopped");this._state="stopped",this.setDoubleClickToZoom(!0)}register(t){if("unregistered"!==this._state)throw new Error("Can not register unless mode is unregistered");this._state="registered",this.store=t.store,this.store.registerOnChange(t.onChange),this.setDoubleClickToZoom=t.setDoubleClickToZoom,this.project=t.project,this.unproject=t.unproject,this.onSelect=t.onSelect,this.onDeselect=t.onDeselect,this.setCursor=t.setCursor,this.onStyleChange=t.onChange,this.onFinish=t.onFinish,this.coordinatePrecision=t.coordinatePrecision,this.undoRedoMaxStackSize=t.undoRedoMaxStackSize,this.registerBehaviors({mode:t.mode,store:this.store,project:this.project,unproject:this.unproject,pointerDistance:this.pointerDistance,coordinatePrecision:t.coordinatePrecision,projection:this.projection,undoRedoMaxStackSize:t.undoRedoMaxStackSize})}validateFeature(t){return this.performFeatureValidation(t)}afterFeatureAdded(t){}afterFeatureUpdated(t){}performFeatureValidation(t){if("unregistered"===this._state)throw new Error("Mode must be registered");const e=function(t,e){let i;if(c(t))if(null==t.id)i="Feature has no id";else if("string"!=typeof t.id&&"number"!=typeof t.id)i="Feature must be string or number as per GeoJSON spec";else if(e(t.id))if(c(t.geometry))if(c(t.properties))if("string"==typeof t.geometry.typeLine truncated
//# sourceMappingURL=terra-draw.modern.js.map