Ticket #1503 (closed bug: fixed)
panning off for odd-sized viewport
|Reported by:||tschaub||Owned by:|
This can be demonstrated from the full screen example.
Adjust the window size until you have an odd-sized viewport. Pan in the odd direction to see problem.
The issue came up in r6492.
Imagine a map that is 10 pixels wide. Setting the center to 0 gives you a layer container origin of 0 (map units). Convert this to pixels with map.getViewPortPxFromLonLat and you get 5.
Imagine a map that is 11 pixels wide. Setting the center to 0 gives you a layer container origin of 0 (map units). Convert this to pixels with map.getViewPortPxFromLonLat and you get 6. The *real* pixel center, however, is 5.5.
Drag this odd-sized map one pixel to the right. The new center (pretend we have a resolution of 1) is -1. The DragPan control tells the map to pan with a dx of -1 (weird that this is negative, but that's the requirement from the map.pan method). The new center is correctly calculated and set.
Then map.centerLayerContainer is called with that center. The layer container origin (remember, it was 0 in map units) is one map unit to the right of the map center. However, the map.getViewPortPxFromLonLat returns 6 for both the layer container origin and the new center.
This explanation lacks some detail, but I'm out of energy.