mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-14 13:18:15 +02:00
Fix performance issue where breathe behavior would be called for each selected element instead of just for the surface (close #3571)
This commit is contained in:
@@ -126,12 +126,19 @@ export function behaviorBreathe() {
|
||||
_selected = currSelected.call(calcAnimationParams);
|
||||
}
|
||||
|
||||
var didCallNextRun = false;
|
||||
|
||||
_selected
|
||||
.transition()
|
||||
.duration(duration)
|
||||
.call(setAnimationParams, fromTo)
|
||||
.on('end', function() {
|
||||
surface.call(run, toFrom);
|
||||
// `end` event is called for each selected element, but we want
|
||||
// it to run only once
|
||||
if (!didCallNextRun) {
|
||||
surface.call(run, toFrom);
|
||||
didCallNextRun = true;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user