Fix flyout scrollbar reposition edge case (#4693)

* Fix flyout scrollbar position
This commit is contained in:
Monica Kozbial
2021-03-09 11:32:10 -08:00
committed by GitHub
parent 17d2e72ab0
commit 8b0488d71e

View File

@@ -441,6 +441,17 @@ Blockly.Flyout.prototype.positionAt_ = function(width, height, x, y) {
// Set the scrollbars origin to be the top left of the flyout.
scrollbar.setOrigin(x, y);
scrollbar.resize();
// If origin changed and metrics haven't changed enough to trigger
// reposition in resize, we need to call setPosition. See issue #4692.
if (scrollbar.hScroll) {
scrollbar.hScroll.setPosition(
scrollbar.hScroll.position.x, scrollbar.hScroll.position.y);
}
if (scrollbar.vScroll) {
scrollbar.vScroll.setPosition(
scrollbar.vScroll.position.x, scrollbar.vScroll.position.y);
}
}
};