[OpenLayers-Trac] [OpenLayers] #1125: Smoother dragging of the map on older computers

OpenLayers trac at openlayers.org
Thu Nov 8 15:46:15 EST 2007


#1125: Smoother dragging of the map on older computers
----------------------------------+-----------------------------------------
  Reporter:  haakeyar             |       Owner:  tschaub
      Type:  bug                  |      Status:  new    
  Priority:  minor                |   Milestone:         
 Component:  Control.DragFeature  |     Version:  SVN    
Resolution:                       |    Keywords:  review 
----------------------------------+-----------------------------------------
Comment (by haakeyar):

 Replying to [comment:4 ahocevar]:
 > So I would suggest to do the delay in Handler/Drag.js. By doing so,
 every control interaction that is linked to the move function of the
 handler will feel more responsive.
 >
 > I attached a patch with the required change. It should have the same
 effect on responsiveness of map dragging as the original patch.
 >
 > I created a patch as an alternative of yours.
 Thanks for your feedback and alternative patch. :)

 That could possibly work out well, with a little tweaking. As far as I can
 see now, though (without testing your patch), I can't imagine that it will
 work in it's current state. For example, the panMap-function uses the
 last.x and last.y values of the handler to calculate the new position of
 the map. Also, I don't understand your logic with the
 setTimeout/clearTimeout. As far as I can see, with your code, the map
 won't be updated before you stop dragging for 50ms.
 (I'm sorry if there is something terribly wrong with my code reading and
 your patch actually runs perfectly. :))

 Another concern with placing it there, is the drawing-functions. Would
 they be accurate enough with the drag position being updated only every 50
 ms or so?

 A concern with both patches is that in the call to this.map.setCenter in
 panMap, the third argument is this.handler.dragging. The value of that
 could potentionally become false before the timeout is run. I have no idea
 what that argument does and why it is there in the first place (wouldn't
 it always be true?), but it will have to bee looked into. (If no one else
 does, I'll probably look into it on saturday.)
 Things like that are more likely to appear when you add the timeout up in
 the event handling, because more code is dependent on it. This way, my
 patch would probably be more secure (security for bugs, not security-
 security), while yours would give a better result when tweaked correctly.

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


More information about the Trac mailing list