feat: completed orbit management

This commit is contained in:
Davide Passoni
2025-01-28 09:47:44 +01:00
parent c2ea746d48
commit 79f9905413
17 changed files with 241 additions and 60 deletions

View File

@@ -0,0 +1,34 @@
import { DivIcon, LatLng } from "leaflet";
import { CustomMarker } from "../markers/custommarker";
import { SVGInjector } from "@tanem/svg-injector";
export class ArrowMarker extends CustomMarker {
#bearing: number = 0;
constructor(latlng: LatLng) {
super(latlng, { interactive: true, draggable: false });
}
createIcon() {
this.setIcon(
new DivIcon({
iconSize: [24, 24],
iconAnchor: [12, 12],
className: "leaflet-arrow-marker",
})
);
var div = document.createElement("div");
var img = document.createElement("img");
img.src = "images/others/arrow.svg";
img.onload = () => SVGInjector(img);
div.classList.add("ol-arrow-icon");
div.append(img);
this.getElement()?.appendChild(div);
}
setBearing(bearing: number) {
this.#bearing = bearing;
let img = this.getElement()?.querySelector("svg");
if (img) img.style.transform = `rotate(${bearing}rad)`;
}
}

View File

@@ -31,7 +31,7 @@ export class ExplosionMarker extends CustomMarker {
var el = document.createElement("div");
el.classList.add("ol-explosion-icon");
var img = document.createElement("img");
img.src = "./images/markers/explosion.svg";
img.src = "images/markers/explosion.svg";
img.onload = () => SVGInjector(img);
el.appendChild(img);
this.getElement()?.appendChild(el);

View File

@@ -28,7 +28,7 @@ export class SmokeMarker extends CustomMarker {
el.classList.add("ol-smoke-icon");
el.setAttribute("data-color", this.#color);
var img = document.createElement("img");
img.src = "./images/markers/smoke.svg";
img.src = "images/markers/smoke.svg";
img.onload = () => SVGInjector(img);
el.appendChild(img);
this.getElement()?.appendChild(el);

View File

@@ -60,7 +60,7 @@ export class TemporaryUnitMarker extends CustomMarker {
var unitIcon = document.createElement("div");
unitIcon.classList.add("unit-icon");
var img = document.createElement("img");
img.src = `./images/units/map/${/*TODO getApp().getMap().getOptions().AWACSMode ? "awacs" :*/ "normal"}/${this.#coalition}/${blueprint.markerFile ?? blueprint.category}.svg`;
img.src = `images/units/map/${/*TODO getApp().getMap().getOptions().AWACSMode ? "awacs" :*/ "normal"}/${this.#coalition}/${blueprint.markerFile ?? blueprint.category}.svg`;
img.onload = () => SVGInjector(img);
unitIcon.appendChild(img);
unitIcon.toggleAttribute("data-rotate-to-heading", false);
@@ -78,7 +78,7 @@ export class TemporaryUnitMarker extends CustomMarker {
if (this.#headingHandle) {
var handle = document.createElement("div");
var handleImg = document.createElement("img");
handleImg.src = "/images/others/arrow.svg";
handleImg.src = "images/others/arrow.svg";
handleImg.onload = () => SVGInjector(handleImg);
handle.classList.add("heading-handle");
el.append(handle);

View File

@@ -253,4 +253,14 @@ path.leaflet-interactive:focus {
.pointer-cursor {
cursor: url("/images/cursors/pointer.svg") 13 5, auto !important;
}
}
.ol-arrow-icon svg {
width: 24px;
height: 24px;
}
.ol-arrow-icon svg path {
fill: #FFFFFFAA;
}