Giter VIP home page Giter VIP logo

Comments (12)

modos189 avatar modos189 commented on May 31, 2024

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

from ingress-intel-total-conversion.

johnd0e avatar johnd0e commented on May 31, 2024

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.

from ingress-intel-total-conversion.

modos189 avatar modos189 commented on May 31, 2024

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)

from ingress-intel-total-conversion.

johnd0e avatar johnd0e commented on May 31, 2024

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

I see strange circle over user location marker.

from ingress-intel-total-conversion.

johnd0e avatar johnd0e commented on May 31, 2024

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 e3ddc61.

from ingress-intel-total-conversion.

johnd0e avatar johnd0e commented on May 31, 2024

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:

  • on: 17
  • off: 21 (!!)

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.

from ingress-intel-total-conversion.

modos189 avatar modos189 commented on May 31, 2024

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 =)

case R.id.locate: // get the users current location and focus it on map
switchToPane(Pane.MAP);
if (mUserLocation.hasCurrentLocation()) {
// if gps location is displayed we can use a better location without any costs
mUserLocation.locate(mPersistentZoom);
} else {
// get location from network by default
mIitcWebView.loadUrl("javascript: window.map.locate({setView : true" +
(mPersistentZoom ? ", maxZoom : map.getZoom()" : "") + "});");
}

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

And here I can not say. Probably a bug

from ingress-intel-total-conversion.

johnd0e avatar johnd0e commented on May 31, 2024

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.

from ingress-intel-total-conversion.

modos189 avatar modos189 commented on May 31, 2024

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,

if (mUserLocation.hasCurrentLocation()) {
// if gps location is displayed we can use a better location without any costs
mUserLocation.locate(mPersistentZoom);

calls the method
public void locate(final boolean persistentZoom) {
// do not touch the javascript while iitc boots
if (mIitc.isLoading()) return;
final Location location = mLastLocation;
if (location == null) return;
mIitc.getWebView().loadJS("if(window.plugin && window.plugin.userLocation)"
+ "window.plugin.userLocation.locate("
+ location.getLatitude() + ", " + location.getLongitude() + ", "
+ location.getAccuracy() + ", " + persistentZoom + ");");
}

which calls a javascript function
window.plugin.userLocation.locate = function(lat, lng, accuracy, persistentZoom) {
if(window.plugin.userLocation.follow) {
window.plugin.userLocation.follow = false;
if(typeof android !== 'undefined' && android && android.setFollowMode)
android.setFollowMode(window.plugin.userLocation.follow);
return;
}
var latlng = new L.LatLng(lat, lng);
var latAccuracy = 180 * accuracy / 40075017;
var lngAccuracy = latAccuracy / Math.cos(Math.PI / 180 * lat);
var zoom = window.map.getBoundsZoom(L.latLngBounds(
[lat - latAccuracy, lng - lngAccuracy],
[lat + latAccuracy, lng + lngAccuracy]));
// an extremely close view is pretty pointless (especially with maps that support zoom level 20+)
// so limit to 17 (enough to see all portals)
zoom = (persistentZoom) ? map.getZoom() : Math.min(zoom,17);
if(window.map.getCenter().distanceTo(latlng) < 10) {
window.plugin.userLocation.follow = true;
if(typeof android !== 'undefined' && android && android.setFollowMode)
android.setFollowMode(window.plugin.userLocation.follow);
}
window.map.setView(latlng, zoom);
}

here, depending on the accuracy of the location, the zoom value is calculated:
var zoom = window.map.getBoundsZoom(L.latLngBounds(
[lat - latAccuracy, lng - lngAccuracy],
[lat + latAccuracy, lng + lngAccuracy]));

and in the case of the exact location not to zoom in too much, the zoom is limited to a value of 17:
zoom = (persistentZoom) ? map.getZoom() : Math.min(zoom,17);

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

from ingress-intel-total-conversion.

johnd0e avatar johnd0e commented on May 31, 2024

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)

from ingress-intel-total-conversion.

modos189 avatar modos189 commented on May 31, 2024

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

from ingress-intel-total-conversion.

johnd0e avatar johnd0e commented on May 31, 2024

Ok then. Thanks.

from ingress-intel-total-conversion.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.