Skip to content

Commit

Permalink
Fix tooltip showing when panning/zooming on touch device
Browse files Browse the repository at this point in the history
  • Loading branch information
milespetrov committed Feb 20, 2025
1 parent 8a295ff commit ed5a7b3
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/fixtures/details/components/result-item.vue
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
:content="itemName"
v-html="makeHtmlLink(itemName)"
v-truncate="{
options: { placement: 'right' }
options: { placement: 'top' }
}"
:tabindex="inList ? -1 : 0"
></span>
Expand Down
7 changes: 5 additions & 2 deletions src/fixtures/details/components/result-list.vue
Original file line number Diff line number Diff line change
Expand Up @@ -394,6 +394,11 @@ const clickShowList = () => {
const detailsClosed = () => {
detailsFixture.value.removeDetailsHilight();
// unwatch when the panel is closed, not when unmounted because a minimized
// panel will be unmounted but still needs to have watchers active.
watchers.value.forEach(unwatch => unwatch());
handlers.value.forEach(handler => iApi.event.off(handler));
// (JR) commenting this out. if user turns off toggle, it shouldnt reset back to on when screen closes.
// detailsStore.hilightToggle = true;
};
Expand Down Expand Up @@ -546,8 +551,6 @@ onBeforeMount(() => {
onBeforeUnmount(() => {
// clean up hooks into various events.
watchers.value.forEach(unwatch => unwatch());
handlers.value.forEach(handler => iApi.event.off(handler));
el.value?.removeEventListener('blur', blurEvent);
el.value?.removeEventListener('keyup', keyupEvent);
Expand Down
9 changes: 8 additions & 1 deletion src/geo/map/maptip.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,11 @@ export class MaptipAPI extends APIScope {

if (!graphicHit) {
this.clear();
// If there is no graphic hit, disable the maptip. Otherwise vue-tippy will
// show the last maptip content for the previous graphic hit on touch devices when they pan/zoom.
this.maptipStore.maptipInstance.disable();
return;
}

// Get the layer
const layerInstance: LayerInstance | undefined = this.$iApi.geo.layer.getLayer(graphicHit.layerId);

Expand All @@ -62,6 +64,9 @@ export class MaptipAPI extends APIScope {
}

this.clear();
// If there is no graphic hit, disable the maptip. Otherwise vue-tippy will
// show the last maptip content for the previous graphic hit on touch devices when they pan/zoom.
this.maptipStore.maptipInstance.disable();
this.#lastHit = graphicHit;

if (!layerInstance) {
Expand All @@ -84,6 +89,8 @@ export class MaptipAPI extends APIScope {
getAttribs: true
});

// At this point we have a graphic hit and a layer, so we can show the maptip
this.maptipStore.maptipInstance.enable();
this.setPoint(this.$iApi.geo.map.screenPointToMapPoint(screenPoint));

this.$iApi.event.emit(GlobalEvents.MAP_GRAPHICHIT, {
Expand Down

0 comments on commit ed5a7b3

Please sign in to comment.