chore: format
This commit is contained in:
parent
5e18b534bf
commit
9cd3633dd7
25
src/bar.js
25
src/bar.js
@ -92,7 +92,6 @@ export default class Bar {
|
||||
}
|
||||
|
||||
draw_bar() {
|
||||
|
||||
this.$bar = createSVG('rect', {
|
||||
x: this.x,
|
||||
y: this.y,
|
||||
@ -100,7 +99,12 @@ export default class Bar {
|
||||
height: this.height,
|
||||
rx: this.corner_radius,
|
||||
ry: this.corner_radius,
|
||||
class: 'bar' + (/^((?!chrome|android).)*safari/i.test(navigator.userAgent) && !this.task.important ? ' safari' : ''),
|
||||
class:
|
||||
'bar' +
|
||||
(/^((?!chrome|android).)*safari/i.test(navigator.userAgent) &&
|
||||
!this.task.important
|
||||
? ' safari'
|
||||
: ''),
|
||||
append_to: this.bar_group,
|
||||
});
|
||||
|
||||
@ -249,14 +253,12 @@ export default class Bar {
|
||||
class: 'handle left',
|
||||
append_to: this.handle_group,
|
||||
});
|
||||
|
||||
}
|
||||
if (!this.gantt.options.progress_readonly) {
|
||||
const bar_progress = this.$bar_progress;
|
||||
this.$handle_progress = createSVG('circle', {
|
||||
cx: bar_progress.getEndX(),
|
||||
cy: bar_progress.getY() +
|
||||
bar_progress.getHeight() / 2,
|
||||
cy: bar_progress.getY() + bar_progress.getHeight() / 2,
|
||||
r: 5,
|
||||
class: 'handle progress',
|
||||
append_to: this.handle_group,
|
||||
@ -300,7 +302,7 @@ export default class Bar {
|
||||
'none';
|
||||
});
|
||||
|
||||
$.on(this.group, "click", () => {
|
||||
$.on(this.group, 'click', () => {
|
||||
this.gantt.trigger_event('click', [this.task]);
|
||||
});
|
||||
|
||||
@ -309,8 +311,9 @@ export default class Bar {
|
||||
// just finished a move action, wait for a few seconds
|
||||
return;
|
||||
}
|
||||
this.group.classList.remove('active')
|
||||
if (this.gantt.popup) this.gantt.popup.parent.classList.remove('hidden');
|
||||
this.group.classList.remove('active');
|
||||
if (this.gantt.popup)
|
||||
this.gantt.popup.parent.classList.remove('hidden');
|
||||
|
||||
this.gantt.trigger_event('double_click', [this.task]);
|
||||
});
|
||||
@ -449,12 +452,14 @@ export default class Bar {
|
||||
x_in_units * this.gantt.options.step,
|
||||
'hour',
|
||||
);
|
||||
const start_offset = this.gantt.gantt_start.getTimezoneOffset() - new_start_date.getTimezoneOffset();
|
||||
const start_offset =
|
||||
this.gantt.gantt_start.getTimezoneOffset() -
|
||||
new_start_date.getTimezoneOffset();
|
||||
if (start_offset) {
|
||||
new_start_date = date_utils.add(
|
||||
new_start_date,
|
||||
start_offset,
|
||||
'minute'
|
||||
'minute',
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
14
src/index.js
14
src/index.js
@ -955,9 +955,9 @@ export default class Gantt {
|
||||
return is_dragging || is_resizing_left || is_resizing_right;
|
||||
}
|
||||
|
||||
this.$svg.onclick = e => {
|
||||
if (e.target.classList.contains('grid-row')) this.unselect_all()
|
||||
}
|
||||
this.$svg.onclick = (e) => {
|
||||
if (e.target.classList.contains('grid-row')) this.unselect_all();
|
||||
};
|
||||
|
||||
$.on(this.$svg, 'mousedown', '.bar-wrapper, .handle', (e, element) => {
|
||||
const bar_wrapper = $.closest('.bar-wrapper', element);
|
||||
@ -1064,7 +1064,7 @@ export default class Gantt {
|
||||
|
||||
$.on(this.$svg, 'mousemove', (e) => {
|
||||
if (!action_in_progress()) return;
|
||||
console.log(e)
|
||||
console.log(e);
|
||||
const dx = (e.offsetX || e.layerX) - x_on_start;
|
||||
|
||||
bars.forEach((bar) => {
|
||||
@ -1088,7 +1088,11 @@ export default class Gantt {
|
||||
width: $bar.owidth + $bar.finaldx,
|
||||
});
|
||||
}
|
||||
} else if (is_dragging && !this.options.readonly && !this.options.dates_readonly) {
|
||||
} else if (
|
||||
is_dragging &&
|
||||
!this.options.readonly &&
|
||||
!this.options.dates_readonly
|
||||
) {
|
||||
bar.update_bar_position({ x: $bar.ox + $bar.finaldx });
|
||||
}
|
||||
});
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user