frontend icon indicating copy to clipboard operation
frontend copied to clipboard

Map is reseting to default position when actively panned or zoomed

Open Mincka opened this issue 2 years ago • 16 comments

Checklist

  • [X] I have updated to the latest available Home Assistant version.
  • [X] I have cleared the cache of my browser.
  • [X] I have tried a different browser to see if it is related to my browser.

Describe the issue you are experiencing

When using /map, it's almost impossible to zoom in some areas and follow persons because each time there is a location update, from any device on the map, it will be reset to default position and default zoom. By "default", I mean the calculated view to show all the devices (which is a bit too wide by the way, from my point of view).

This reset is very annoying if the different persons tracked are far appart. The map will always dezoom when the user does not expect it to show all the devices on the map while he/she was focused on some part of the map.

This behavior is even worse when one of the device tracked is in "High Accuracy" mode with short intervals between updates.

Describe the behavior you expected

When user interaction occurs with the map (panning / zooming), the map should not reset its zoom and position, until the next page load. Bonus point: Provide a "Reset view" button.

Steps to reproduce the issue

  1. Go to https:/xx/map
  2. Zoom on an area
  3. Wait or trigger a location update
  4. The original position of the map is restored to show all the tracked devices at the same time

What version of Home Assistant Core has the issue?

2023.5.4

What was the last working version of Home Assistant Core?

No response

In which browser are you experiencing the issue with?

No response

Which operating system are you using to run this browser?

No response

State of relevant entities

No response

Problem-relevant frontend configuration

No response

Javascript errors shown in your browser console/inspector

No response

Additional information

No response

Mincka avatar May 30 '23 09:05 Mincka

This is due to the the autoFit option here: https://github.com/home-assistant/frontend/blob/dev/src/panels/map/ha-panel-map.ts#L41

I'm not sure whether on or off for this is more appropriate default for map panel.

I will say you could consider on your end just creating a Panel/1-Card dashboard with a map card, and then you could disable this feature (and get your reset view button).

Perhaps autoFit should follow moving entities until user interacts with the map, and then stop updating, but that's a bigger feature request than just turning it on/off for the map panel.

karwosts avatar May 30 '23 14:05 karwosts

I will say you could consider on your end just creating a Panel/1-Card dashboard with a map card, and then you could disable this feature (and get your reset view button).

Good to know that you can set autoFit on the map card, I see it's false by default. I already have a panel (sidebar) with a map card. What I miss on the map card is the fact that zones are not displayed. So my need is to track people on the map with zones without having it to unexpectedly update. Maybe I can also request for zone display on the map card. I'd be happy with that.

Perhaps autoFit should follow moving entities until user interacts with the map, and then stop updating

That's my request. Stop updating the view when the user is focusing on a specific zone. ~~Maybe it's also reseting while editing the zones, I did not try that but it would be a nightmare.~~ <- Not the case.

Mincka avatar May 30 '23 17:05 Mincka

You can add and render zones in a map card, you just add their zone.xxx entities to the list of entities to be displayed.

karwosts avatar May 30 '23 17:05 karwosts

I don't know how I missed that! 🤯 Thank you!

Mincka avatar May 30 '23 18:05 Mincka

FYI I did take a look for a bit at turning off the autofit when user pans/zooms the map, but it was a bit difficult because leaflet does not really easily allow to distinguish between move initiated by user and move from the maps internal autofit routine.

I tried a couple approaches to figure out how to distinguish them but ultimately didn't find anything that worked well. So maybe someone will pick that up at some point but it was a bit tricky.

karwosts avatar May 31 '23 17:05 karwosts

Thank you the time you put into this anyway, looking for the root cause and a possible solution, it's appreciated.

Mincka avatar May 31 '23 18:05 Mincka

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

github-actions[bot] avatar Aug 29 '23 19:08 github-actions[bot]

I still think it's a usability issue.

Mincka avatar Aug 30 '23 18:08 Mincka

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

github-actions[bot] avatar Nov 28 '23 19:11 github-actions[bot]

keep

karwosts avatar Nov 28 '23 21:11 karwosts

Is there any way how can this be fixed? The same problem is with a map of any person (i.e. when I open a person card) and in the person card it wasn't happening before, it was not autozoomed and centered, last time I checked was maybe 6 months ago, but now autozoom and centering is also done there...

Dehumanizer77 avatar Dec 18 '23 17:12 Dehumanizer77

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

github-actions[bot] avatar Mar 17 '24 18:03 github-actions[bot]

Is it possible to simply grab the current pan/zoom before the refresh and apply it when re-rendering on the following refresh? I'm having this issue with the map page from the sidebar where as soon as I start to zoom it the map updates and zooms back out.

DaAwesomeP avatar Mar 25 '24 15:03 DaAwesomeP

I've asked in the past. Many people have. It is never even considered. I gave up using the map.

RickSisco avatar Mar 28 '24 15:03 RickSisco

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

github-actions[bot] avatar Jun 26 '24 16:06 github-actions[bot]

Issue persists in 2024.6.

DaAwesomeP avatar Jun 26 '24 16:06 DaAwesomeP

Issue still there (and annoying) in 2024.8.3

ALSO, it is doing the position reset to me when I'm editing the map as well (which is what brought me here). Doing the editing by logging into Nabu Casa and engaging in a remote session with my Home Assistant. Need to edit some locations, and the view keeps jumping around. This is nuts.

pfurrie avatar Sep 02 '24 15:09 pfurrie

Please add thumbs up to the original post so it could help it to gain visibility.

Mincka avatar Sep 05 '24 07:09 Mincka

  • vote for disable autoFit map option especialy we have separate button to fit objects onto map at any time

krisproger avatar Sep 05 '24 07:09 krisproger

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

github-actions[bot] avatar Dec 04 '24 08:12 github-actions[bot]

it's still not fixed

Dehumanizer77 avatar Dec 04 '24 08:12 Dehumanizer77

What use is the map if we can't zoom in far enough to see where entities are? I've got a Tesla integration that updates it every second or two and it's completely unusable.

LostSoulfly avatar Dec 12 '24 00:12 LostSoulfly

The zoom reset on update makes this completely unusable if one of our vehicles is interstate and I want to look at precisely where one of them is...

davidmonro avatar Jan 26 '25 01:01 davidmonro

Added my vote to have an option to stop the auto fit on refresh.

Brausmith avatar Jan 28 '25 07:01 Brausmith

Still an issue on 2025.3.4. I'm unable to view and edit zones since the map keeps snapping back to my location.

kg333 avatar Apr 23 '25 10:04 kg333

Can confirm this still happens on 2025.5

dxmnkd316 avatar May 09 '25 14:05 dxmnkd316

I also second and confirm it! This reset focus with update is making it very hard / next to useless. Please fix!

Joeri87 avatar Jul 07 '25 10:07 Joeri87

This has made the map feature unusable for me for years. I would like to see this fixed as a map would be useful for tracking entities instead of pasting their coordinates into Google maps since I can't zoom in.

huntsman95 avatar Jul 07 '25 20:07 huntsman95

I don't understand why nobody seems to care about this specific issue...

Dehumanizer77 avatar Jul 07 '25 20:07 Dehumanizer77