@@ -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
0 commit comments