On Thu, Dec 18, 2008 at 05:44:23PM -0000, André Matos wrote: > 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: > > Is this the best way to implement custom controls?
I think so. > Will OpenLayers > developers change the not API methods, initialize, draw, destroy or the div > property defined at Control Class? I think it's fair to say we won't change any of those. I'll wait for dissenting opinions before changing the docs. > 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 Generally speaking, we try not to .destroy() anything we don't create -- meaning it would be up to application designers to destroy things. When the map itself is destroyed, we do destroy any control associated with it -- but removing a control is not equivilant to wanting it destroyed. Instead, it's a sign that the control should no longer be visible on the map. The user might then take that same control and addi t back to the map later. So, this is just representative of our conservative destruction philosophy. Regards, -- Christopher Schmidt MetaCarta _______________________________________________ Users mailing list [email protected] http://openlayers.org/mailman/listinfo/users
