[OpenLayers-Users] Implementing OpenLayers in JavaScript
object: scope issues
gingerbbm
stuart.jones at jacobs.com
Thu Jan 22 13:15:42 EST 2009
OK, I got it working, by sheer luck of twiddling (though I've been doing that
for a while now). I changed two things and moved it all to a function. I
think the key to it was ensuring that the function was called after the
creation of the vector layer.
MyProject.Mapping.drawTools = { // here
toolDrawPolygon: new OpenLayers.Control.DrawFeature(
MyProject.Mapping.layerVector, // here
OpenLayers.Handler.Polygon,
{
featureAdded: function() { alert('Polygon drawn'); },
handlerOptions: {
createFeature: function() {
MyProject.Mapping.layerVector.destroyFeatures();
OpenLayers.Handler.Polygon.prototype.createFeature.apply(this, arguments);
}
}
}
)
};
--
View this message in context: http://n2.nabble.com/Implementing-OpenLayers-in-JavaScript-object%3A-scope-issues-tp2198920p2199249.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.
More information about the Users
mailing list