mirror of
https://github.com/Pax1601/DCSOlympus.git
synced 2025-10-29 16:56:34 +00:00
feat: completed orbit management
This commit is contained in:
34
frontend/react/src/map/markers/arrowmarker.ts
Normal file
34
frontend/react/src/map/markers/arrowmarker.ts
Normal 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)`;
|
||||
}
|
||||
}
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user