const ADDITIONAL_SIDE
This commit is contained in:
parent
3559fd9ecd
commit
ed42327ff5
15
Drawing.js
15
Drawing.js
@ -6,6 +6,8 @@ import { LEFT_SIDE, RIGHT_SIDE, BOTH_SIDES } from "athena-utils/shape/Frontline.
|
||||
const ARROW = "arrow";
|
||||
const FRONTLINE = "frontline";
|
||||
|
||||
const ADDITIONAL_SIDE = "additionalSide"; // used for Id in BOTH_SIDES style
|
||||
|
||||
const DEFAULT_ARROW_PARAMS = {
|
||||
splineStep: 20,
|
||||
offsetDistance: 12000,
|
||||
@ -231,7 +233,7 @@ function DrawFrontline(coordinates, polygonId) {
|
||||
|
||||
let additionalPolygonToDraw = frontlineGeoJSON.rightPoly;
|
||||
|
||||
drawOnMap(additionalPolygonToDraw, FRONTLINE + "-" + (polygonId+1), params.paintOptionsRight);
|
||||
drawOnMap(additionalPolygonToDraw, FRONTLINE + "-" + (polygonId + ADDITIONAL_SIDE), params.paintOptionsRight);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -275,6 +277,7 @@ function drawOnMap(frontlineGeoJSON, id, paintOptions = {}) {
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
function handleDelete(polygonType)
|
||||
{
|
||||
if (!currentFeature) return;
|
||||
@ -294,10 +297,10 @@ function handleDelete(polygonType)
|
||||
const frontlineLayerId = polygonType + "-" + id;
|
||||
|
||||
if (frontlineParamsMap.get(id).style == 3){ //BOTH_SIDES
|
||||
const frontlineLayerIdB = polygonType + "-" + (id+1);
|
||||
const frontlineLayerIdB = polygonType + "-" + (id + ADDITIONAL_SIDE);
|
||||
|
||||
DeleteFromMap(frontlineLayerId, id);
|
||||
DeleteFromMap(frontlineLayerIdB, id+1);
|
||||
DeleteFromMap(frontlineLayerIdB, id + ADDITIONAL_SIDE);
|
||||
hideArrowEditor();
|
||||
hideFrontlineEditor();
|
||||
return;
|
||||
@ -520,7 +523,7 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||
if (map.getLayer(frontlineLayerId)) map.removeLayer(frontlineLayerId);
|
||||
if (map.getSource(frontlineLayerId)) map.removeSource(frontlineLayerId);
|
||||
|
||||
drawOnMap(polygonToDrawLeft, FRONTLINE + "-" + id+1, paintOptionsLeft);
|
||||
drawOnMap(polygonToDrawLeft, FRONTLINE + "-" + id + ADDITIONAL_SIDE, paintOptionsLeft);
|
||||
drawOnMap(polygonToDrawRight, FRONTLINE + "-" + (id), paintOptionsRight);
|
||||
|
||||
const allFeatures = draw.getAll().features;
|
||||
@ -530,8 +533,8 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||
}
|
||||
|
||||
const frontlineLayerId = FRONTLINE + "-" + id;
|
||||
if (map.getLayer(frontlineLayerId+1)) map.removeLayer(frontlineLayerId+1);
|
||||
if (map.getSource(frontlineLayerId+1)) map.removeSource(frontlineLayerId+1);
|
||||
if (map.getLayer(frontlineLayerId + ADDITIONAL_SIDE)) map.removeLayer(frontlineLayerId + ADDITIONAL_SIDE);
|
||||
if (map.getSource(frontlineLayerId + ADDITIONAL_SIDE)) map.removeSource(frontlineLayerId + ADDITIONAL_SIDE);
|
||||
if (map.getLayer(frontlineLayerId)) map.removeLayer(frontlineLayerId);
|
||||
if (map.getSource(frontlineLayerId)) map.removeSource(frontlineLayerId);
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user