parent
45d218994d
commit
8f4214a926
67
src/index.js
67
src/index.js
@ -581,44 +581,39 @@ export default class Gantt {
|
|||||||
return is_dragging || is_resizing_left || is_resizing_right;
|
return is_dragging || is_resizing_left || is_resizing_right;
|
||||||
}
|
}
|
||||||
|
|
||||||
$.on(
|
$.on(this.$svg, 'mousedown', '.bar-wrapper, .handle', (e, element) => {
|
||||||
this.layers.bar,
|
const bar_wrapper = $.closest('.bar-wrapper', element);
|
||||||
'mousedown',
|
|
||||||
'.bar-wrapper, .handle',
|
|
||||||
(e, element) => {
|
|
||||||
const bar_wrapper = $.closest('.bar-wrapper', element);
|
|
||||||
|
|
||||||
if (element.classList.contains('left')) {
|
if (element.classList.contains('left')) {
|
||||||
is_resizing_left = true;
|
is_resizing_left = true;
|
||||||
} else if (element.classList.contains('right')) {
|
} else if (element.classList.contains('right')) {
|
||||||
is_resizing_right = true;
|
is_resizing_right = true;
|
||||||
} else if (element.classList.contains('bar-wrapper')) {
|
} else if (element.classList.contains('bar-wrapper')) {
|
||||||
is_dragging = true;
|
is_dragging = true;
|
||||||
}
|
|
||||||
|
|
||||||
bar_wrapper.classList.add('active');
|
|
||||||
|
|
||||||
x_on_start = e.offsetX;
|
|
||||||
y_on_start = e.offsetY;
|
|
||||||
|
|
||||||
parent_bar_id = bar_wrapper.getAttribute('data-id');
|
|
||||||
const ids = [
|
|
||||||
parent_bar_id,
|
|
||||||
...this.get_all_dependent_tasks(parent_bar_id)
|
|
||||||
];
|
|
||||||
bars = ids.map(id => this.get_bar(id));
|
|
||||||
|
|
||||||
this.bar_being_dragged = parent_bar_id;
|
|
||||||
|
|
||||||
bars.forEach(bar => {
|
|
||||||
const $bar = bar.$bar;
|
|
||||||
$bar.ox = $bar.getX();
|
|
||||||
$bar.oy = $bar.getY();
|
|
||||||
$bar.owidth = $bar.getWidth();
|
|
||||||
$bar.finaldx = 0;
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
);
|
|
||||||
|
bar_wrapper.classList.add('active');
|
||||||
|
|
||||||
|
x_on_start = e.offsetX;
|
||||||
|
y_on_start = e.offsetY;
|
||||||
|
|
||||||
|
parent_bar_id = bar_wrapper.getAttribute('data-id');
|
||||||
|
const ids = [
|
||||||
|
parent_bar_id,
|
||||||
|
...this.get_all_dependent_tasks(parent_bar_id)
|
||||||
|
];
|
||||||
|
bars = ids.map(id => this.get_bar(id));
|
||||||
|
|
||||||
|
this.bar_being_dragged = parent_bar_id;
|
||||||
|
|
||||||
|
bars.forEach(bar => {
|
||||||
|
const $bar = bar.$bar;
|
||||||
|
$bar.ox = $bar.getX();
|
||||||
|
$bar.oy = $bar.getY();
|
||||||
|
$bar.owidth = $bar.getWidth();
|
||||||
|
$bar.finaldx = 0;
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
$.on(this.$svg, 'mousemove', e => {
|
$.on(this.$svg, 'mousemove', e => {
|
||||||
if (!action_in_progress()) return;
|
if (!action_in_progress()) return;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user