fix: correct safari bug
This commit is contained in:
parent
a65bcff5c1
commit
e151483f6d
2
dist/frappe-gantt.js
vendored
2
dist/frappe-gantt.js
vendored
@ -281,7 +281,7 @@ class C {
|
|||||||
height: this.height,
|
height: this.height,
|
||||||
rx: this.corner_radius,
|
rx: this.corner_radius,
|
||||||
ry: this.corner_radius,
|
ry: this.corner_radius,
|
||||||
class: "bar",
|
class: "bar" + (/^((?!chrome|android).)*safari/i.test(navigator.userAgent) && !this.task.important ? " safari" : ""),
|
||||||
append_to: this.bar_group
|
append_to: this.bar_group
|
||||||
}), S(this.$bar, "width", 0, this.width), this.invalid && this.$bar.classList.add("bar-invalid");
|
}), S(this.$bar, "width", 0, this.width), this.invalid && this.$bar.classList.add("bar-invalid");
|
||||||
}
|
}
|
||||||
|
|||||||
12
dist/frappe-gantt.umd.cjs
vendored
12
dist/frappe-gantt.umd.cjs
vendored
File diff suppressed because one or more lines are too long
2
dist/style.css
vendored
2
dist/style.css
vendored
File diff suppressed because one or more lines are too long
@ -31,7 +31,7 @@
|
|||||||
<h2 class="heading">
|
<h2 class="heading">
|
||||||
Interactive Gantt Chart entirely made in SVG!
|
Interactive Gantt Chart entirely made in SVG!
|
||||||
</h2>
|
</h2>
|
||||||
<div class="gantt-target dark"></div>
|
<div class="gantt-target"></div>
|
||||||
</div>
|
</div>
|
||||||
<script type="module">
|
<script type="module">
|
||||||
import Gantt from "/dist/frappe-gantt.js";
|
import Gantt from "/dist/frappe-gantt.js";
|
||||||
|
|||||||
35
src/bar.js
35
src/bar.js
@ -31,8 +31,8 @@ export default class Bar {
|
|||||||
this.width = this.gantt.options.column_width * this.duration;
|
this.width = this.gantt.options.column_width * this.duration;
|
||||||
this.progress_width =
|
this.progress_width =
|
||||||
this.gantt.options.column_width *
|
this.gantt.options.column_width *
|
||||||
this.duration *
|
this.duration *
|
||||||
(this.task.progress / 100) || 0;
|
(this.task.progress / 100) || 0;
|
||||||
this.group = createSVG('g', {
|
this.group = createSVG('g', {
|
||||||
class:
|
class:
|
||||||
'bar-wrapper' +
|
'bar-wrapper' +
|
||||||
@ -72,8 +72,8 @@ export default class Bar {
|
|||||||
this.compute_expected_progress();
|
this.compute_expected_progress();
|
||||||
this.expected_progress_width =
|
this.expected_progress_width =
|
||||||
this.gantt.options.column_width *
|
this.gantt.options.column_width *
|
||||||
this.duration *
|
this.duration *
|
||||||
(this.expected_progress / 100) || 0;
|
(this.expected_progress / 100) || 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
draw() {
|
draw() {
|
||||||
@ -92,6 +92,7 @@ export default class Bar {
|
|||||||
}
|
}
|
||||||
|
|
||||||
draw_bar() {
|
draw_bar() {
|
||||||
|
|
||||||
this.$bar = createSVG('rect', {
|
this.$bar = createSVG('rect', {
|
||||||
x: this.x,
|
x: this.x,
|
||||||
y: this.y,
|
y: this.y,
|
||||||
@ -99,7 +100,7 @@ export default class Bar {
|
|||||||
height: this.height,
|
height: this.height,
|
||||||
rx: this.corner_radius,
|
rx: this.corner_radius,
|
||||||
ry: this.corner_radius,
|
ry: this.corner_radius,
|
||||||
class: 'bar',
|
class: 'bar' + (/^((?!chrome|android).)*safari/i.test(navigator.userAgent) && !this.task.important ? ' safari' : ''),
|
||||||
append_to: this.bar_group,
|
append_to: this.bar_group,
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -267,16 +268,16 @@ export default class Bar {
|
|||||||
|
|
||||||
bar_progress.getEndX(),
|
bar_progress.getEndX(),
|
||||||
bar_progress.getY() +
|
bar_progress.getY() +
|
||||||
bar_progress.getHeight() / 2 -
|
bar_progress.getHeight() / 2 -
|
||||||
icon_height / 2,
|
icon_height / 2,
|
||||||
|
|
||||||
bar_progress.getEndX() + icon_width / 2,
|
bar_progress.getEndX() + icon_width / 2,
|
||||||
bar_progress.getY() + bar_progress.getHeight() / 2,
|
bar_progress.getY() + bar_progress.getHeight() / 2,
|
||||||
|
|
||||||
bar_progress.getEndX(),
|
bar_progress.getEndX(),
|
||||||
bar_progress.getY() +
|
bar_progress.getY() +
|
||||||
bar_progress.getHeight() / 2 +
|
bar_progress.getHeight() / 2 +
|
||||||
icon_height / 2,
|
icon_height / 2,
|
||||||
|
|
||||||
bar_progress.getEndX() - icon_width / 2,
|
bar_progress.getEndX() - icon_width / 2,
|
||||||
bar_progress.getY() + bar_progress.getHeight() / 2,
|
bar_progress.getY() + bar_progress.getHeight() / 2,
|
||||||
@ -304,12 +305,12 @@ export default class Bar {
|
|||||||
this.group,
|
this.group,
|
||||||
'mouseenter',
|
'mouseenter',
|
||||||
(e) =>
|
(e) =>
|
||||||
(timeout = setTimeout(() => {
|
(timeout = setTimeout(() => {
|
||||||
this.show_popup(e.offsetX);
|
this.show_popup(e.offsetX);
|
||||||
document.querySelector(
|
document.querySelector(
|
||||||
`#${task_id}-highlight`,
|
`#${task_id}-highlight`,
|
||||||
).style.display = 'block';
|
).style.display = 'block';
|
||||||
}, 200)),
|
}, 200)),
|
||||||
);
|
);
|
||||||
|
|
||||||
$.on(this.group, 'mouseleave', () => {
|
$.on(this.group, 'mouseleave', () => {
|
||||||
@ -570,8 +571,8 @@ export default class Bar {
|
|||||||
this.$expected_bar_progress.setAttribute(
|
this.$expected_bar_progress.setAttribute(
|
||||||
'width',
|
'width',
|
||||||
this.gantt.options.column_width *
|
this.gantt.options.column_width *
|
||||||
this.duration *
|
this.duration *
|
||||||
(this.expected_progress / 100) || 0,
|
(this.expected_progress / 100) || 0,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -74,7 +74,7 @@
|
|||||||
& .lower-text,
|
& .lower-text,
|
||||||
& .upper-text {
|
& .upper-text {
|
||||||
text-anchor: middle;
|
text-anchor: middle;
|
||||||
color: var(--text-light);
|
color: var(--text-dark);
|
||||||
}
|
}
|
||||||
|
|
||||||
& .upper-header {
|
& .upper-header {
|
||||||
@ -270,7 +270,7 @@
|
|||||||
|
|
||||||
& .bar-wrapper {
|
& .bar-wrapper {
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
outline: none;
|
|
||||||
|
|
||||||
&.active {
|
&.active {
|
||||||
& .handle {
|
& .handle {
|
||||||
@ -285,6 +285,10 @@
|
|||||||
border-radius: 3px;
|
border-radius: 3px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
& .bar.safari {
|
||||||
|
outline: 1px solid black;
|
||||||
|
}
|
||||||
|
|
||||||
&:hover {
|
&:hover {
|
||||||
.bar {
|
.bar {
|
||||||
transition: transform 0.3s ease;
|
transition: transform 0.3s ease;
|
||||||
|
|||||||
@ -23,5 +23,6 @@ export default defineConfig({
|
|||||||
// preserveEntrySignatures: "allow-extension"
|
// preserveEntrySignatures: "allow-extension"
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
output: { interop: 'auto' }
|
output: { interop: 'auto' },
|
||||||
|
server: { watch: { include: ['dist/*', 'src/*'] } }
|
||||||
});
|
});
|
||||||
Loading…
x
Reference in New Issue
Block a user