Skip to content

Commit

Permalink
fix: Extra space of non-zero not applied properly
Browse files Browse the repository at this point in the history
  • Loading branch information
aklinker1 committed Apr 10, 2024
1 parent b3f695b commit c399c29
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
Binary file modified bun.lockb
Binary file not shown.
8 changes: 6 additions & 2 deletions npm/src/geometry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,9 @@ export class Rectangle<TData> {
}): Rectangle<TData> {
// Adjust x, y, width, and height according to padding
const x = this.x - (padding.left ?? 0);
const y = this.y - (padding.top ?? 0);
const y = this.y - (padding.bottom ?? 0);
const width = this.width + (padding.left ?? 0) + (padding.right ?? 0);
const height = this.height + (padding.top ?? 0) + (padding.bottom ?? 0);
const height = this.height + (padding.bottom ?? 0) + (padding.top ?? 0);

return new Rectangle(this.data, x, y, width, height);
}
Expand Down Expand Up @@ -142,6 +142,10 @@ export class BoardLayouter {
readonly config: Config,
) {
const padding = -new Distance(config.extraSpace).m;
console.log('PADDING', padding, {
a: stock,
b: stock.pad({ right: padding, top: padding }),
});
this.paddedStock = stock.pad({ right: padding, top: padding });
}

Expand Down
2 changes: 2 additions & 0 deletions web/composables/useBoardLayoutsQuery.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ export default function () {
const layouts = computed(() => {
const parts = partsQuery.data.value;
if (parts == null) return undefined;

console.log(toRaw(config.value));
return generateBoardLayouts(parts, stock.value, config.value);
});

Expand Down

0 comments on commit c399c29

Please sign in to comment.