[OpenLayers-Users] MousePosition redraw issue caused by DragPan interval [SEC=UNCLASSIFIED]

Matthew Doyle M.Doyle at bom.gov.au
Wed Jan 28 01:51:43 EST 2009


Hi All,
 
I've recently upgraded to 2.7 and noticed a change to the DragPan class
- in particular the addition of a timeout interval of 25ms to allow
smoother panning when dragging the mouse. 
 
This works great, but when the MousePosition control is used in
conjunction with this I see many unnecessary calcs and redraw() calls
which, a) slow down the map and b) incorrectly show flickering lon/lat
values that are being called during that 25ms interval. 
 
Am I right to assume this is a bug? I have searched the tickets and
Mailing list and not found anything about it so far. Happy to create a
ticket for it if it is a new one.
 
I have written a quick and (very) rudimentary fix for this in my dev
area which sets a new global flag 'map.currentlyPanning' and checks it
before attempting to execute the redraw() code in MousePosition.
 
DragPan.js:
 
   panMap: function(xy) {
        this.panned = true;
        this.map.currentlyPanning = true;
 
(...)

   panMapDone: function(xy) {
       if(this.panned) {
            this.panMap(xy);
            this.panned = false;
            this.map.currentlyPanning = false;

(...)
 
 
MousePosition.js:
 
    redraw: function(evt) {
        if(!this.map.currentlyPanning) {
            var lonLat;
(...)
 
 
This works, but I know that there is probably a much better way and
would probably be best to use the 'panning' flag already set up in that
class but I'm not sure how it will be possible to access it since it's
private to that class?
 
Looking forward to your input on this one.
 
Best regards,
Matt
 
 
 
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20090128/c3ec113b/attachment.html


More information about the Users mailing list