abstractEngine.dom.js 1.0 KB

123456789101112131415161718192021222324252627
  1. import { AbstractEngine } from "../abstractEngine.js";
  2. AbstractEngine.prototype.getInputElement = function () {
  3. return this._renderingCanvas;
  4. };
  5. AbstractEngine.prototype.getRenderingCanvasClientRect = function () {
  6. if (!this._renderingCanvas) {
  7. return null;
  8. }
  9. return this._renderingCanvas.getBoundingClientRect();
  10. };
  11. AbstractEngine.prototype.getInputElementClientRect = function () {
  12. if (!this._renderingCanvas) {
  13. return null;
  14. }
  15. return this.getInputElement().getBoundingClientRect();
  16. };
  17. AbstractEngine.prototype.getAspectRatio = function (viewportOwner, useScreen = false) {
  18. const viewport = viewportOwner.viewport;
  19. return (this.getRenderWidth(useScreen) * viewport.width) / (this.getRenderHeight(useScreen) * viewport.height);
  20. };
  21. AbstractEngine.prototype.getScreenAspectRatio = function () {
  22. return this.getRenderWidth(true) / this.getRenderHeight(true);
  23. };
  24. AbstractEngine.prototype._verifyPointerLock = function () {
  25. this._onPointerLockChange?.();
  26. };
  27. //# sourceMappingURL=abstractEngine.dom.js.map