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:
Aaron Dodson
2024-10-14 08:19:49 -07:00
committed by GitHub
parent 9fc693140a
commit edd02f6955

View File

@@ -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);