diff --git a/ganttzk/src/main/resources/web/js/ganttz/DependencyComponent.js b/ganttzk/src/main/resources/web/js/ganttz/DependencyComponent.js index 871460d2c..a684a0c17 100644 --- a/ganttzk/src/main/resources/web/js/ganttz/DependencyComponent.js +++ b/ganttzk/src/main/resources/web/js/ganttz/DependencyComponent.js @@ -286,14 +286,13 @@ ganttz.UnlinkedDependencyComponent = zk.$extends(ganttz.DependencyComponentBase, ganttz.DependencyList.getInstance().removeChild(this); }, _isOverTask : function() { - var tasksArray = jq('div[z\\.type="ganttz.task.Task"]'); - var overTask = null; - - tasksArray.each(function(index, element){ - if(ganttz.TaskComponent.$(element.id).mouseOverTask) overTask = ganttz.TaskComponent.$(element.id); + var tasksOver = jq.grep(ganttz.TaskComponent.allTaskComponents(), function(task) { + return task.mouseOverTask; }); - - return overTask; + if (tasksOver.length > 0) { + return tasksOver[0]; + } + return null; }, _getCoordOrigin: function() { if (this._coordOrigin) { diff --git a/ganttzk/src/main/resources/web/js/ganttz/TaskComponent.js b/ganttzk/src/main/resources/web/js/ganttz/TaskComponent.js index 4752e4681..67c78519f 100644 --- a/ganttzk/src/main/resources/web/js/ganttz/TaskComponent.js +++ b/ganttzk/src/main/resources/web/js/ganttz/TaskComponent.js @@ -228,5 +228,12 @@ ganttz.TaskComponent = zk.$extends(zul.Widget, { _PERSPECTIVES_WIDTH : 80, CORNER_WIDTH : 20, HEIGHT : 10, - HALF_HEIGHT : 5 + HALF_HEIGHT : 5, + allTaskComponents: function() { + var tasksArray = jq('div[z\\.type="ganttz.task.Task"]') + .add('div[z\\.type="ganttz.taskcontainer.TaskContainer"]'); + return jq.map(tasksArray, function(element) { + return ganttz.TaskComponent.$(element.id); + }); + } }); \ No newline at end of file