-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #335 from Carifio24/pin-zoom
Pin 3D camera zoom between min and max values
- Loading branch information
Showing
2 changed files
with
33 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment | ||
// @ts-nocheck | ||
|
||
/* eslint-disable */ | ||
|
||
import { Settings } from "@wwtelescope/engine"; | ||
|
||
export function zoom(factor: number) { | ||
this.renderContext.targetCamera.zoom *= factor; | ||
if (this.renderContext.targetCamera.zoom > this.get_zoomMax()) { | ||
this.renderContext.targetCamera.zoom = this.get_zoomMax(); | ||
} | ||
if (this.renderContext.targetCamera.zoom < this.get_zoomMin()) { | ||
this.renderContext.targetCamera.zoom = this.get_zoomMin(); | ||
} | ||
|
||
if (!Settings.get_globalSettings().get_smoothPan()) { | ||
this.renderContext.viewCamera = this.renderContext.targetCamera.copy(); | ||
} | ||
} |