On Jan 9, 2:23 pm, gordon zhao <
gord.z...@gmail.com> wrote:
> Hi bratliff, what you have done is great. I finished my function with
> your PolyCluster class. Thank you again.
>
> Inhttp://
www.polylib.us/polycluster/coast:
>
> l=[];
>
> z={fill:1,stroke:1,fillAlpha:0.4,strokeAlpha:0.6,weight:
> [1,1,1,1,1,1,2,4,8,16,32,64]};
>
> for (q in poly)
> {
> l[q]={fillColor:color[i],strokeColor:color[i]};
>
> cluster.setStyle(l,z);
>
> i=(i+1)%8;
> }
> you can see cluster.setStyle(l,z) line. l is not a poly line object or
> string but a style object, however, it still work. If I change l to q
> it works as well. It won't bother me since both ways work, but I think
> it's better to let you know.
I know the documentation is rather sparse. "setStyle" accepts several
sets of arguments.
String Scalar:
cluster.setStyle("Hawaii" , {private style object});
String Vector:
cluster.setStyle(["Hawaii","Oahu", ... ] , {shared style object});
Object (private):
cluster.setStyle({Hawaii:{private style object},Oahu:{private
style object}, ... });
Object (shared):
cluster.setStyle({Hawaii:{private style object},Oahu:{private
style object}, ... } , {shared style object});
If both "private" & "shared" style objects are specified, conflicts
are resolved in favor of the "private" style element.
The demo uses the final case. Color attributes are "private". Other
attributes are "shared".
If you call with "q", you are using the first form with all attributes
"private". If you call with "l", you are using the last form with
some attributes "private" & some attributes "shared".
Actually, the demo is wrong. I should have placed the "setStyle" call
outside the loop. It is more efficient to do it in one call than to
do it in several calls. Single updates are applied to the screen
immediately. Bulk updates are deferred. For just eight polys, it may
be irrelevant. I will change the demo.
> Also kindly remind people that polycluster.js should be loaded after
> google maps js.
You just did.
For what it is worth, I have CANVAS mouse events working. It is much
quicker than SVG. It has the added capability of reporting multiple
hits if the polys overlap I will roll it out tomorrow if it does not
break anything.