mirror of
https://github.com/FoggedLens/iD.git
synced 2026-02-25 06:55:46 +00:00
Manual redraw debouncing
This avoids a duplicate full redraw at the end of a drag pan. The redraw triggered by mouseup.zoom now cancels the pending debounced redraw. Also, bump the debounce interval to 300ms, which helps avoid full redraws during scroll zoom, making it more responsive.
This commit is contained in:
@@ -146,6 +146,8 @@ iD.Map = function(context) {
|
||||
}
|
||||
|
||||
function redraw(difference) {
|
||||
clearTimeout(timeoutId);
|
||||
|
||||
// If we are in the middle of a zoom/pan, we can't do differenced redraws.
|
||||
// It would result in artifacts where differenced entities are redrawn with
|
||||
// one transform and unchanged entities with another.
|
||||
@@ -173,7 +175,11 @@ iD.Map = function(context) {
|
||||
return map;
|
||||
}
|
||||
|
||||
var queueRedraw = _.debounce(redraw, 200);
|
||||
var timeoutId;
|
||||
function queueRedraw() {
|
||||
clearTimeout(timeoutId);
|
||||
timeoutId = setTimeout(function() { redraw(); }, 300);
|
||||
}
|
||||
|
||||
function pointLocation(p) {
|
||||
var translate = projection.translate(),
|
||||
|
||||
Reference in New Issue
Block a user