[OpenLayers-Trac] [OpenLayers] #937: Map.setCenter() should not call Layer.moveTo if inRange has changed to false

OpenLayers trac at openlayers.org
Fri Dec 7 05:54:44 EST 2007


#937: Map.setCenter() should not call Layer.moveTo if inRange has changed to
false
------------------------+---------------------------------------------------
  Reporter:  crschmidt  |       Owner:             
      Type:  bug        |      Status:  new        
  Priority:  major      |   Milestone:  2.6 Release
 Component:  Map        |     Version:  2.4        
Resolution:             |    Keywords:  review     
------------------------+---------------------------------------------------
Changes (by pgiraud):

  * keywords:  => review

Comment:

 After much investigation on this ticket, and especially on what is done
 into the setCenter method to call moveTo on each layer, here are few notes
 :
  - first, it seems to concern only non-baseLayer layers,
  - the check for layer inRange property change is done in SetCenter,
  - if layer inRange property changed, the "changelayer" event is triggered
 and the layer moveTo method is called, so that the diplay method can be
 called, apparently. But the moveTo method is called and for grid layers,
 it means that tiles are loaded whenever range matches or not (what user
 doesn't see because display is already set to none).
  - if layer inRange property didn't change, the moveTo method is only
 called if visibility and inRange are both true.

 What I propose is to move the inRange value change check into the layer
 calculateInrange method. There we can also set the inRange property to its
 new value, we can trigger the "changelayer" event, and we can change the
 layer display (call display method).
 Then the only thing we need to do in setCenter is to call the
 calculateInRange method so that the inRange value is updated, and check
 the layer visibility and inRange properties values.

 The proposed patch also reverses the r4069 commit not required any more.

 There is still something to check. The moveTo method in Layer.js calls the
 display method. Is it still required ? In what particular case ?

 Please review the attached patch.

-- 
Ticket URL: <http://trac.openlayers.org/ticket/937#comment:9>
OpenLayers <http://openlayers.org/>
A free AJAX map viewer


More information about the Trac mailing list