I like the MVCArrayBinder adaptor.  This uses only documented features
so it will continue to work.

One caveat: while MVCArrayBinder correctly forwards get/set calls to
its MVCArray, it does not forward events from the MVCArray to its
observers.  This means that if you directly call
polyline.getPath().setAt(0, ...), the 0th Marker does not know it
needs to repaint.

MVCArrayBinder could support this too, like:

function MVCArrayBinder(mvcArray){
  var me = this;
  me.array_ = mvcArray;

  function forwardSetAt(index) {
    google.maps.event.trigger(me, index + '_changed');
  }
  google.maps.event.addListener(mvcArray, 'set_at', forwardSetAt);
}

Note: I haven't checked that this code works, so there might be a bug.
 But you get the idea.

Ben

On Thu, Jul 22, 2010 at 12:55 AM, Nianwei Liu <nian...@gmail.com> wrote:
>
> After some extra thinking I believe this should always work, it has
> nothing to do with undocumented feature.
>
> The fact is that the the drag action triggers Marker set('position')
> which is bind to the Polyline path's set('prefix'<i>) method. It then
> calls setAt, and that is a legit method to triggers a poly redraw.
>
>
> On Jul 21, 10:46 am, Joseph Elfelt <josephelf...@gmail.com> wrote:
> > Fantastic!
> > You get a star.
> >
> > Hmmmm.....do I dare put this in my app given that it is undocumented?
> >
> > On Jul 21, 7:39 am, Nianwei Liu <nian...@gmail.com> wrote:
> >
> > > This one is a bindTo Solution.
> >
> > >http://gmaps-utility-gis.googlecode.com/svn/trunk/v3test/mvc/poly_bin...
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Google Maps JavaScript API v3" group.
> To post to this group, send email to google-maps-js-api...@googlegroups.com.
> To unsubscribe from this group, send email to 
> google-maps-js-api-v3+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/google-maps-js-api-v3?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Maps JavaScript API v3" group.
To post to this group, send email to google-maps-js-api...@googlegroups.com.
To unsubscribe from this group, send email to 
google-maps-js-api-v3+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-maps-js-api-v3?hl=en.

Reply via email to