INNER CODE UNIT · JavaScript

getCanvasPosition

NeoAxis/NeoAxisEngine · Project/Sources/NeoAxis.Player.Web/wwwroot/main.js:373

		const getCanvasPosition = (clientX, clientY) =>
		{
			const rect = getCanvasRect();
			const scaleX = rect.width > 0 ? canvas.width / rect.width : 1.0;
			const scaleY = rect.height > 0 ? canvas.height / rect.height : 1.0;

			return {
				x: (clientX - rect.left) * scaleX,
				y: (clientY - rect.top) * scaleY
			};
		}

		function getEventModifiers(/** @type {KeyboardEvent|MouseEvent|TouchEvent} */e)
		{
			var flags = 0;
			if (e.shiftKey) flags |= InputModifiers.Shift;
			if (e.ctrlKey) flags |= InputModifiers.Ctrl;
			if (e.altKey) flags |= InputModifiers.Alt;

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…