fix: change progress icon

This commit is contained in:
Safwan Samsudeen 2024-04-30 17:49:54 +05:30
parent af0276c152
commit 5e18b534bf
4 changed files with 24 additions and 58 deletions

35
dist/frappe-gantt.js vendored
View File

@ -363,7 +363,7 @@ class O {
if (this.invalid || this.gantt.options.readonly)
return;
const t = this.$bar, e = 8;
this.gantt.options.dates_readonly || (c("rect", {
if (this.gantt.options.dates_readonly || (c("rect", {
x: t.getX() + t.getWidth() + e - 4,
y: t.getY() + 1,
width: e,
@ -381,27 +381,16 @@ class O {
ry: this.corner_radius,
class: "handle left",
append_to: this.handle_group
})), this.gantt.options.progress_readonly || (this.$handle_progress = c("polygon", {
points: this.get_progress_polygon_points().join(","),
class: "handle progress",
append_to: this.handle_group
}));
}
get_progress_polygon_points() {
const t = this.$bar_progress;
let e = 10, s = 15;
return [
t.getEndX() - e / 2,
t.getY() + t.getHeight() / 2,
t.getEndX(),
t.getY() + t.getHeight() / 2 - s / 2,
t.getEndX() + e / 2,
t.getY() + t.getHeight() / 2,
t.getEndX(),
t.getY() + t.getHeight() / 2 + s / 2,
t.getEndX() - e / 2,
t.getY() + t.getHeight() / 2
];
})), !this.gantt.options.progress_readonly) {
const s = this.$bar_progress;
this.$handle_progress = c("circle", {
cx: s.getEndX(),
cy: s.getY() + s.getHeight() / 2,
r: 5,
class: "handle progress",
append_to: this.handle_group
});
}
}
bind() {
this.invalid || this.setup_click_event();
@ -1203,7 +1192,7 @@ class F {
let a = (o.offsetX || o.layerX) - t;
a > i.max_dx && (a = i.max_dx), a < i.min_dx && (a = i.min_dx);
const p = s.$handle_progress;
_.attr(i, "width", i.owidth + a), _.attr(p, "points", s.get_progress_polygon_points()), i.finaldx = a;
_.attr(i, "width", i.owidth + a), _.attr(p, "cx", i.getEndX()), i.finaldx = a;
}), _.on(this.$svg, "mouseup", () => {
e = !1, i && i.finaldx && (i.finaldx = 0, s.progress_changed(), s.set_action_completed(), s = null, i = null, r = null);
});

File diff suppressed because one or more lines are too long

View File

@ -252,41 +252,18 @@ export default class Bar {
}
if (!this.gantt.options.progress_readonly) {
this.$handle_progress = createSVG('polygon', {
points: this.get_progress_polygon_points().join(','),
const bar_progress = this.$bar_progress;
this.$handle_progress = createSVG('circle', {
cx: bar_progress.getEndX(),
cy: bar_progress.getY() +
bar_progress.getHeight() / 2,
r: 5,
class: 'handle progress',
append_to: this.handle_group,
});
}
}
get_progress_polygon_points() {
const bar_progress = this.$bar_progress;
let icon_width = 10;
let icon_height = 15;
return [
bar_progress.getEndX() - icon_width / 2,
bar_progress.getY() + bar_progress.getHeight() / 2,
bar_progress.getEndX(),
bar_progress.getY() +
bar_progress.getHeight() / 2 -
icon_height / 2,
bar_progress.getEndX() + icon_width / 2,
bar_progress.getY() + bar_progress.getHeight() / 2,
bar_progress.getEndX(),
bar_progress.getY() +
bar_progress.getHeight() / 2 +
icon_height / 2,
bar_progress.getEndX() - icon_width / 2,
bar_progress.getY() + bar_progress.getHeight() / 2,
];
}
bind() {
if (this.invalid) return;
this.setup_click_event();

View File

@ -1152,7 +1152,7 @@ export default class Gantt {
const $handle = bar.$handle_progress;
$.attr($bar_progress, 'width', $bar_progress.owidth + dx);
$.attr($handle, 'points', bar.get_progress_polygon_points());
$.attr($handle, 'cx', $bar_progress.getEndX());
$bar_progress.finaldx = dx;
});