@babylonjs/core
Version:
Getting started? Play directly with the Babylon.js API using our [playground](https://playground.babylonjs.com/). It also contains a lot of samples to learn how to use it.
39 lines • 1.5 kB
JavaScript
/** This file must only contain pure code and pure imports */
import { AbstractEngine } from "../abstractEngine.pure.js";
let _Registered = false;
/**
* Register side effects for abstractEngineDom.
* Safe to call multiple times; only the first call has an effect.
*/
export function RegisterAbstractEngineDom() {
if (_Registered) {
return;
}
_Registered = true;
AbstractEngine.prototype.getInputElement = function () {
return this._renderingCanvas;
};
AbstractEngine.prototype.getRenderingCanvasClientRect = function () {
if (!this._renderingCanvas) {
return null;
}
return this._renderingCanvas.getBoundingClientRect();
};
AbstractEngine.prototype.getInputElementClientRect = function () {
if (!this._renderingCanvas) {
return null;
}
return this.getInputElement().getBoundingClientRect();
};
AbstractEngine.prototype.getAspectRatio = function (viewportOwner, useScreen = false) {
const viewport = viewportOwner.viewport;
return (this.getRenderWidth(useScreen) * viewport.width) / (this.getRenderHeight(useScreen) * viewport.height);
};
AbstractEngine.prototype.getScreenAspectRatio = function () {
return this.getRenderWidth(true) / this.getRenderHeight(true);
};
AbstractEngine.prototype._verifyPointerLock = function () {
this._onPointerLockChange?.();
};
}
//# sourceMappingURL=abstractEngine.dom.pure.js.map