[OpenLayers-Users] Selectfeature after DrawFeature
Marco Scheuble
mail at marco-scheuble.de
Tue Jan 8 02:41:15 PST 2013
Hi Alexandre,
I tried your solution, but unfortunately it doesn't work for me ( OL 2.12 ).
Indeed, the feature will be selected, but somehow afterwards it will be
automatically unselected.
In my code-example both alerts will be run: "selected" and "unselected"
cheers, Marco
--------------------------------------------------------
selectControl = new OpenLayers.Control.SelectFeature( pois, { onSelect:
onFeatureSelect, onUnselect: onFeatureUnselect } );
drawControl = new OpenLayers.Control.DrawFeature( pois,
OpenLayers.Handler.Point);
drawControl.events.on( {'featureadded': onFeatureAdded, scope: this });
function onFeatureAdded( addedFeature ){
addedFeature.feature.state = OpenLayers.State.INSERT;
selectControl.activate();
drawControl.deactivate();
selectControl.select( addedFeature.feature );
}
function onFeatureSelect( feature ) { alert( "selected" ); }
function onFeatureUnselect( feature ) { alert( "unselected" ); }
--------------------------------------------------------
--
View this message in context: http://osgeo-org.1560.n6.nabble.com/Selectfeature-after-DrawFeature-tp5018519p5026116.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.
More information about the Users
mailing list