INNER CODE UNIT · JavaScript
measureDevicePixelSize
NeoAxis/NeoAxisEngine · Project/Sources/NeoAxis.Player.Web/wwwroot/main.js:279
const measureDevicePixelSize = () =>
{
const devicePixelRatio = window.devicePixelRatio || 1.0;
const rect = getCanvasRect();
const width = Math.round(rect.right * devicePixelRatio) - Math.round(rect.left * devicePixelRatio);
const height = Math.round(rect.bottom * devicePixelRatio) - Math.round(rect.top * devicePixelRatio);
return { width: Math.max(1, width), height: Math.max(1, height) };
}
const applyCanvasSize = (width, height) =>
{
width = Math.max(1, Math.round(width));
height = Math.max(1, Math.round(height));
const fullscreenEnabled = document.fullscreenElement != null;