Skip to content

Commit 760848a

Browse files
sebmarkbageeps1lon
authored andcommitted
Include some sub-pixel precision in rects
1 parent 903366b commit 760848a

File tree

2 files changed

+16
-16
lines changed

2 files changed

+16
-16
lines changed

packages/react-devtools-shared/src/backend/fiber/renderer.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2693,10 +2693,10 @@ export function attach(
26932693
pushOperation(rects.length);
26942694
for (let i = 0; i < rects.length; ++i) {
26952695
const rect = rects[i];
2696-
pushOperation(Math.round(rect.x));
2697-
pushOperation(Math.round(rect.y));
2698-
pushOperation(Math.round(rect.width));
2699-
pushOperation(Math.round(rect.height));
2696+
pushOperation(Math.round(rect.x * 1000));
2697+
pushOperation(Math.round(rect.y * 1000));
2698+
pushOperation(Math.round(rect.width * 1000));
2699+
pushOperation(Math.round(rect.height * 1000));
27002700
}
27012701
}
27022702
}
@@ -2765,10 +2765,10 @@ export function attach(
27652765
pushOperation(rects.length);
27662766
for (let i = 0; i < rects.length; ++i) {
27672767
const rect = rects[i];
2768-
pushOperation(Math.round(rect.x));
2769-
pushOperation(Math.round(rect.y));
2770-
pushOperation(Math.round(rect.width));
2771-
pushOperation(Math.round(rect.height));
2768+
pushOperation(Math.round(rect.x * 1000));
2769+
pushOperation(Math.round(rect.y * 1000));
2770+
pushOperation(Math.round(rect.width * 1000));
2771+
pushOperation(Math.round(rect.height * 1000));
27722772
}
27732773
}
27742774
}

packages/react-devtools-shared/src/devtools/store.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1587,10 +1587,10 @@ export default class Store extends EventEmitter<{
15871587
} else {
15881588
rects = [];
15891589
for (let rectIndex = 0; rectIndex < numRects; rectIndex++) {
1590-
const x = operations[i + 0];
1591-
const y = operations[i + 1];
1592-
const width = operations[i + 2];
1593-
const height = operations[i + 3];
1590+
const x = operations[i + 0] / 1000;
1591+
const y = operations[i + 1] / 1000;
1592+
const width = operations[i + 2] / 1000;
1593+
const height = operations[i + 3] / 1000;
15941594
rects.push({x, y, width, height});
15951595
i += 4;
15961596
}
@@ -1763,10 +1763,10 @@ export default class Store extends EventEmitter<{
17631763
} else {
17641764
nextRects = [];
17651765
for (let rectIndex = 0; rectIndex < numRects; rectIndex++) {
1766-
const x = operations[i + 0];
1767-
const y = operations[i + 1];
1768-
const width = operations[i + 2];
1769-
const height = operations[i + 3];
1766+
const x = operations[i + 0] / 1000;
1767+
const y = operations[i + 1] / 1000;
1768+
const width = operations[i + 2] / 1000;
1769+
const height = operations[i + 3] / 1000;
17701770

17711771
nextRects.push({x, y, width, height});
17721772

0 commit comments

Comments
 (0)