Skip to content

Commit

Permalink
feat: improved progress handle
Browse files Browse the repository at this point in the history
  • Loading branch information
safwansamsudeen committed Apr 28, 2024
1 parent 8bdd488 commit e9931bd
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 9 deletions.
23 changes: 17 additions & 6 deletions src/bar.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ export default class Bar {
$date_highlight.classList.add('date-highlight')
$date_highlight.style.height = this.height * 0.8 + 'px'
$date_highlight.style.width = this.width + 'px'
$date_highlight.style.top = this.gantt.options.header_height - 24 + 'px'
$date_highlight.style.top = this.gantt.options.header_height - 25 + 'px'
$date_highlight.style.left = x + 'px'
this.$date_highlight = $date_highlight
this.gantt.$lower_header.prepend($date_highlight)
Expand Down Expand Up @@ -254,13 +254,24 @@ export default class Bar {

get_progress_polygon_points() {
const bar_progress = this.$bar_progress;
let icon_width = 10;
let icon_height = 15;

return [
bar_progress.getEndX() - 6,
bar_progress.getY() + bar_progress.getHeight() + 8,
bar_progress.getEndX() + 6,
bar_progress.getY() + bar_progress.getHeight() + 8,
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() + 0.5,
bar_progress.getY() + bar_progress.getHeight() / 2 + icon_height / 2,

bar_progress.getEndX() - icon_width / 2,
bar_progress.getY() + bar_progress.getHeight() / 2,
];
}

Expand Down
12 changes: 10 additions & 2 deletions src/gantt.scss
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,11 @@ $dark-blue: #2c94ec !default;
}

.upper-header {
height: 50px;
height: 40px;
}

.lower-header {
height: 56px;
height: 30px;
}

.lower-text {
Expand Down Expand Up @@ -218,6 +218,10 @@ $dark-blue: #2c94ec !default;
.handle {
fill: $handle-color-important;
}

.handle.progress {
fill: $text-light;
}
}


Expand All @@ -229,6 +233,10 @@ $dark-blue: #2c94ec !default;
transition: opacity 0.3s ease;
}

.handle.progress {
fill: $text-muted;
}

.bar-wrapper {
cursor: pointer;
outline: none;
Expand Down
2 changes: 1 addition & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -1182,7 +1182,7 @@ export default class Gantt {
this.$svg.innerHTML = "";
this.$header?.remove?.()
this.$current_highlight?.remove?.()
this.$popup_wrapper?.remove?.()
this.$popup_wrapper.innerHTML = ''
}
}

Expand Down

0 comments on commit e9931bd

Please sign in to comment.