mirror of
https://github.com/google/blockly.git
synced 2026-01-11 02:47:09 +01:00
fix: Take the flyout into account when positioning the workspace after a toolbox change. (#8617)
* fix: Take the flyout into account when positioning the workspace after a toolbox change. * fix: Accomodate top-positioned toolboxes.
This commit is contained in:
@@ -734,13 +734,18 @@ export class Toolbox
|
||||
// relative to the new absolute edge (ie toolbox edge).
|
||||
const workspace = this.workspace_;
|
||||
const rect = this.HtmlDiv!.getBoundingClientRect();
|
||||
const flyout = this.getFlyout();
|
||||
const newX =
|
||||
this.toolboxPosition === toolbox.Position.LEFT
|
||||
? workspace.scrollX + rect.width
|
||||
? workspace.scrollX +
|
||||
rect.width +
|
||||
(flyout?.isVisible() ? flyout.getWidth() : 0)
|
||||
: workspace.scrollX;
|
||||
const newY =
|
||||
this.toolboxPosition === toolbox.Position.TOP
|
||||
? workspace.scrollY + rect.height
|
||||
? workspace.scrollY +
|
||||
rect.height +
|
||||
(flyout?.isVisible() ? flyout.getHeight() : 0)
|
||||
: workspace.scrollY;
|
||||
workspace.translate(newX, newY);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user