fix: issues discovered while porting to builder

This commit is contained in:
Safwan Samsudeen 2024-12-13 15:52:37 +05:30
parent d1cc6cc79e
commit e6a1c30410
4 changed files with 17 additions and 23 deletions

View File

@ -88,6 +88,7 @@ export default class Arrow {
'data-from': this.from_task.task.id, 'data-from': this.from_task.task.id,
'data-to': this.to_task.task.id, 'data-to': this.to_task.task.id,
}); });
console.log(this.element);
} }
update() { update() {

View File

@ -594,7 +594,7 @@ export default class Bar {
compute_y() { compute_y() {
this.y = this.y =
this.gantt.config.header_height + this.gantt.config.header_height +
this.gantt.options.padding + this.gantt.options.padding / 2 +
this.task._index * (this.height + this.gantt.options.padding); this.task._index * (this.height + this.gantt.options.padding);
} }

View File

@ -393,7 +393,7 @@ export default class Gantt {
}); });
$.attr(this.$svg, { $.attr(this.$svg, {
height: grid_height + this.options.padding, height: grid_height,
width: '100%', width: '100%',
}); });
} }
@ -404,24 +404,18 @@ export default class Gantt {
const row_width = this.dates.length * this.config.column_width; const row_width = this.dates.length * this.config.column_width;
const row_height = this.options.bar_height + this.options.padding; const row_height = this.options.bar_height + this.options.padding;
let row_y = this.config.header_height + this.options.padding / 2; let y = this.config.header_height;
for (let _ of this.tasks) { for (let _ of this.tasks) {
createSVG('rect', { createSVG('rect', {
x: 0, x: 0,
y: row_y, y,
width: row_width, width: row_width,
height: row_height, height: row_height,
class: 'grid-row', class: 'grid-row',
append_to: rows_layer, append_to: rows_layer,
}); });
// FIX
if (
this.options.lines === 'both' ||
this.options.lines === 'horizontal'
) {
}
row_y += this.options.bar_height + this.options.padding; y += this.options.bar_height + this.options.padding;
} }
} }
@ -487,7 +481,7 @@ export default class Gantt {
make_grid_ticks() { make_grid_ticks() {
if (this.options.lines === 'none') return; if (this.options.lines === 'none') return;
let tick_x = 0; let tick_x = 0;
let tick_y = this.config.header_height + this.options.padding / 2; let tick_y = this.config.header_height;
let tick_height = let tick_height =
(this.options.bar_height + this.options.padding) * (this.options.bar_height + this.options.padding) *
this.tasks.length; this.tasks.length;
@ -497,7 +491,7 @@ export default class Gantt {
append_to: this.layers.grid, append_to: this.layers.grid,
}); });
let row_y = this.config.header_height + this.options.padding / 2; let row_y = this.config.header_height;
const row_width = this.dates.length * this.config.column_width; const row_width = this.dates.length * this.config.column_width;
const row_height = this.options.bar_height + this.options.padding; const row_height = this.options.bar_height + this.options.padding;
@ -617,9 +611,9 @@ export default class Gantt {
}); });
label.textContent = labels[d]; label.textContent = labels[d];
} }
let el = createSVG('rect', { createSVG('rect', {
x: Math.round(x), x: Math.round(x),
y: this.config.header_height + this.options.padding / 2, y: this.config.header_height,
width: width:
this.config.column_width / this.config.column_width /
date_utils.convert_scales( date_utils.convert_scales(
@ -686,12 +680,10 @@ export default class Gantt {
(diff_in_units / this.config.step) * this.config.column_width; (diff_in_units / this.config.step) * this.config.column_width;
const height = const height =
(this.options.bar_height + this.options.padding) * (this.options.bar_height + this.options.padding) *
this.tasks.length + this.tasks.length;
20 +
this.options.padding / 2;
this.$current_highlight = this.create_el({ this.$current_highlight = this.create_el({
top: this.config.header_height - 20, top: this.config.header_height,
left, left,
height, height,
classes: 'current-highlight', classes: 'current-highlight',
@ -702,7 +694,6 @@ export default class Gantt {
make_grid_highlights() { make_grid_highlights() {
this.highlightHolidays(); this.highlightHolidays();
const top = this.config.header_height + this.options.padding / 2;
const height = const height =
(this.options.bar_height + this.options.padding) * (this.options.bar_height + this.options.padding) *
this.tasks.length; this.tasks.length;
@ -735,7 +726,7 @@ export default class Gantt {
this.config.ignored_positions.push(diff * this.config.column_width); this.config.ignored_positions.push(diff * this.config.column_width);
createSVG('rect', { createSVG('rect', {
x: diff * this.config.column_width, x: diff * this.config.column_width,
y: top, y: this.config.header_height,
width: this.config.column_width, width: this.config.column_width,
height: height, height: height,
class: 'ignored-bar', class: 'ignored-bar',

View File

@ -6,6 +6,8 @@
overflow: auto; overflow: auto;
font-size: 12px; font-size: 12px;
height: var(--gv-grid-height); height: var(--gv-grid-height);
width: 100%;
border-radius: 8px;
& .popup-wrapper { & .popup-wrapper {
position: absolute; position: absolute;
@ -99,7 +101,7 @@
top: 5px; top: 5px;
width: max-content; width: max-content;
margin-left: auto; margin-left: auto;
right: 0; right: 5px;
padding-left: 5px; padding-left: 5px;
} }
@ -198,7 +200,7 @@
& .arrow { & .arrow {
fill: none; fill: none;
stroke: var(--arrow-color); stroke: var(--g-arrow-color);
stroke-width: 1; stroke-width: 1;
} }