Skip to content

Commit e747321

Browse files
HanSur94claude
andcommitted
fix: correct anchorTopRight to account for button width
The x position was calculated as panelWidth - offset, but should be panelWidth - buttonWidth - offset so the button doesn't extend past the panel's right edge. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 5816b12 commit e747321

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

libs/Dashboard/DashboardLayout.m

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -579,8 +579,8 @@ function addDetachButton(obj, widget)
579579

580580
function anchorTopRight(btn, offsetFromRight)
581581
%ANCHORTOPRIGHT Position a pixel-sized button at the top-right of its parent.
582-
% anchorTopRight(btn, offsetFromRight) places btn at the top-right corner
583-
% of its parent, inset by offsetFromRight pixels from the right edge.
582+
% anchorTopRight(btn, offsetFromRight) places btn so its right edge is
583+
% offsetFromRight pixels from the parent's right edge, top-aligned.
584584
parent = get(btn, 'Parent');
585585
oldUnits = get(parent, 'Units');
586586
set(parent, 'Units', 'pixels');
@@ -589,7 +589,7 @@ function anchorTopRight(btn, offsetFromRight)
589589
btnPos = get(btn, 'Position');
590590
btnW = btnPos(3);
591591
btnH = btnPos(4);
592-
x = pp(3) - offsetFromRight;
592+
x = pp(3) - btnW - offsetFromRight;
593593
y = pp(4) - btnH - 4;
594594
set(btn, 'Position', [x y btnW btnH]);
595595
end

0 commit comments

Comments
 (0)