[OpenLayers-Dev] 3016-new event-in "toState" method or triggered locally ?

Alexandre Dube adube at mapgears.com
Mon Mar 7 14:03:15 EST 2011


Hi,

   I'm working on this ticket [1] where I'm adding a new 
"featurestatechanged" event in the OL.Layer.Vector.  It should be 
triggered every time a feature.state is set to a new value.

   Looking at OL.Feature.Vector, I can see that there is a "toState" 
method where I also need to trigger this new event.  That makes me think 
: why isn't this method used everywhere when setting a new state ?  It 
has been there for a long time [2] but doesn't seem to be much used 
(currently only by the OL.Control.TransformFeature control).

   So, would it be okay if every line of code using "feature.state = 
newState" were replaced by "feature.toState(newState)" to allow the new 
event to be  triggered inside the toState method only, or should it be 
left as it is and add the event trigger after each "feature.state = 
newState" line ?

Thanks for any comments,

[1] http://trac.osgeo.org/openlayers/ticket/3016
[2] http://trac.osgeo.org/openlayers/changeset/2336

-- 
Alexandre Dubé
Mapgears
www.mapgears.com



More information about the Dev mailing list