Skip to content

Commit

Permalink
Add copy methods
Browse files Browse the repository at this point in the history
  • Loading branch information
vanruesc committed Aug 9, 2024
1 parent 797c0a4 commit 94b374a
Showing 1 changed file with 36 additions and 2 deletions.
38 changes: 36 additions & 2 deletions src/utils/Resolution.ts
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,23 @@ export class Resolution extends EventDispatcher<BaseEventMap> {

}

/**
* Copies the base size of a given resolution.
*
* @param resolution - A resolution.
*/

copyBaseSize(resolution: Resolution): void {

if(!this.baseSize.equals(resolution.baseSize)) {

this.baseSize.copy(resolution.baseSize);
this.setChanged();

}

}

/**
* The preferred width.
*
Expand Down Expand Up @@ -285,6 +302,23 @@ export class Resolution extends EventDispatcher<BaseEventMap> {

}

/**
* Copies the preferred size of a given resolution.
*
* @param resolution - A resolution.
*/

copyPreferredSize(resolution: Resolution): void {

if(!this.preferredSize.equals(resolution.preferredSize)) {

this.preferredSize.copy(resolution.preferredSize);
this.setChanged();

}

}

/**
* Dispatches a `change` event.
*
Expand All @@ -306,8 +340,8 @@ export class Resolution extends EventDispatcher<BaseEventMap> {
copy(resolution: Resolution): void {

this._scale = resolution.scale;
this.preferredSize.set(resolution.preferredWidth, resolution.preferredHeight);
this.baseSize.set(resolution.baseWidth, resolution.baseHeight);
this.preferredSize.copy(resolution.preferredSize);
this.baseSize.copy(resolution.baseSize);
this.setChanged();

}
Expand Down

0 comments on commit 94b374a

Please sign in to comment.