(width, height)
| 275 | } |
| 276 | |
| 277 | _resize(width, height) { |
| 278 | const options = this.options; |
| 279 | const canvas = this.canvas; |
| 280 | const aspectRatio = options.maintainAspectRatio && this.aspectRatio; |
| 281 | const newSize = this.platform.getMaximumSize(canvas, width, height, aspectRatio); |
| 282 | const newRatio = options.devicePixelRatio || this.platform.getDevicePixelRatio(); |
| 283 | const mode = this.width ? 'resize' : 'attach'; |
| 284 | |
| 285 | this.width = newSize.width; |
| 286 | this.height = newSize.height; |
| 287 | this._aspectRatio = this.aspectRatio; |
| 288 | if (!retinaScale(this, newRatio, true)) { |
| 289 | return; |
| 290 | } |
| 291 | |
| 292 | this.notifyPlugins('resize', {size: newSize}); |
| 293 | |
| 294 | callCallback(options.onResize, [this, newSize], this); |
| 295 | |
| 296 | if (this.attached) { |
| 297 | if (this._doResize(mode)) { |
| 298 | // The resize update is delayed, only draw without updating. |
| 299 | this.render(); |
| 300 | } |
| 301 | } |
| 302 | } |
| 303 | |
| 304 | ensureScalesHaveIDs() { |
| 305 | const options = this.options; |
no test coverage detected