CleanUp
This commit is contained in:
parent
ed42327ff5
commit
0df4c7777d
18
Drawing.js
18
Drawing.js
@ -1,11 +1,10 @@
|
|||||||
import { getArrowPolygon } from "athena-utils/shape/Arrow.js";
|
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 { getFrontline } from "athena-utils/shape/Frontline.js";
|
||||||
import { LEFT_SIDE, RIGHT_SIDE, BOTH_SIDES } from "athena-utils/shape/Frontline.js";
|
import { LEFT_SIDE, RIGHT_SIDE, BOTH_SIDES } from "athena-utils/shape/Frontline.js";
|
||||||
|
|
||||||
const ARROW = "arrow";
|
const ARROW = "arrow";
|
||||||
const FRONTLINE = "frontline";
|
const FRONTLINE = "frontline";
|
||||||
|
|
||||||
const ADDITIONAL_SIDE = "additionalSide"; // used for Id in BOTH_SIDES style
|
const ADDITIONAL_SIDE = "additionalSide"; // used for Id in BOTH_SIDES style
|
||||||
|
|
||||||
const DEFAULT_ARROW_PARAMS = {
|
const DEFAULT_ARROW_PARAMS = {
|
||||||
@ -245,7 +244,7 @@ function DrawFrontline(coordinates, polygonId) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function updatePolygonOnMap(prefix, polygonId, drawFunction, geojson, paintOptions) {
|
function updatePolygonOnMap(prefix, polygonId, drawFunction, geojson, paintOptions) {
|
||||||
const layerId = prefix + "-" + polygonId;
|
const layerId = prefix + "-" + polygonId;
|
||||||
|
|
||||||
if (map.getLayer(layerId)) map.removeLayer(layerId);
|
if (map.getLayer(layerId)) map.removeLayer(layerId);
|
||||||
if (map.getSource(layerId)) map.removeSource(layerId);
|
if (map.getSource(layerId)) map.removeSource(layerId);
|
||||||
@ -281,9 +280,8 @@ function drawOnMap(frontlineGeoJSON, id, paintOptions = {}) {
|
|||||||
function handleDelete(polygonType)
|
function handleDelete(polygonType)
|
||||||
{
|
{
|
||||||
if (!currentFeature) return;
|
if (!currentFeature) return;
|
||||||
|
|
||||||
const id = currentFeature.id;
|
|
||||||
|
|
||||||
|
const id = currentFeature.id;
|
||||||
draw.delete(id);
|
draw.delete(id);
|
||||||
|
|
||||||
//ARROW
|
//ARROW
|
||||||
@ -308,7 +306,7 @@ function handleDelete(polygonType)
|
|||||||
|
|
||||||
DeleteFromMap(frontlineLayerId, id);
|
DeleteFromMap(frontlineLayerId, id);
|
||||||
}
|
}
|
||||||
|
|
||||||
hideArrowEditor();
|
hideArrowEditor();
|
||||||
hideFrontlineEditor();
|
hideFrontlineEditor();
|
||||||
}
|
}
|
||||||
@ -384,14 +382,11 @@ function updateButtonStyles() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
document.addEventListener('DOMContentLoaded', () => {
|
document.addEventListener('DOMContentLoaded', () => {
|
||||||
|
|
||||||
document.getElementById('removeArrow').addEventListener('click', () => {
|
document.getElementById('removeArrow').addEventListener('click', () => {
|
||||||
|
|
||||||
handleDelete(ARROW);
|
handleDelete(ARROW);
|
||||||
});
|
});
|
||||||
|
|
||||||
document.getElementById('removeFrontline').addEventListener('click', () => {
|
document.getElementById('removeFrontline').addEventListener('click', () => {
|
||||||
|
|
||||||
handleDelete(FRONTLINE);
|
handleDelete(FRONTLINE);
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -418,7 +413,6 @@ document.addEventListener('DOMContentLoaded', () => {
|
|||||||
'fill-opacity': opacity
|
'fill-opacity': opacity
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
arrowParamsMap.set(id, {
|
arrowParamsMap.set(id, {
|
||||||
splineStep,
|
splineStep,
|
||||||
offsetDistance,
|
offsetDistance,
|
||||||
@ -563,6 +557,6 @@ document.addEventListener('DOMContentLoaded', () => {
|
|||||||
currentDrawStyle = event.target.getAttribute('data-style');
|
currentDrawStyle = event.target.getAttribute('data-style');
|
||||||
updateButtonStyles();
|
updateButtonStyles();
|
||||||
});
|
});
|
||||||
updateButtonStyles();
|
|
||||||
});
|
|
||||||
|
|
||||||
|
updateButtonStyles();
|
||||||
|
});
|
||||||
Loading…
x
Reference in New Issue
Block a user