Skip to content

Commit

Permalink
fix(FocusManager): add patching of itemPosX and itemPosY to Items
Browse files Browse the repository at this point in the history
  • Loading branch information
ImCoolNowRight committed Mar 18, 2024
1 parent 7ac02e8 commit e00b890
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,20 @@ export default class FocusManager extends Base {
this._checkSkipFocus();
}

_update() {
super._update();
this._updateItemPos();
}

// I think this is necessary, because there is nothing other than _restItems patching in itemPosX and itemPosY,
// whereas the previous setters were setting the x and y values for Items. -David
_updateItemPos() {
this.Items.patch({
x: this.itemPosX,
y: this.itemPosY
});
}

get Items() {
if (!this.tag('Items')) {
this.patch({ Items: {} });
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,7 @@ describe('FocusManager', () => {
const pos = 100;
focusManager.itemPosX = pos;
focusManager.itemPosY = pos;
testRenderer.forceAllUpdates();
expect(focusManager.Items.x).toBe(pos);
expect(focusManager.Items.y).toBe(pos);

Expand Down

0 comments on commit e00b890

Please sign in to comment.