Skip to content

Commit

Permalink
feat: have backpack hide scrollbars when flyout opens (#1842)
Browse files Browse the repository at this point in the history
* feat: have backpack hide scrollbars when flyout opens

* fix: scrollbars may not exist

* chore: add checks before settin visibility
  • Loading branch information
BeksOmega authored Aug 21, 2023
1 parent 230ba13 commit b5f6f0b
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions plugins/workspace-backpack/src/backpack.js
Original file line number Diff line number Diff line change
Expand Up @@ -681,6 +681,12 @@ export class Backpack extends Blockly.DragTarget {
}
const jsons = this.contents_.map((text) => JSON.parse(text));
this.flyout_.show(jsons);
// TODO: We can remove the setVisible check when updating from ^10.0.0 to
// ^11.
if (this.workspace_.scrollbar &&
/** @type {*} */ (this.workspace_.scrollbar).setVisible) {
/** @type {*} */ (this.workspace_.scrollbar).setVisible(false);
}
Blockly.Events.fire(new BackpackOpen(true, this.workspace_.id));
}

Expand All @@ -704,6 +710,12 @@ export class Backpack extends Blockly.DragTarget {
return;
}
this.flyout_.hide();
// TODO: We can remove the setVisible check when updating from ^10.0.0 to
// ^11.
if (this.workspace_.scrollbar &&
/** @type {*} */ (this.workspace_.scrollbar).setVisible) {
/** @type {*} */ (this.workspace_.scrollbar).setVisible(true);
}
Blockly.Events.fire(new BackpackOpen(false, this.workspace_.id));
}

Expand Down Expand Up @@ -942,5 +954,3 @@ class BackpackSerializer {
backpack.empty();
}
}


0 comments on commit b5f6f0b

Please sign in to comment.