Skip to content

Commit

Permalink
Update BoxModel.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
vanvianen committed Jan 12, 2025
1 parent aaf5a2c commit 5834b19
Showing 1 changed file with 31 additions and 3 deletions.
34 changes: 31 additions & 3 deletions src/ts/BoxModel.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,34 @@
class BoxModel {
// ============================================================================
// Import
// ============================================================================

import Border from "./Border";
import Size from "./Size";


// ============================================================================
// Classes
// ============================================================================

export default class BoxModel {

// Parameters
// ========================================================================

margin: Margin;
padding: Padding;
border: Border;
size: Size;

constructor(margin: Margin, padding: Padding, border: Border, size: Size) {
// Constructor
// ========================================================================

constructor(
margin: Margin,
padding: Padding,
border: Border,
size: Size
) {
if (
margin.top.unit !== size.width.unit ||
padding.top.unit !== size.width.unit ||
Expand All @@ -18,6 +42,10 @@ class BoxModel {
this.size = size;
}


// Methods
// ========================================================================

setMargin(margin: Margin): void {
this.margin = margin;
}
Expand All @@ -37,4 +65,4 @@ class BoxModel {
toString(): string {
return `BoxModel:\n Size: ${this.size.toString()}\n Margin: ${this.margin.toString()}\n Padding: ${this.padding.toString()}\n Border: ${this.border.toString()}`;
}
}
}

0 comments on commit 5834b19

Please sign in to comment.