Skip to content

Commit

Permalink
Merge pull request #270 from raaymax/builder-shortcuts-visibility
Browse files Browse the repository at this point in the history
fix: builder shortcuts visibility problem
  • Loading branch information
ramedina86 authored Mar 3, 2024
2 parents d5bb6ba + 1f221ea commit 2c35845
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions ui/src/builder/BuilderInstanceTracker.vue
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@ const trackElement = (el: HTMLElement) => {
const { clientHeight: bodyHeight } = document.body;
const { clientWidth: rendererWidth } = rendererEl;
const { left: rendererX } = rendererEl.getBoundingClientRect();
const settingsEl = document.querySelector(".BuilderSettings");
const { clientWidth: settingsWidth } = settingsEl || { clientWidth: 0 };
const { left: settingsLeft } = settingsEl?.getBoundingClientRect() || {
left: Infinity,
};
let { clientHeight: contentsHeight, clientWidth: contentsWidth } =
matchSize?.value ? el : rootEl.value;
let yAdjustment = verticalOffsetPixels?.value
Expand All @@ -49,12 +54,23 @@ const trackElement = (el: HTMLElement) => {
trackerX = Math.max(rendererX, trackerX); // Left boundary
trackerX = Math.min(
rendererX + rendererWidth - contentsWidth,
trackerX,
); // Right boundary
trackerY = Math.max(MIN_TOP_PX, trackerY); // Top boundary
trackerY = Math.min(bodyHeight - contentsHeight, trackerY); // Bottom boundary
}
let correction = 0;
if (settingsLeft < rendererX + rendererWidth) {
const trackerEnd = trackerX + contentsWidth;
const rendererEnd = rendererX + rendererWidth;
const distanceToRight = Math.max(rendererEnd - trackerEnd, 0);
correction = Math.max(settingsWidth - distanceToRight, 0);
}
trackerX -= correction;
rootStyle.value = {
top: `${trackerY}px`,
left: `${trackerX}px`,
Expand Down

0 comments on commit 2c35845

Please sign in to comment.