Skip to content

Commit 93f8593

Browse files
authored
[DevTools] Adjust the rects size by one pixel smaller (#34876)
This ensures that the outline of a previous rectangle lines up on the same pixel as the next rectangle so that they appear consecutive. <img width="244" height="51" alt="Screenshot 2025-10-16 at 11 35 32 AM" src="https://github.com/user-attachments/assets/75ffde6f-8cc6-49c1-8855-3953569546b4" /> I don't love this implementation. There's probably a smarter way. Was trying to avoid adding another element.
1 parent dc1becd commit 93f8593

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

packages/react-devtools-shared/src/devtools/views/SuspenseTab/SuspenseRects.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,14 @@ function ScaledRect({
3636
rect,
3737
visible,
3838
suspended,
39+
adjust,
3940
...props
4041
}: {
4142
className: string,
4243
rect: Rect,
4344
visible: boolean,
4445
suspended: boolean,
46+
adjust?: boolean,
4547
...
4648
}): React$Node {
4749
const viewBox = useContext(ViewBox);
@@ -57,8 +59,9 @@ function ScaledRect({
5759
data-visible={visible}
5860
data-suspended={suspended}
5961
style={{
60-
width,
61-
height,
62+
// Shrink one pixel so that the bottom outline will line up with the top outline of the next one.
63+
width: adjust ? 'calc(' + width + ' - 1px)' : width,
64+
height: adjust ? 'calc(' + height + ' - 1px)' : height,
6265
top: y,
6366
left: x,
6467
}}
@@ -160,6 +163,7 @@ function SuspenseRects({
160163
className={styles.SuspenseRectsRect}
161164
rect={rect}
162165
data-highlighted={selected}
166+
adjust={true}
163167
onClick={handleClick}
164168
onDoubleClick={handleDoubleClick}
165169
onPointerOver={handlePointerOver}

0 commit comments

Comments
 (0)