From c9761ef2950eeb147fbf375602228c0229e3a9e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=93scar=20Gonz=C3=A1lez=20Fern=C3=A1ndez?= Date: Thu, 23 Jun 2011 21:29:40 +0200 Subject: [PATCH] Throttle the drawing of the dependencies If the dependencies have been drawn in the last 25 ms, they are not redrawn. FEA: ItEr75S08MigrationZK5 --- .../src/main/resources/web/js/ganttz/TaskComponent.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/ganttzk/src/main/resources/web/js/ganttz/TaskComponent.js b/ganttzk/src/main/resources/web/js/ganttz/TaskComponent.js index 335abb780..2d6561516 100644 --- a/ganttzk/src/main/resources/web/js/ganttz/TaskComponent.js +++ b/ganttzk/src/main/resources/web/js/ganttz/TaskComponent.js @@ -125,14 +125,17 @@ ganttz.TaskComponent = zk.$extends(zul.Widget, { return ganttz.DependencyComponentBase.$(dep); }); }); + var drawDependencies = common.Common.memoize(25, function() { + relatedDependencies().forEach(function(dependency) { + dependency.draw(); + }); + }); dragdropregion.on('dragEvent', this.proxy(function(ev) { // Slight overload. It could be more efficent to overwrite the YUI // method // that is setting the top property jq(this.$n()).css('top',''); - relatedDependencies().forEach(function(dependency) { - dependency.draw(); - }); + drawDependencies(); }), null, false); // Register the event endDragEvent dragdropregion.on('endDragEvent', this.proxy(function(ev) {