[OpenLayers-Trac] [OpenLayers] #3416: Layer vector initializes EVENT_TYPES in wrong way

OpenLayers trac-20090302 at openlayers.org
Mon Jul 18 06:46:35 EDT 2011


#3416: Layer vector initializes EVENT_TYPES in wrong way
-------------------------------------+--------------------------------------
 Reporter:  jachym                   |       Owner:  crschmidt   
     Type:  bug                      |      Status:  new         
 Priority:  minor                    |   Milestone:  2.12 Release
Component:  Layer.Vector             |     Version:  SVN         
 Keywords:  EVENT_TYPES, initialize  |       State:              
-------------------------------------+--------------------------------------
 Hi,

 in lib/OpenLayers/Layer/Vector, initialize method, there is

 {{{
 244             // concatenate events specific to vector with those from
 the base
 245             this.EVENT_TYPES =
 246                 OpenLayers.Layer.Vector.prototype.EVENT_TYPES.concat(
 247                 OpenLayers.Layer.prototype.EVENT_TYPES
 248             );
 }}}

 http://trac.osgeo.org/openlayers/browser/trunk/openlayers/lib/OpenLayers/Layer/Vector.js#L242

 But creating new CLASS, derived from OpenLayers.Layer.Vector, with custom
 EVENT_TYPES is not possible in this case, bacause if you call initialize,
 custom EVENT_TYPES will *always* be overwritten by
 OpenLayers.Layer.Vector.prototype.EVENT_TYPES.

 Solution:

 {{{
 245             this.EVENT_TYPES =
 246                 this.EVENT_TYPES.concat(
 247                 OpenLayers.Layer.prototype.EVENT_TYPES
 248             );
 }}}

-- 
Ticket URL: <http://trac.openlayers.org/ticket/3416>
OpenLayers <http://openlayers.org/>
A free AJAX map viewer


More information about the Trac mailing list