Skip to content

Commit

Permalink
fix(app): apply padding to SampleView when it's at root
Browse files Browse the repository at this point in the history
  • Loading branch information
tuner committed Mar 23, 2023
1 parent 01217cd commit 9f0f38c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
5 changes: 5 additions & 0 deletions packages/app/src/sampleView/sampleView.js
Original file line number Diff line number Diff line change
Expand Up @@ -683,6 +683,11 @@ export default class SampleView extends ContainerView {
return;
}

if (!this.parent) {
// Usually padding is applied by GridView, but if this is the root view, we need to apply it here
coords = coords.shrink(this.getPadding());
}

context.pushView(this, coords);

const cols = mapToPixelCoords(
Expand Down
6 changes: 5 additions & 1 deletion packages/core/src/view/gridView.js
Original file line number Diff line number Diff line change
Expand Up @@ -527,7 +527,11 @@ export default class GridView extends ContainerView {
return;
}

coords = coords.shrink(this.getPadding()); // TODO: Only applicable at view root
if (!this.parent) {
// Usually padding is applied by the parent GridView, but if this is the root view, we need to apply it here
coords = coords.shrink(this.getPadding());
}

context.pushView(this, coords);

const flexOpts = {
Expand Down

0 comments on commit 9f0f38c

Please sign in to comment.