fix: bar dragging tracker bug

This commit is contained in:
Safwan Samsudeen 2025-01-07 14:37:47 +05:30
parent 3dd58fc00d
commit 2f6b578fc9
2 changed files with 5 additions and 2 deletions

View File

@ -341,6 +341,7 @@ export default class Bar {
const posX = e.offsetX || e.layerX;
const cx = +this.$handle_progress.getAttribute('cx');
if (cx > posX - 1 && cx < posX + 1) return;
console.log(this.gantt.bar_being_dragged);
if (this.gantt.bar_being_dragged) return;
if (!this.popup_opened)
this.gantt.show_popup({

View File

@ -1068,7 +1068,9 @@ export default class Gantt {
this.$svg.onclick = (e) => {
if (e.target.classList.contains('grid-row')) this.unselect_all();
};
$.on(this.$svg, 'mousemove', '.bar-wrapper, .handle', () => {
if (this.bar_being_dragged === false) this.bar_being_dragged = true;
});
$.on(this.$svg, 'mousedown', '.bar-wrapper, .handle', (e, element) => {
const bar_wrapper = $.closest('.bar-wrapper', element);
bars.forEach((bar) => bar.group.classList.remove('active'));
@ -1099,7 +1101,7 @@ export default class Gantt {
}
bars = ids.map((id) => this.get_bar(id));
this.bar_being_dragged = parent_bar_id;
this.bar_being_dragged = false;
bars.forEach((bar) => {
const $bar = bar.$bar;