mirror of
https://github.com/Pax1601/DCSOlympus.git
synced 2025-10-29 16:56:34 +00:00
Added minimap and scale
This commit is contained in:
@@ -2064,8 +2064,8 @@ export class AircraftDatabase extends UnitDatabase {
|
||||
],
|
||||
"filename": "kc-135.png"
|
||||
},
|
||||
"KC-135MPRS": {
|
||||
"name": "KC-135MPRS",
|
||||
"KC135MPRS": {
|
||||
"name": "KC135MPRS",
|
||||
"label": "KC-135 MPRS Stratotanker",
|
||||
"shortLabel": "135M",
|
||||
"loadouts": [
|
||||
@@ -2083,6 +2083,44 @@ export class AircraftDatabase extends UnitDatabase {
|
||||
],
|
||||
"filename": "kc-135.png"
|
||||
},
|
||||
"KC_10_Extender": {
|
||||
"name": "KC_10_Extender",
|
||||
"label": "KC-10 Extender",
|
||||
"shortLabel": "KC10",
|
||||
"loadouts": [
|
||||
{
|
||||
"fuel": 1,
|
||||
"items": [
|
||||
|
||||
],
|
||||
"roles": [
|
||||
"Tanker"
|
||||
],
|
||||
"code": "",
|
||||
"name": "Default Tanker"
|
||||
}
|
||||
],
|
||||
"filename": "kc-10.png"
|
||||
},
|
||||
"KC_10_Extender_D": {
|
||||
"name": "KC_10_Extender_D",
|
||||
"label": "KC-10 Extender (Drogue)",
|
||||
"shortLabel": "KC10",
|
||||
"loadouts": [
|
||||
{
|
||||
"fuel": 1,
|
||||
"items": [
|
||||
|
||||
],
|
||||
"roles": [
|
||||
"Tanker"
|
||||
],
|
||||
"code": "",
|
||||
"name": "Default Tanker"
|
||||
}
|
||||
],
|
||||
"filename": "kc-10.png"
|
||||
},
|
||||
"MiG-15bis": {
|
||||
"name": "MiG-15bis",
|
||||
"label": "MiG-15 Fagot",
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Marker, LatLng, Polyline, Icon, DivIcon } from 'leaflet';
|
||||
import { Marker, LatLng, Polyline, Icon, DivIcon, CircleMarker } from 'leaflet';
|
||||
import { getMap, getUnitsManager } from '..';
|
||||
import { rad2deg } from '../other/utils';
|
||||
import { addDestination, attackUnit, changeAltitude, changeSpeed, createFormation as setLeader, deleteUnit, getUnits, landAt, setAltitude, setReactionToThreat, setROE, setSpeed, refuel, setAdvacedOptions, followUnit } from '../server/server';
|
||||
@@ -77,6 +77,7 @@ export class Unit extends Marker {
|
||||
#pathMarkers: Marker[] = [];
|
||||
#pathPolyline: Polyline;
|
||||
#targetsPolylines: Polyline[];
|
||||
#miniMapMarker: CircleMarker | null = null;
|
||||
|
||||
#timer: number = 0;
|
||||
#forceUpdate: boolean = false;
|
||||
@@ -107,11 +108,11 @@ export class Unit extends Marker {
|
||||
|
||||
/* Deselect units if they are hidden */
|
||||
document.addEventListener("toggleCoalitionVisibility", (ev: CustomEventInit) => {
|
||||
setTimeout(() => {this.setSelected(this.getSelected() && !this.getHidden())}, 300);
|
||||
window.setTimeout(() => {this.setSelected(this.getSelected() && !this.getHidden())}, 300);
|
||||
});
|
||||
|
||||
document.addEventListener("toggleUnitVisibility", (ev: CustomEventInit) => {
|
||||
setTimeout(() => {this.setSelected(this.getSelected() && !this.getHidden())}, 300);
|
||||
window.setTimeout(() => {this.setSelected(this.getSelected() && !this.getHidden())}, 300);
|
||||
});
|
||||
|
||||
/* Set the unit data */
|
||||
@@ -124,7 +125,6 @@ export class Unit extends Marker {
|
||||
iconAnchor: [0, 0]
|
||||
});
|
||||
this.setIcon(icon);
|
||||
|
||||
}
|
||||
|
||||
getMarkerHTML() {
|
||||
@@ -392,7 +392,7 @@ export class Unit extends Marker {
|
||||
}
|
||||
|
||||
#onClick(e: any) {
|
||||
this.#timer = setTimeout(() => {
|
||||
this.#timer = window.setTimeout(() => {
|
||||
if (!this.#preventClick) {
|
||||
if (getMap().getState() === 'IDLE' || getMap().getState() === 'MOVE_UNIT' || e.originalEvent.ctrlKey) {
|
||||
if (!e.originalEvent.ctrlKey) {
|
||||
@@ -517,8 +517,24 @@ export class Unit extends Marker {
|
||||
#updateMarker() {
|
||||
this.updateVisibility();
|
||||
|
||||
if (!this.getHidden()) {
|
||||
if (this.#miniMapMarker == null)
|
||||
{
|
||||
this.#miniMapMarker = new CircleMarker(new LatLng(this.getFlightData().latitude, this.getFlightData().longitude), {radius: 0.5});
|
||||
if (this.getMissionData().coalition == "neutral")
|
||||
this.#miniMapMarker.setStyle({color: "#CFD9E8"});
|
||||
else if (this.getMissionData().coalition == "red")
|
||||
this.#miniMapMarker.setStyle({color: "#ff5858"});
|
||||
else
|
||||
this.#miniMapMarker.setStyle({color: "#247be2"});
|
||||
this.#miniMapMarker.addTo(getMap().getMiniMapLayerGroup());
|
||||
this.#miniMapMarker.bringToBack();
|
||||
}
|
||||
else {
|
||||
this.#miniMapMarker.setLatLng(new LatLng(this.getFlightData().latitude, this.getFlightData().longitude));
|
||||
this.#miniMapMarker.bringToBack();
|
||||
}
|
||||
|
||||
if (!this.getHidden()) {
|
||||
this.setLatLng(new LatLng(this.getFlightData().latitude, this.getFlightData().longitude));
|
||||
var element = this.getElement();
|
||||
if (element != null) {
|
||||
@@ -538,8 +554,7 @@ export class Unit extends Marker {
|
||||
|
||||
var unitAltitudeDiv = element.querySelector(".unit-altitude");
|
||||
if (unitAltitudeDiv != null) {
|
||||
unitAltitudeDiv.innerHTML = String(Math.floor(this.getFlightData().altitude / 0.3048 / 1000));
|
||||
|
||||
unitAltitudeDiv.innerHTML = "FL" + String(Math.floor(this.getFlightData().altitude / 0.3048 / 1000));
|
||||
}
|
||||
|
||||
element.querySelectorAll( "[data-rotate-to-heading]" ).forEach( el => {
|
||||
|
||||
@@ -68,7 +68,7 @@ export class UnitsManager {
|
||||
Object.keys(data.units)
|
||||
.filter((ID: string) => !(ID in this.#units))
|
||||
.reduce((timeout: number, ID: string) => {
|
||||
setTimeout(() => {
|
||||
window.setTimeout(() => {
|
||||
if (!(ID in this.#units))
|
||||
this.addUnit(parseInt(ID), data.units[ID]);
|
||||
this.#units[parseInt(ID)]?.setData(data.units[ID]);
|
||||
@@ -330,7 +330,7 @@ export class UnitsManager {
|
||||
this.#showActionMessage(this.#copiedUnits, `pasted`);
|
||||
}
|
||||
this.#pasteDisabled = true;
|
||||
setTimeout(() => this.#pasteDisabled = false, 250);
|
||||
window.setTimeout(() => this.#pasteDisabled = false, 250);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -348,7 +348,7 @@ export class UnitsManager {
|
||||
/* Disable the firing of the selection event for a certain amount of time. This avoids firing many events if many units are selected */
|
||||
if (!this.#selectionEventDisabled)
|
||||
{
|
||||
setTimeout(() => {
|
||||
window.setTimeout(() => {
|
||||
document.dispatchEvent(new CustomEvent("unitsSelection", {detail: this.getSelectedUnits()}));
|
||||
this.#selectionEventDisabled = false;
|
||||
}, 100);
|
||||
|
||||
Reference in New Issue
Block a user