This commit is contained in:
Tomas Richtar 2025-07-22 10:42:08 +02:00
parent ed42327ff5
commit 0df4c7777d

View File

@ -1,11 +1,10 @@
import { getArrowPolygon } from "athena-utils/shape/Arrow.js";
import {  ARROW_BODY_STYLE_CONSTANT, ARROW_BODY_STYLE_LINEAR, ARROW_BODY_STYLE_EXPONENTIAL  } from "athena-utils/shape/Arrow.js";
import { ARROW_BODY_STYLE_CONSTANT, ARROW_BODY_STYLE_LINEAR, ARROW_BODY_STYLE_EXPONENTIAL } from "athena-utils/shape/Arrow.js";
import { getFrontline } from "athena-utils/shape/Frontline.js";
import { LEFT_SIDE, RIGHT_SIDE, BOTH_SIDES } from "athena-utils/shape/Frontline.js";
const ARROW = "arrow";
const FRONTLINE = "frontline";
const ADDITIONAL_SIDE = "additionalSide"; // used for Id in BOTH_SIDES style
const DEFAULT_ARROW_PARAMS = {
@ -245,7 +244,7 @@ function DrawFrontline(coordinates, polygonId) {
}
function updatePolygonOnMap(prefix, polygonId, drawFunction, geojson, paintOptions) {
const layerId =  prefix + "-" + polygonId;
const layerId = prefix + "-" + polygonId;
if (map.getLayer(layerId)) map.removeLayer(layerId);
if (map.getSource(layerId)) map.removeSource(layerId);
@ -281,9 +280,8 @@ function drawOnMap(frontlineGeoJSON, id, paintOptions = {}) {
function handleDelete(polygonType)
{
if (!currentFeature) return;
   
const id = currentFeature.id;
const id = currentFeature.id;
draw.delete(id);
//ARROW
@ -308,7 +306,7 @@ function handleDelete(polygonType)
DeleteFromMap(frontlineLayerId, id);
}
   
hideArrowEditor();
hideFrontlineEditor();
}
@ -384,14 +382,11 @@ function updateButtonStyles() {
}
document.addEventListener('DOMContentLoaded', () => {
document.getElementById('removeArrow').addEventListener('click', () => {
   
handleDelete(ARROW);
});
document.getElementById('removeFrontline').addEventListener('click', () => {
   
handleDelete(FRONTLINE);
});
@ -418,7 +413,6 @@ document.addEventListener('DOMContentLoaded', () => {
'fill-opacity': opacity
};
arrowParamsMap.set(id, {
splineStep,
offsetDistance,
@ -563,6 +557,6 @@ document.addEventListener('DOMContentLoaded', () => {
currentDrawStyle = event.target.getAttribute('data-style');
updateButtonStyles();
});
updateButtonStyles();
});