diff --git a/qt_ui/widgets/map/mapmodel.py b/qt_ui/widgets/map/mapmodel.py index 1b3f79f4..cf28284f 100644 --- a/qt_ui/widgets/map/mapmodel.py +++ b/qt_ui/widgets/map/mapmodel.py @@ -18,6 +18,7 @@ from game.utils import meters from gen.ato import AirTaskingOrder from gen.flights.flight import Flight, FlightWaypoint, FlightWaypointType from gen.flights.flightplan import FlightPlan +from qt_ui.dialogs import Dialog from qt_ui.models import GameModel from qt_ui.windows.GameUpdateSignal import GameUpdateSignal from qt_ui.windows.basemenu.QBaseMenu2 import QBaseMenu2 @@ -37,6 +38,7 @@ class ControlPointJs(QObject): self.control_point = control_point self.game_model = game_model self.theater = theater + self.dialog: Optional[QBaseMenu2] = None @Property(str) def name(self) -> str: @@ -52,9 +54,14 @@ class ControlPointJs(QObject): return [ll.latitude, ll.longitude] @Slot() - def open_base_menu(self) -> None: - self.base_details_dialog = QBaseMenu2(None, self.control_point, self.game_model) - self.base_details_dialog.show() + def showInfoDialog(self) -> None: + if self.dialog is None: + self.dialog = QBaseMenu2(None, self.control_point, self.game_model) + self.dialog.show() + + @Slot() + def showPackageDialog(self) -> None: + Dialog.open_new_package_dialog(self.control_point) class GroundObjectJs(QObject): @@ -73,7 +80,7 @@ class GroundObjectJs(QObject): self.dialog: Optional[QGroundObjectMenu] = None @Slot() - def open_dialog(self) -> None: + def showInfoDialog(self) -> None: if self.dialog is None: self.dialog = QGroundObjectMenu( None, @@ -84,6 +91,10 @@ class GroundObjectJs(QObject): ) self.dialog.show() + @Slot() + def showPackageDialog(self) -> None: + Dialog.open_new_package_dialog(self.tgo) + @Property(str) def name(self) -> str: return self.tgo.name diff --git a/resources/ui/map/map.js b/resources/ui/map/map.js index f4041ad3..9583d08b 100644 --- a/resources/ui/map/map.js +++ b/resources/ui/map/map.js @@ -128,7 +128,10 @@ function drawControlPoints() { permanent: zoom >= SHOW_BASE_NAME_AT_ZOOM, }) .on("click", function () { - cp.open_base_menu(); + cp.showInfoDialog(); + }) + .on("contextmenu", function () { + cp.showPackageDialog(); }) .addTo(controlPointsLayer); }); @@ -169,7 +172,10 @@ function drawGroundObjects() { L.marker(tgo.position, { icon: iconFor(tgo.blue) }) .bindTooltip(`${tgo.name}
${tgo.units.join("
")}`) .on("click", function () { - tgo.open_dialog(); + tgo.showInfoDialog(); + }) + .on("contextmenu", function () { + tgo.showPackageDialog(); }) .addTo(groundObjectsLayer); drawSamThreatsAt(tgo);