Merge pull request #1923 from grypho/master

Bugfix: #1922 Unintended horizontal shift between Gantt and Resource view
This commit is contained in:
Jeroen Baten 2019-10-16 14:10:50 +02:00 committed by GitHub
commit 53a98263f8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 2 deletions

7
ganttzk/src/main/java/org/zkoss/ganttz/Planner.java Normal file → Executable file
View file

@ -620,7 +620,12 @@ public class Planner extends HtmlMacroComponent {
westContainer.addEventListener(
Events.ON_SIZE,
event -> Clients.evalJavaScript("ganttz.TaskList.getInstance().legendResize();"));
event -> Clients.evalJavaScript("ganttz.TaskList.getInstance().legendResize();")
);
// Force layout resize after composition. Otherwise the legend will be
// too small and the chart will be out of sync to the Gantt diagram.
Clients.evalJavaScript("ganttz.TaskList.getInstance().legendResize();");
}

6
ganttzk/src/main/resources/web/js/ganttz/TaskList.js Normal file → Executable file
View file

@ -29,8 +29,12 @@ ganttz.TaskList = zk.$extends(
},
legendResize : function() {
console.log("LegendResize");
// Calculate width dependant to the preceeding elements. Otherwise
// the elements will be horizontally shifted.
var taskdetailsContainer = jq('.taskdetailsContainer')[0];
jq('.legend-container').width(taskdetailsContainer.clientWidth - 75);
var tabControl = jq('.legend-container').closest('.z-tabbox').find('.charts-tabbox');
jq('.legend-container').width(taskdetailsContainer.clientWidth - tabControl.width()); // 75px is the width of the tabs on the left
},
refreshTooltips : function() {