[OpenLayers-Users] Style context as an object ?

strk strk at keybit.net
Mon Jul 5 11:41:51 EDT 2010


Did anyone ever tried using a "proper" object
as a Style context ?

What I'm trying to do is create a class of style
contexts and pass instances of them (for parametrized
styles) as a Style.context, but 'this', within the
callbacks, seem to always evaluate to the top of DOM.

Example code:

  MyContextClass = function(radius) {
  	this.radius = radius;
  };
  
  MyContextClass.prototype.getRadius() {
  	alert(this.radius);
  };
  
  myContext = new MyContextClass(4);
  
  myStyle = OpenLayers.Style(
  	{ pointRadius: '${getRadius)' },
  	{ context: myContext }
  );

--strk; 

  ()   Free GIS & Flash consultant/developer
  /\   http://strk.keybit.net/services.html



More information about the Users mailing list