mirror of
https://github.com/dcs-liberation/dcs_liberation.git
synced 2025-11-10 14:22:26 +00:00
Make some waypoint types undraggable.
None of these (takeoff, landing, divert, bullseye, precise target locations) can be usefully moved, so prevent it.
This commit is contained in:
parent
e8f326ebce
commit
b7b3b35816
@ -101,7 +101,7 @@ class FlightWaypointType(Enum):
|
|||||||
LANDING_POINT = 11 # Should land there
|
LANDING_POINT = 11 # Should land there
|
||||||
TARGET_POINT = 12 # A target building or static object, position
|
TARGET_POINT = 12 # A target building or static object, position
|
||||||
TARGET_GROUP_LOC = 13 # A target group approximate location
|
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)
|
CUSTOM = 15 # User waypoint (no specific behaviour)
|
||||||
JOIN = 16
|
JOIN = 16
|
||||||
SPLIT = 17
|
SPLIT = 17
|
||||||
|
|||||||
@ -379,7 +379,9 @@ class WaypointJs(QObject):
|
|||||||
altitudeReferenceChanged = Signal()
|
altitudeReferenceChanged = Signal()
|
||||||
nameChanged = Signal()
|
nameChanged = Signal()
|
||||||
timingChanged = Signal()
|
timingChanged = Signal()
|
||||||
|
isTargetPointChanged = Signal()
|
||||||
isTakeoffChanged = Signal()
|
isTakeoffChanged = Signal()
|
||||||
|
isLandingChanged = Signal()
|
||||||
isDivertChanged = Signal()
|
isDivertChanged = Signal()
|
||||||
isBullseyeChanged = Signal()
|
isBullseyeChanged = Signal()
|
||||||
|
|
||||||
@ -438,10 +440,18 @@ class WaypointJs(QObject):
|
|||||||
return ""
|
return ""
|
||||||
return f"{prefix} T+{timedelta(seconds=int(time.total_seconds()))}"
|
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)
|
@Property(bool, notify=isTakeoffChanged)
|
||||||
def isTakeoff(self) -> bool:
|
def isTakeoff(self) -> bool:
|
||||||
return self.waypoint.waypoint_type is FlightWaypointType.TAKEOFF
|
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)
|
@Property(bool, notify=isDivertChanged)
|
||||||
def isDivert(self) -> bool:
|
def isDivert(self) -> bool:
|
||||||
return self.waypoint.waypoint_type is FlightWaypointType.DIVERT
|
return self.waypoint.waypoint_type is FlightWaypointType.DIVERT
|
||||||
|
|||||||
@ -615,7 +615,40 @@ class Waypoint {
|
|||||||
// We don't need a marker for the departure waypoint (and it's likely
|
// 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
|
// coincident with the landing waypoint, so hard to see). We do want to draw
|
||||||
// the path from it though.
|
// 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) {
|
description(dragging) {
|
||||||
@ -639,7 +672,7 @@ class Waypoint {
|
|||||||
|
|
||||||
makeMarker() {
|
makeMarker() {
|
||||||
const zoom = map.getZoom();
|
const zoom = map.getZoom();
|
||||||
return L.marker(this.waypoint.position, { draggable: true })
|
return L.marker(this.waypoint.position, { draggable: this.draggable() })
|
||||||
.bindTooltip(this.description(), {
|
.bindTooltip(this.description(), {
|
||||||
permanent: zoom >= SHOW_WAYPOINT_INFO_AT_ZOOM,
|
permanent: zoom >= SHOW_WAYPOINT_INFO_AT_ZOOM,
|
||||||
})
|
})
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user