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
290 stars 109 forks source link

Map exception when panning beyond N || S bounds of the map #177

Closed johnd0e closed 4 years ago

johnd0e commented 5 years ago
RangeError: Maximum call stack size exceeded
    at isNaN (<anonymous>)
    at new LatLng (<anonymous>:2759:6)
    at Object.wrapLatLng (<anonymous>:2975:10)
    at LatLng.wrap (<anonymous>:2810:16)
    at NewClass.<anonymous> (<anonymous>:740:46)
    at NewClass.fire (<anonymous>:1983:11)
    at NewClass.panBy (<anonymous>:4700:16)
    at NewClass._tryAnimatedPan (<anonymous>:5973:8)
    at NewClass.setView (<anonymous>:4578:10)
    at NewClass.panTo (<anonymous>:4690:15)

or

VM28:16080 Uncaught RangeError: Maximum call stack size exceeded
    at NewClass._tryAnimatedPan (<anonymous>:5971:54)
    at NewClass.setView (<anonymous>:4578:10)
    at NewClass.panTo (<anonymous>:4690:15)
    at NewClass.<anonymous> (<anonymous>:742:11)
    at NewClass.fire (<anonymous>:1983:11)
    at NewClass.panBy (<anonymous>:4700:16)
    at NewClass._tryAnimatedPan (<anonymous>:5973:8)
    at NewClass.setView (<anonymous>:4578:10)
    at NewClass.panTo (<anonymous>:4690:15)
    at NewClass.<anonymous> (<anonymous>:742:11)

or some other similar variable stack trace.

McBen commented 4 years ago

Problem is raised by this part:

https://github.com/IITC-CE/ingress-intel-total-conversion/blob/ea9cb98e73ec0dcc53addd955fdae7edc57b0891/core/code/boot.js#L302-L310

panTo fires another "moveend" event with an unchanged (?) mapCenter.

johnd0e commented 4 years ago

Main question: why do we ever need this manual 'clamping'? Isn't it the same as maxBounds in map options?

maxBoundsViscosity looks interesting too.

johnd0e commented 4 years ago

And perhaps map option worldCopyJump should perform better than manual wrap-n-pan.

Edit: it fixes also issue similar to described in title message, but with longitude (e.g. if open https://intel.ingress.com?ll=0,180)