Skip to content

Commit e00b890

Browse files
fix(FocusManager): add patching of itemPosX and itemPosY to Items
1 parent 7ac02e8 commit e00b890

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

packages/@lightningjs/ui-components/src/components/FocusManager/FocusManager.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,20 @@ export default class FocusManager extends Base {
5454
this._checkSkipFocus();
5555
}
5656

57+
_update() {
58+
super._update();
59+
this._updateItemPos();
60+
}
61+
62+
// I think this is necessary, because there is nothing other than _restItems patching in itemPosX and itemPosY,
63+
// whereas the previous setters were setting the x and y values for Items. -David
64+
_updateItemPos() {
65+
this.Items.patch({
66+
x: this.itemPosX,
67+
y: this.itemPosY
68+
});
69+
}
70+
5771
get Items() {
5872
if (!this.tag('Items')) {
5973
this.patch({ Items: {} });

packages/@lightningjs/ui-components/src/components/FocusManager/FocusManager.test.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,7 @@ describe('FocusManager', () => {
197197
const pos = 100;
198198
focusManager.itemPosX = pos;
199199
focusManager.itemPosY = pos;
200+
testRenderer.forceAllUpdates();
200201
expect(focusManager.Items.x).toBe(pos);
201202
expect(focusManager.Items.y).toBe(pos);
202203

0 commit comments

Comments
 (0)