-
-
Notifications
You must be signed in to change notification settings - Fork 243
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[MainUI] Map picker should center on location set in regional settings #2999
Comments
Which map picker are you referring to? Can you show some screenshots + code to create/open the map picker? |
If you create a widget, rule template, or any other config for a binding or a Channel with a property that has "location" as the context it brings up a Map to drop a pin at the location you want.
A few examples from the marketplace:
When presented on the form it appears as: Clicking on "Map" on the right side brings up the following on a desktop: Interestingly, when I opened this issue the map was more zoomed out than shown so something must have changed, or I'm completely remembering wrong. But the issue still remains that I need to zoom back out, recenter, then zoom back in recentering on each zoom to get the map scaled and centered on a region I actually care about.. And then if you have two locations you have to do it all over again because the map doesn't remember what you did when you picked the first location. We set a location for our home in the regional settings so theoretically that information should be available to center these maps on instead of centering on northeast France. It can come up zoomed in more too because most users are probably not going to care about seeing the whole continent for what ever they are doing. they probably care most about the city, maybe the region/provence/state. Does this make sense? I can try to capture a video if it helps, but you should be able to test it yourself by installing one of the above from the marketplace and setting an instance of the rule/widget up. |
I'll study this more closely tomorrow, but ideally the initial zoom, given no available position data, should be worldwide, don't you agree? And yes, I agree, if we have the position (e.g. from the regional settings or something else), then center in on that instead of worldwide. |
Yes. I seem to remember it used to be worldwide when I wrote this issue, but now I'm doubting my memory. |
This part is a bit tricky. I'm not familiar with widget design, but afaik, you can't add some javascript in there to manipulate other component properties, e.g. to give the "destination" map input the location of the "source" input in order for it to go there as the initial location. The next best (and easiest) to do is to use system location as the initial location, but this won't relate to the first input. Only by virtue that most people would probably enter something near their system location and not on the other side of the globe. @rkoshak are you running 4.3.x or 5.0? I have a webui jar for you to test. |
My thought was that the same map widget would be reused or something like that instead of somehow passing the location chosen the first time to the second map. But I agree, if the map starts closer to home, it's not that annoying if it's always centered on home instead of centered where ever it was last. I'm on 4.3 but can update to 5 if that's easier. |
I am not aware of such mechanism. The next best thing is to save the last location of the map to be reused by the next (indeterminate) map picker, but that might have some undesired side effects, so I'm not sure it's a good idea.
I'll build a 4.3 one, give me 10-15 minutes. |
OOops, I uploaded the wrong jar (sources) sorry. This is the right one Try this jar. You can drop it into the addons folder, disable the built in one ( |
And this is the 4.3 version |
I had to restart OH to get it to work. Not sure why but it came up with a blank map. Once I restarted it appears to work. My only request would be to set the initial zoom at two to three levels further out. But that's mainly for my personal use cases. I can see other use cases where zooming in that far makes sense too so don't let this request block anything. Is it possible to drop the pin (i.e. default the selected location) to the home lat/lon? I imagine it will frequently be the case where a user will want to choose their home location. Defaulting that could save them a step in those cases. |
Personally, I'd prefer not to automatically drop a pin, because it would be annoying in the case when you have an empty input field, and someone clicked it just to "see" and want to back out without changing anything. By dropping a pin, now the field has changed. What would be great though is to have the ability to specify some defaults. I may create a separate PR to do that. |
If it's a required field it's going to have to change anyway. But that's an angle I didn't think of. If there is already something in the field, the map should center on that I would think. That's what I would expect. Regardless, these changes address my major concerns. Thanks! |
The problem
When the map picker first comes up to choose a lat/lon, it is fully zoomed out centered over Europe.
Your suggestion
It would be more user-friendly if the map picker used the location set in the regional settings (if it's set, current behavior is fine if not) and use a lot more zoomed in level. If a user is choosing a location for their home automation, they are likely wanting something reasonably close to home so something showing 100 mi/200 km (I know that's not the same) or so would be about right.
As a bonus, if it can remember where it was the last time it was used that would be nice. I just created a rule template that uses a location context. It's great that it lets users use the map picker but they need to pick two points and when opening the new map one needs to zoom and scroll all over again.
Your environment
Additional information
The text was updated successfully, but these errors were encountered: