IITC-CE / ingress-intel-total-conversion

intel.ingress.com total conversion user script with some new features. Should allow easier extension of the intel map.
https://iitc.app
ISC License
284 stars 110 forks source link

IITCm: location button doesn't function #19

Closed johnd0e closed 5 years ago

johnd0e commented 5 years ago

In debug build

modos189 commented 5 years ago

I do not confirm. I need the same time to search for coordinates, as in the release version

johnd0e commented 5 years ago

Well, I've seen the same behaviour on two phones.

I've found that it depends on 'Display user location on map' option.

If it is off then after button press the map actually moves to current location, but there is side effect: zoom set to max (21).

If it is on then I cannot see any action on button press.

modos189 commented 5 years ago

Oh, I see what you mean. Marker coordinates as long sought as before, but the button, Yes, broke E/iitcm-console: <script/total-conversion-build.user.js>:2781: Uncaught Error: Invalid LatLng object: (50.38889695156461, NaN)

johnd0e commented 5 years ago

As for marker, set map to Google, and zoom >=16.

I see strange circle over user location marker.

johnd0e commented 5 years ago

Thanks, button now works again.

Circle is not 'strange' now, just transparent. But previously it looked differently (not sure, may be there was gradient). ~So question: is this change intended?~

Update: obviously intended https://github.com/IITC-CE/ingress-intel-total-conversion/commit/e3ddc617dfe08f17be58b03be36c56f1b87d4905.

johnd0e commented 5 years ago

And also I mentioned other strange thing, not related to recent changes. Zoom changes when using location button, but target zoom value is not consistent and depends on option Display user location on map:

Actually, this is not related to recent updates, the same behavior I see in 'official' app. When Use Canvas rendering is on zoom is 17/21. When Use Canvas rendering is off zoom is 17/19.

So questions:

  1. Why it depends on canvas rendering? Probably bug.
  2. Why it depends on Display user location on map? May be intended, but I do not understand the goal.
modos189 commented 5 years ago

So question: is this change intended?

Yes, there was a gradient, made the circle more flat in the style of Ingress Prime and Google Maps.

2\. Why it depends on `Display user location on map`?

It's not a bug, it's a feature =) https://github.com/IITC-CE/ingress-intel-total-conversion/blob/e3ddc617dfe08f17be58b03be36c56f1b87d4905/mobile/app/src/main/java/org/exarhteam/iitc_mobile/IITC_Mobile.java#L643-L653

1. Why it depends on canvas rendering? Probably bug.

And here I can not say. Probably a bug

johnd0e commented 5 years ago

It's not a bug, it's a feature =)

I can't understand it from code. Could you explain?

I see that there are two different actions depending on mUserLocation state. But I do not see why zoom value should be different in both cases.

modos189 commented 5 years ago

To reduce the options, we assume that Persistent zoom level is disabled.

If the Display user location on map is turned off, pressing the button does not have time to find GPS and positioning on networks is used. Zooming is carried out by using Leaflet:

window.map.locate({setView : true

If true, automatically sets the map view to the user location with respect to detection accuracy, or to world view if geolocation failed. https://leafletjs.com/reference-1.3.4.html#locate-options-setview

If the Display user location on map is turned on, https://github.com/IITC-CE/ingress-intel-total-conversion/blob/e3ddc617dfe08f17be58b03be36c56f1b87d4905/mobile/app/src/main/java/org/exarhteam/iitc_mobile/IITC_Mobile.java#L646-L648 calls the method https://github.com/IITC-CE/ingress-intel-total-conversion/blob/e3ddc617dfe08f17be58b03be36c56f1b87d4905/mobile/app/src/main/java/org/exarhteam/iitc_mobile/IITC_UserLocation.java#L163-L174 which calls a javascript function https://github.com/IITC-CE/ingress-intel-total-conversion/blob/e3ddc617dfe08f17be58b03be36c56f1b87d4905/mobile/plugins/user-location.user.js#L81-L109 here, depending on the accuracy of the location, the zoom value is calculated: https://github.com/IITC-CE/ingress-intel-total-conversion/blob/e3ddc617dfe08f17be58b03be36c56f1b87d4905/mobile/plugins/user-location.user.js#L94-L96 and in the case of the exact location not to zoom in too much, the zoom is limited to a value of 17: https://github.com/IITC-CE/ingress-intel-total-conversion/blob/e3ddc617dfe08f17be58b03be36c56f1b87d4905/mobile/plugins/user-location.user.js#L100

I guess you meant not as much detail but it will help you and others better understand how it all works =)

johnd0e commented 5 years ago

Zooming is carried out by using Leaflet:

So in canvas mode Leaflet behaves differently (21>19). Do you think this zoom/accuracy math is really useful?

(For me, it would be better just activate persistent zoom option)

modos189 commented 5 years ago

Probably doesn't matter to me. But if such a function has been added, maybe there are those who are more comfortable? Interesting to know

johnd0e commented 5 years ago

Ok then. Thanks.