jbdemonte
jbdemonte

Reputation: 705

bounds.contains failed while it should not

On the example http://gmap3.net/issues/contains-failed.html

map.getBounds().contains(marker.getPosition()) failed while the marker is visible,

if i change the map width from 1200px to 800px, it succeed

is it a known issue ?

Regards,

Jean-Baptiste.

Upvotes: 0

Views: 175

Answers (1)

Engineer
Engineer

Reputation: 48793

With '800px' width, you have these bounds:

(-57.31109738854086, -173.32397500000002),    //south west GPS -> sw
(84.67616358203445, 178.23852499999998)       //north east GPS -> ne

In '1200px' case:

(-57.31109738854086, 151.51977499999998),    //south west GPS  -> sw
(84.67616358203445, -146.60522500000002)     //north east GPS  -> ne

Your marker have (49.00408, 2.562279999999987) coordinates.So for 1st case:

-57.31109738854086    <    49.00408         <     84.67616358203445   //true
-173.32397500000002   <  2.562279999999987  <     178.23852499999998  //true

and for 2nd one:

-57.31109738854086    <    49.00408         <     84.67616358203445   //true
151.51977499999998    <  2.562279999999987  <    -146.60522500000002  //false

That is why, you get "No" as an alert in 2nd case, and "Yes" in 1st case.

Upvotes: 1

Related Questions