diff --git a/gen/flights/flight.py b/gen/flights/flight.py index b9ea8bce..698e1bce 100644 --- a/gen/flights/flight.py +++ b/gen/flights/flight.py @@ -101,7 +101,7 @@ class FlightWaypointType(Enum): LANDING_POINT = 11 # Should land there TARGET_POINT = 12 # A target building or static object, position TARGET_GROUP_LOC = 13 # A target group approximate location - TARGET_SHIP = 14 # A target ship known location + TARGET_SHIP = 14 # Unused. CUSTOM = 15 # User waypoint (no specific behaviour) JOIN = 16 SPLIT = 17 diff --git a/qt_ui/widgets/map/mapmodel.py b/qt_ui/widgets/map/mapmodel.py index 7b6e7bc5..a176c155 100644 --- a/qt_ui/widgets/map/mapmodel.py +++ b/qt_ui/widgets/map/mapmodel.py @@ -379,7 +379,9 @@ class WaypointJs(QObject): altitudeReferenceChanged = Signal() nameChanged = Signal() timingChanged = Signal() + isTargetPointChanged = Signal() isTakeoffChanged = Signal() + isLandingChanged = Signal() isDivertChanged = Signal() isBullseyeChanged = Signal() @@ -438,10 +440,18 @@ class WaypointJs(QObject): return "" return f"{prefix} T+{timedelta(seconds=int(time.total_seconds()))}" + @Property(bool, notify=isTargetPointChanged) + def isTargetPoint(self) -> bool: + return self.waypoint.waypoint_type is FlightWaypointType.TARGET_POINT + @Property(bool, notify=isTakeoffChanged) def isTakeoff(self) -> bool: return self.waypoint.waypoint_type is FlightWaypointType.TAKEOFF + @Property(bool, notify=isLandingChanged) + def isLanding(self) -> bool: + return self.waypoint.waypoint_type is FlightWaypointType.LANDING_POINT + @Property(bool, notify=isDivertChanged) def isDivert(self) -> bool: return self.waypoint.waypoint_type is FlightWaypointType.DIVERT diff --git a/resources/ui/map/map.js b/resources/ui/map/map.js index a645fa0c..d97c369e 100644 --- a/resources/ui/map/map.js +++ b/resources/ui/map/map.js @@ -615,7 +615,40 @@ class Waypoint { // We don't need a marker for the departure waypoint (and it's likely // coincident with the landing waypoint, so hard to see). We do want to draw // the path from it though. - return !this.waypoint.isTakeoff; + // + // We also don't need the landing waypoint since we'll be drawing that path + // as well and it's clear what it is, and only obscured the CP icon. + // + // The divert waypoint also obscures the CP. We don't draw the path to it, + // but it can be seen in the flight settings page so it's not really a + // problem to exclude it. + // + // Bullseye ought to be (but currently isn't) drawn *once* rather than as a + // flight waypoint. + return !( + this.waypoint.isTakeoff || + this.waypoint.isLanding || + this.waypoint.isDivert || + this.waypoint.isBullseye + ); + } + + draggable() { + // Target *points* are the exact location of a unit, whereas the target area + // is only the center of the objective. Allow moving the latter since its + // exact location isn't very important. + // + // Landing, and divert should be changed in the flight settings UI, takeoff + // cannot be changed because that's where the plane is. + // + // Moving the bullseye reference only makes it wrong. + return !( + this.waypoint.isTargetPoint || + this.waypoint.isTakeoff || + this.waypoint.isLanding || + this.waypoint.isDivert || + this.waypoint.isBullseye + ); } description(dragging) { @@ -639,7 +672,7 @@ class Waypoint { makeMarker() { const zoom = map.getZoom(); - return L.marker(this.waypoint.position, { draggable: true }) + return L.marker(this.waypoint.position, { draggable: this.draggable() }) .bindTooltip(this.description(), { permanent: zoom >= SHOW_WAYPOINT_INFO_AT_ZOOM, })