Skip to content

Commit

Permalink
Reduce flicker while toggling panes
Browse files Browse the repository at this point in the history
  • Loading branch information
Petter H. Juliussen committed Oct 2, 2023
1 parent 7de34da commit 285a14c
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 9 deletions.
26 changes: 19 additions & 7 deletions src/components/GanttChart.vue
Original file line number Diff line number Diff line change
Expand Up @@ -431,13 +431,25 @@ export default {
},
async selectObjective(objective) {
if (!this.workbenchObjectives.length) {
if (this.activeObjective && objective.id !== this.activeObjective.id) {
// Add currently active objective to workbench if the next objective
// is selected for the workbench
await this.addWorkbenchObjective(this.activeObjective.id);
this.$router.push({ name: 'ItemHome' });
}
if (
!this.workbenchObjectives.length &&
this.activeObjective &&
objective.id !== this.activeObjective.id
) {
// Close currently active objective if next objective is selected for
// the workbench
const activeObjectiveId = this.activeObjective.id;
this.$router.push({ name: 'ItemHome' });
// Add both objectives to the workbench using `setTimeout` to give the
// browser a chance to "catch up" while toggling panes
setTimeout(async () => {
await Promise.all(
[activeObjectiveId, objective.id].map(this.addWorkbenchObjective)
);
this.scrollToObjective(objective);
});
return;
}
// Add selected objective to workbench
Expand Down
4 changes: 2 additions & 2 deletions src/components/layout/PaneLayout.vue
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,10 @@ export default {
}
.slide-fade-enter-active {
transition: all 0.3s ease;
transition: all 0.4s ease;
}
.slide-fade-leave-active {
transition: all 0.1s cubic-bezier(1, 0.5, 0.8, 1);
transition: none;
}
.slide-fade-enter,
.slide-fade-leave-to {
Expand Down

0 comments on commit 285a14c

Please sign in to comment.