* resize the camera * @param w - new width of the camera * @param h - new height of the camera * @returns this camera
(w: number, h: number)
| 479 | * @returns this camera |
| 480 | */ |
| 481 | override resize(w: number, h: number): this { |
| 482 | // skip resize for non-auto-resize cameras (e.g. minimap, split-screen) |
| 483 | if (!this.autoResize) { |
| 484 | return this; |
| 485 | } |
| 486 | |
| 487 | // parent consctructor, resize camera rect |
| 488 | super.resize(w, h); |
| 489 | |
| 490 | // disable damping while resizing |
| 491 | this.smoothFollow = false; |
| 492 | |
| 493 | // reset everything |
| 494 | this.setBounds(0, 0, w, h); |
| 495 | this.setDeadzone(w / 6, h / 6); |
| 496 | this.update(); |
| 497 | this.smoothFollow = true; |
| 498 | |
| 499 | // update the projection matrix |
| 500 | this._updateProjectionMatrix(); |
| 501 | |
| 502 | // publish the viewport resize event |
| 503 | emit(VIEWPORT_ONRESIZE, this.width, this.height); |
| 504 | |
| 505 | return this; |
| 506 | } |
| 507 | |
| 508 | /** |
| 509 | * set the camera boundaries (set to the world limit by default). |
no test coverage detected