[OpenLayers-Trac] Re: [OpenLayers] #2213: Yahoo reloads all tiles on moveend

OpenLayers trac-20090302 at openlayers.org
Sun Feb 27 19:33:54 EST 2011

#2213: Yahoo reloads all tiles on moveend
 Reporter:  Specious     |       Owner:  euzuro      
     Type:  bug          |      Status:  new         
 Priority:  minor        |   Milestone:  2.11 Release
Component:  Layer.Yahoo  |     Version:  SVN         
 Keywords:               |       State:  Review      

Comment(by crschmidt):

 This behavior is the result of the following:
  1. When dragging the map, we use the 'dragging' flag. This flag causes
 the EventPane layer to use the this.dragPanMapObject call to set the
 center, rather than calling drawCenterAndZoom.
  2. Because of pixel->lonlat rounding errors, most of the time when we
 drop the map, we end up one pixel off. (This is probably in part because
 of the projection change as well.) If you turn on sphericalMercator and
 drag only horizontally, you'll see that the map doesn't redraw (if you
 drag slowly): this is because the last mousemove was in the same place as
 the mouseup, so the setCenter code doesn't get called.

 Dropping this last moveTo has this as a side effect, but it also has other
 negative side effects: basically, if you drag quickly on a slow computer,
 your map will get left behind when you pick up your mouse, because we
 don't move the map unless we're dragging. Something better might be to use
 the dragPan handlers more often: that is, to use a looser definition of
 when to use the dragPan handlers. (I'll be attaching a patch that does
 this.) However, that would probably require more intimate understanding of
 the underlying APIs than we'll ever get: given that the dragPan handlers
 are usually hidden APIs, their behavior is not always well defined.

 Instead, the Yahoo layer could specifically subclass moveTo and implement
 it in this way; that would probably be the solution with the least
 resistance (especially given the somewhat limited use that the Yahoo layer
 currently has), and would fix the problem without potentially breaking

 Basically, on Yahoo!, it seems drawCenterAndZoom is really only meant to
 be used rarely, not like the setCenter/moveTo in OpenLayers, or the
 setCenter in most other APIs, which are 'cheap'. Instead, it does a full
 redraw. (Googling for "moveByXy", I found someone who had expanded the
 compressed Yahoo! code; it is very clear that panByXy is cheap, and
 drawZoomAndCenter is 'expensive'.)

 I'll attach two patches. The former might be good someday, for someone who
 has time to test all our eventpane subclasses. The latter is the one I'd
 recommend now, which would help actually fix this issue without much risk.
 Tests continue to pass (though that doesn't mean much).

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

More information about the Trac mailing list