summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcus Lundblad <ml@dfupdate.se>2022-09-03 10:15:57 +0200
committerMarcus Lundblad <ml@dfupdate.se>2022-09-03 10:15:57 +0200
commit6f0eacd48e58135033d8102d1a4f557e7a428a37 (patch)
treeebad40ff8cbcbc3cd2ddbc1dc28af6f1460f2fb1
parent66daec2ada08924687afe9e022125ed4b68eb31e (diff)
downloadgnome-maps-wip/mlundblad/unparent-bubbles.tar.gz
WIP: mapMarker: Unparent bubble when marker is unmappedwip/mlundblad/unparent-bubbles
-rw-r--r--src/mapMarker.js19
1 files changed, 14 insertions, 5 deletions
diff --git a/src/mapMarker.js b/src/mapMarker.js
index 91cd5688..7b592978 100644
--- a/src/mapMarker.js
+++ b/src/mapMarker.js
@@ -53,6 +53,11 @@ export class MapMarker extends Shumate.Marker {
this._image = new Gtk.Image({ icon_size: Gtk.IconSize.NORMAL });
this.child = this._image;
+ this.connect('unmap', () => {
+ if (this._bubble)
+ this._bubble.unparent();
+ });
+
if (this._mapView) {
this._viewport = this._mapView.map.viewport;
@@ -126,12 +131,16 @@ export class MapMarker extends Shumate.Marker {
}
get bubble() {
- if (this._bubble === undefined && this._hasBubble()) {
- if (this._place.name) {
- this._bubble = new MapBubble({ place: this._place,
- mapView: this._mapView });
- this._bubble.set_parent(this._mapView);
+ if (this._hasBubble) {
+ if (this._bubble === undefined) {
+ if (this._place.name) {
+ this._bubble = new MapBubble({ place: this._place,
+ mapView: this._mapView });
+ }
}
+
+ if (!this._bubble.get_parent())
+ this._bubble.set_parent(this._mapView);
}
return this._bubble;