Destination marker distance tweak

Started by lbo, July 14, 2019, 06:21:11 PM

Previous topic - Next topic

lbo

Hi Mario,

thanks for making the distance of the destination marker depending on the map size.

May I provide a further improvement? Currently, the distance is calculated as a difference of longitudes and then 1/3 added to the latitude. If the map is wider than high, the offset is larger than intended.

I suggest to either use the latitude difference to calculate the latitude offset:
var dist = (self.gMap.getBounds().getNorthEast().lat() - self.gMap.getBounds().getSouthWest().lat()) * 0.33;

Or make a longitude offset from the longitude difference in maputility.js

Don't know how the OpenLayers box indices map to lat/lon.

Oliver

Mario

I went to an easy solution that should work great in most use cases.
I don't know how your Map Panel layout looks and if this is really something that needs to be further optimized.
Although i agree that calculating based on lng and adding to lat is a typo. I shall look at this when I have some free time (hah!).

If other users see this also as a problem / required enhancement, they can upvote this.
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

lbo

#2
Sorry, didn't see the second part of your posting when I made my first (long) reply.

Oliver

lbo

both fixes are pretty simple, I already patched my copy:

gmaps.js: Replace "lng" with "lat" in line 2060 as I already wrote in the OP.

olmap.js: let dist = Math.abs(box[3] - box[1]) * 0.2; in line 2771

In addition to swapping lat and lng, I reduced the factor from 0.33 to 0.2: That's large enough to grab the desc marker with the mouse and small enough to have it on screen even if the original coordinate is somewhat in the upper half of the window.

Oliver

Mario

There. You have solved it for your case. Remember to re-apply your changes when a new version of IMatch is released.
I guess that 20% is to less for most users, for example. I will keep the proven 33%.
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

lbo

Quote from: Mario on July 14, 2019, 08:36:08 PM
There. You have solved it for your case. Remember to re-apply your changes when a new version of IMatch is released.

Maybe the lat/lon bug will be fixed then. I won't patch only to get 20%.

Quote from: Mario on July 14, 2019, 08:36:08 PMI guess that 20% is to less for most users, for example. I will keep the proven 33%.

Try it before you decide, it's a matter of taste. But consider the possibility that the initial coordinate might be in the upper half of the screen.

Oliver

Mario

There are always edge cases. If other users want changes, they can let me know below.
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

jch2103

I like lbo's fix. On my 1920x1024 monitor, the default behavior puts the destination marker above (outside) the map boundaries in the default window layout position. I'll think about some additional tweaks.
John