Highlight icons for selected flights.

https://spatialillusions.com/unitgenerator/ doesn't support generating
white icons AFAICT, so this was just the blue icon manually edited to
white.

https://github.com/dcs-liberation/dcs_liberation/issues/1704
This commit is contained in:
Dan Albert 2021-11-07 11:44:04 -08:00
parent d31f0e22e3
commit 2c14a140fe
2 changed files with 23 additions and 6 deletions

View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" version="1.2" baseProfile="tiny" width="118" height="128" viewBox="41 26 118 128"><path d="M 155,150 C 155,50 115,30 100,30 85,30 45,50 45,150" stroke-width="4" stroke="black" fill="rgb(255,255,255)" fill-opacity="1" ></path></svg>

After

Width:  |  Height:  |  Size: 271 B

View File

@ -108,16 +108,28 @@ class AirIcons {
constructor() {
this.icons = {};
for (const player of [true, false]) {
this.icons[player] = this.loadIcon("unspecified", player);
this.icons[player] = {};
for (const selected of [true, false]) {
this.icons[player][selected] = this.loadIcon(
"unspecified",
player,
selected
);
}
}
}
icon(_category, player, _state) {
return this.icons[player];
icon(_category, player, selected) {
return this.icons[player][selected];
}
loadIcon(category, player) {
const color = player ? "blue" : "red";
loadIcon(category, player, selected) {
var color;
if (selected) {
color = "selected";
} else {
color = player ? "blue" : "red";
}
return new L.Icon({
iconUrl: `../air_assets/${category}_${color}.svg`,
iconSize: [24, 24],
@ -849,7 +861,11 @@ class Flight {
const position = this.flight.position;
if (position.length > 0) {
this.aircraft = L.marker(position, {
icon: Icons.AirIcons.icon("fighter", this.flight.blue),
icon: Icons.AirIcons.icon(
"fighter",
this.flight.blue,
this.flight.selected
),
}).addTo(aircraftLayer);
}
}