Version 4 (modified by euzuro, 7 years ago)

--

OpenLayers 2.2 Release Notes

Removal of Prototype Library

  • Improvement of class definition vs instantiation (#75) old syntax:
        OpenLayers.A = Class.create();
        OpenLayers.A.prototype = 
           Object.extent( new OpenLayers.X(),
             Object.extent( new OpenLayers.Y(), { 
            //prototype goes here 
        }));
    
    new syntax:
        OpenLayers.A = OpenLayers.Class.create();
        OpenLayers.A.prototype = 
          OpenLayers.Class.inherit( OpenLayers.X, OpenLayers.Y, {
            //prototype goes here
        });
    
    Besides simply being more readable and understandable, the main benefit of this new enhancement (see r1647 for details) is that it removes the extraneous calls to classes' initialize() method during class definitions. This means no more do you need to test
        if (arguments.length > 0) 
    
    inside a superclass's constructor before doing instance-specific work, because it will only be called on instantiation of a new class.

Layers

  • Scale-dependent layer visibility All overlays now test to make sure that the current map's resolution (or scale) falls in between their minResolution and maxResolution* values. If it does not, then the layer is hidden and greyed out in the LayerSwitcher.

    *For a refresher on how resolution values are calculated, see SettingZoomLevels