Skip to content

Commit 0933567

Browse files
committed
Remove resizable
Closes #742
1 parent 69c61a6 commit 0933567

2 files changed

Lines changed: 8 additions & 27 deletions

File tree

‎src/core/Resolution.js‎

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -11,25 +11,21 @@ export class Resolution extends EventDispatcher {
1111
/**
1212
* Constructs a new resolution.
1313
*
14-
* TODO Remove resizable param.
15-
* @param {Resizable} resizable - A resizable object.
14+
* @param {Resizable} [resizable=null] - Deprecated. Use `addEventListener("change", listener)` instead.
1615
* @param {Number} [width=Resolution.AUTO_SIZE] - The preferred width.
1716
* @param {Number} [height=Resolution.AUTO_SIZE] - The preferred height.
1817
* @param {Number} [scale=1.0] - A resolution scale.
1918
*/
2019

21-
constructor(resizable, width = AUTO_SIZE, height = AUTO_SIZE, scale = 1.0) {
20+
constructor(resizable = null, width = AUTO_SIZE, height = AUTO_SIZE, scale = 1.0) {
2221

2322
super();
2423

25-
/**
26-
* A resizable object.
27-
*
28-
* @type {Resizable}
29-
* @deprecated Use an event listener for "change" events instead.
30-
*/
24+
if(resizable !== null) {
3125

32-
this.resizable = resizable;
26+
this.addEventListener("change", () => resizable.setSize(this.baseSize.width, this.baseSize.height));
27+
28+
}
3329

3430
/**
3531
* The base resolution.
@@ -212,7 +208,6 @@ export class Resolution extends EventDispatcher {
212208
this.s = value;
213209
this.preferredSize.setScalar(AUTO_SIZE);
214210
this.dispatchEvent({ type: "change" });
215-
this.resizable.setSize(this.baseSize.width, this.baseSize.height);
216211

217212
}
218213

@@ -264,7 +259,6 @@ export class Resolution extends EventDispatcher {
264259

265260
this.baseSize.width = value;
266261
this.dispatchEvent({ type: "change" });
267-
this.resizable.setSize(this.baseSize.width, this.baseSize.height);
268262

269263
}
270264

@@ -314,7 +308,6 @@ export class Resolution extends EventDispatcher {
314308

315309
this.baseSize.height = value;
316310
this.dispatchEvent({ type: "change" });
317-
this.resizable.setSize(this.baseSize.width, this.baseSize.height);
318311

319312
}
320313

@@ -359,7 +352,6 @@ export class Resolution extends EventDispatcher {
359352

360353
this.baseSize.set(width, height);
361354
this.dispatchEvent({ type: "change" });
362-
this.resizable.setSize(this.baseSize.width, this.baseSize.height);
363355

364356
}
365357

@@ -383,7 +375,6 @@ export class Resolution extends EventDispatcher {
383375

384376
this.preferredSize.width = value;
385377
this.dispatchEvent({ type: "change" });
386-
this.resizable.setSize(this.baseSize.width, this.baseSize.height);
387378

388379
}
389380

@@ -435,7 +426,6 @@ export class Resolution extends EventDispatcher {
435426

436427
this.preferredSize.height = value;
437428
this.dispatchEvent({ type: "change" });
438-
this.resizable.setSize(this.baseSize.width, this.baseSize.height);
439429

440430
}
441431

@@ -482,7 +472,6 @@ export class Resolution extends EventDispatcher {
482472

483473
this.preferredSize.set(width, height);
484474
this.dispatchEvent({ type: "change" });
485-
this.resizable.setSize(this.baseSize.width, this.baseSize.height);
486475

487476
}
488477

@@ -500,7 +489,6 @@ export class Resolution extends EventDispatcher {
500489
this.baseSize.set(resolution.baseWidth, resolution.baseHeight);
501490
this.preferredSize.set(resolution.preferredWidth, resolution.preferredHeight);
502491
this.dispatchEvent({ type: "change" });
503-
this.resizable.setSize(this.baseSize.width, this.baseSize.height);
504492

505493
}
506494

‎types/index.d.ts‎

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2559,25 +2559,18 @@ export class Resolution extends EventDispatcher<BaseEventMap> {
25592559
* Constructs a new resolution.
25602560
*
25612561
* TODO Remove resizable param.
2562-
* @param {Resizable} resizable - A resizable object.
2562+
* @param {Resizable} [resizable=null] - Deprecated. Use `addEventListener("change", listener)` instead.
25632563
* @param {Number} [width=Resolution.AUTO_SIZE] - The preferred width.
25642564
* @param {Number} [height=Resolution.AUTO_SIZE] - The preferred height.
25652565
* @param {Number} [scale=1.0] - A resolution scale.
25662566
*/
25672567
constructor(
2568-
resizable: Resizable,
2568+
resizable?: Resizable | null,
25692569
width?: number,
25702570
height?: number,
25712571
scale?: number
25722572
);
25732573

2574-
/**
2575-
* A resizable object.
2576-
*
2577-
* @type {Resizable}
2578-
* @deprecated Use an event listener for "change" events instead.
2579-
*/
2580-
resizable: Resizable;
25812574
/**
25822575
* The preferred resolution.
25832576
*

0 commit comments

Comments
 (0)