Update popup position on drag

This commit is contained in:
Faris Ansari 2018-02-17 23:46:46 +05:30
parent 8c082e7bc9
commit 24cb69dd4e
4 changed files with 16 additions and 14 deletions

13
dist/frappe-gantt.js vendored
View File

@ -584,7 +584,10 @@ class Bar {
this.update_handle_position(); this.update_handle_position();
this.update_progressbar_position(); this.update_progressbar_position();
this.update_arrow_position(); this.update_arrow_position();
// this.update_details_position();
if (this.gantt.bar_being_dragged === this.task.id) {
this.show_popup();
}
} }
date_changed() { date_changed() {
@ -747,11 +750,6 @@ class Bar {
arrow.update(); arrow.update();
} }
} }
update_details_position() {
const { x, y } = get_details_position();
this.details_box && this.details_box.transform(`t${x},${y}`);
}
} }
class Arrow { class Arrow {
@ -1488,6 +1486,7 @@ class Gantt {
let is_resizing_right = false; let is_resizing_right = false;
let parent_bar_id = null; let parent_bar_id = null;
let bars = []; // instanceof Bar let bars = []; // instanceof Bar
this.bar_being_dragged = null;
function action_in_progress() { function action_in_progress() {
return is_dragging || is_resizing_left || is_resizing_right; return is_dragging || is_resizing_left || is_resizing_right;
@ -1518,6 +1517,8 @@ class Gantt {
]; ];
bars = ids.map(id => this.get_bar(id)); bars = ids.map(id => this.get_bar(id));
this.bar_being_dragged = parent_bar_id;
bars.forEach(bar => { bars.forEach(bar => {
const $bar = bar.$bar; const $bar = bar.$bar;
$bar.ox = $bar.getX(); $bar.ox = $bar.getX();

File diff suppressed because one or more lines are too long

View File

@ -227,7 +227,10 @@ export default class Bar {
this.update_handle_position(); this.update_handle_position();
this.update_progressbar_position(); this.update_progressbar_position();
this.update_arrow_position(); this.update_arrow_position();
// this.update_details_position();
if (this.gantt.bar_being_dragged === this.task.id) {
this.show_popup();
}
} }
date_changed() { date_changed() {
@ -250,7 +253,7 @@ export default class Bar {
set_action_completed() { set_action_completed() {
this.action_completed = true; this.action_completed = true;
setTimeout(() => (this.action_completed = false), 2000); setTimeout(() => (this.action_completed = false), 1000);
} }
compute_start_end_date() { compute_start_end_date() {
@ -390,11 +393,6 @@ export default class Bar {
arrow.update(); arrow.update();
} }
} }
update_details_position() {
const { x, y } = get_details_position();
this.details_box && this.details_box.transform(`t${x},${y}`);
}
} }
function isFunction(functionToCheck) { function isFunction(functionToCheck) {

View File

@ -575,6 +575,7 @@ export default class Gantt {
let is_resizing_right = false; let is_resizing_right = false;
let parent_bar_id = null; let parent_bar_id = null;
let bars = []; // instanceof Bar let bars = []; // instanceof Bar
this.bar_being_dragged = null;
function action_in_progress() { function action_in_progress() {
return is_dragging || is_resizing_left || is_resizing_right; return is_dragging || is_resizing_left || is_resizing_right;
@ -605,6 +606,8 @@ export default class Gantt {
]; ];
bars = ids.map(id => this.get_bar(id)); bars = ids.map(id => this.get_bar(id));
this.bar_being_dragged = parent_bar_id;
bars.forEach(bar => { bars.forEach(bar => {
const $bar = bar.$bar; const $bar = bar.$bar;
$bar.ox = $bar.getX(); $bar.ox = $bar.getX();