瀏覽代碼

[gantt] fix bar width

version-14
Faris Ansari 8 年之前
父節點
當前提交
069e335daf
共有 1 個檔案被更改,包括 3 行新增4 行删除
  1. +3
    -4
      frappe/public/js/frappe/views/gantt.js

+ 3
- 4
frappe/public/js/frappe/views/gantt.js 查看文件

@@ -307,7 +307,7 @@ var Gantt = Class.extend({
secondary_text_y = me.opts.header_height - 25; secondary_text_y = me.opts.header_height - 25;


if(me.view_mode === 'Month') { if(me.view_mode === 'Month') {
primary_text_x += me.opts.column_width/2;
primary_text_x += (date.daysInMonth() * me.opts.column_width/30)/2;
secondary_text_x += (me.opts.column_width * 12)/2; secondary_text_x += (me.opts.column_width * 12)/2;
} }
if(me.view_mode === 'Week') { if(me.view_mode === 'Week') {
@@ -315,6 +315,7 @@ var Gantt = Class.extend({
secondary_text_x += (me.opts.column_width * 4)/2; secondary_text_x += (me.opts.column_width * 4)/2;
} }
if(me.view_mode === 'Day') { if(me.view_mode === 'Day') {
primary_text_x += me.opts.column_width/2;
secondary_text_x += (me.opts.column_width * 30)/2; secondary_text_x += (me.opts.column_width * 30)/2;
} }
if(me.view_mode === 'Quarter Day') { if(me.view_mode === 'Quarter Day') {
@@ -511,10 +512,8 @@ var Bar = Class.extend({
prepare_values: function() { prepare_values: function() {
this.x = this.compute_x(); this.x = this.compute_x();
this.y = this.compute_y(); this.y = this.compute_y();
this.duration = this.task._end.diff(this.task._start, 'hours')/this.gantt.step;
this.duration = (this.task._end.diff(this.task._start, 'hours') + 24)/this.gantt.step;
this.width = this.gantt.unit_width * this.duration; this.width = this.gantt.unit_width * this.duration;
if(this.gantt.view_mode === 'Month')
this.width = (this.gantt.unit_width/30) * (this.duration*this.gantt.step/24);
this.progress_width = this.gantt.unit_width * this.duration * (this.task.progress/100) || 0; this.progress_width = this.gantt.unit_width * this.duration * (this.task.progress/100) || 0;
this.group = this.canvas.group().addClass('bar-wrapper'); this.group = this.canvas.group().addClass('bar-wrapper');
this.bar_group = this.canvas.group().addClass('bar-group').appendTo(this.group); this.bar_group = this.canvas.group().addClass('bar-group').appendTo(this.group);


Loading…
取消
儲存