kkpowar / gmaps-utility-library-dev

Automatically exported from code.google.com/p/gmaps-utility-library-dev
0 stars 0 forks source link

Mapsicle constructor needs re-thinking #164

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
The Mapsicle constructor currently is of the form:

Mapsicle(container:Element, glatlng:GLatLng, custom:MapsicleParams)

Where MapsicleParams is:
{avoidOverlaps:boolean, normalDistance:number}

There are a couple of issues here.  First, the code forces you to pass a
latlng as a starting point.  However, it does not allow you to pass an
errorCallback that can be called if that latlng does not have a streetview.
 As a result, you get a browser alert if you pass it something like (0, 0).
 If you pass it undefined, it defaults to a hardcoded location in New Zealand.

I feel that the best solution to this would be to simply take out the
latlng parameter and have that completely handled by setPosition().  If
this is not the direction you want to go, then the parameter should be made
optional with it defaulting to NO location if the parameter isn't passed. 
Since you can't set all the various event listeners until AFTER you create
the object, you're going to need to be able to pass all of those into the
constructor, too.  This is another reason I think it's better to just take
out setting latlng in the constructor anyway.  It's best to create the
object, have a chance to set up all your event listeners, THEN set the
position.

Original issue reported on code.google.com by chimpath...@gmail.com on 25 Nov 2009 at 6:29

GoogleCodeExporter commented 8 years ago

Original comment by stephend@gmail.com on 30 Nov 2009 at 2:37

GoogleCodeExporter commented 8 years ago

Original comment by stephend@gmail.com on 13 Dec 2009 at 10:22

GoogleCodeExporter commented 8 years ago
OK, I've changed it a bit. If you pass a LatLng, you'll get the existing 
behaviour.
If you don't, instead of launching into Courtenay Place, Mapsicle will wait for 
you
to call setPosition. 

This limbo state should work the same way as if there was an error launching 
with
your chosen LatLng: most events won't be fired, and most features won't work.
Registering event handlers, and adding and removing locations and overlays 
should all
be fine.

When you're ready for Street View, call setPosition. If you want an error 
callback,
you'll need to write your own - the one Mapsicle would normally use during 
startup to
display error messages isn't used if you call setPosition yourself.

Original comment by stephend@gmail.com on 14 Dec 2009 at 4:40

GoogleCodeExporter commented 8 years ago

Original comment by stephend@gmail.com on 4 Jan 2010 at 9:14