Hi Guys!
I am starting on OpenLayers API and I have two questions I am studing the controls and I have notice that, theres no API methods or API properties in Control type. That means the open layers developers can change it, without any advise. The way I am doing my controls is this: MyControl = OpenLayers.Class(OpenLayers.Control, { //Constructor initialize: function(){ alert("ctr"); }, //called when the user adds the control to the map. if the control wants to display information draw: function(){ OpenLayers.Control.prototype.draw.apply(this); var div = document.createElement("div"); div.style.width = "100px"; div.style.height = "100px"; div.style.background = "black"; this.div.appendChild(div); return this.div; }, //called when the user removes the control from the map destroy: function(){ OpenLayers.Control.prototype.destroy.apply(this); alert("destroy"); }, CLASS_NAME: "MYCONTROL" }); Is this the best way to implement custom controls? Will OpenLayers developers change the not API methods, initialize, draw, destroy or the div property defined at Control Class? I need to know because I want to integrate future releases. The second question is: Why does Control.destroy method exist? This is the description in the Control Class destroy method: Method: destroy * The destroy method is used to perform any clean up before the control * is dereferenced. Typically this is where event listeners are removed * to prevent memory leaks. But it Is never called. The control is dereferenced at Map.removeControl method, and this method does not call control.destroy method Thanks. André Matos
_______________________________________________ Users mailing list Users@openlayers.org http://openlayers.org/mailman/listinfo/users