Continue adaptation work

This commit is contained in:
2024-04-14 23:34:53 +02:00
parent b2a8e18b0e
commit 57f0c9dfe6
20 changed files with 1079 additions and 1055 deletions

View File

@ -1,33 +1,35 @@
import { Editor } from "../main";
// mouse.ts
export const onmousemove = (app: any) => (e: MouseEvent): void => {
app._mouseX = e.pageX;
app._mouseY = e.pageY;
export const onmousemove = (app: Editor) => (e: MouseEvent): void => {
app._mouseX = e.pageX;
app._mouseY = e.pageY;
};
export const mouseX = (app: any) => (): number => {
/**
* @returns The current x position of the mouse
*/
return app._mouseX;
export const mouseX = (app: Editor) => (): number => {
/**
* @returns The current x position of the mouse
*/
return app._mouseX;
};
export const mouseY = (app: any) => (): number => {
/**
* @returns The current y position of the mouse
*/
return app._mouseY;
export const mouseY = (app: Editor) => (): number => {
/**
* @returns The current y position of the mouse
*/
return app._mouseY;
};
export const noteX = (app: any) => (): number => {
/**
* @returns The current x position scaled to 0-127 using screen width
*/
return Math.floor((app._mouseX / document.body.clientWidth) * 127);
export const noteX = (app: Editor) => (): number => {
/**
* @returns The current x position scaled to 0-127 using screen width
*/
return Math.floor((app._mouseX / document.body.clientWidth) * 127);
};
export const noteY = (app: any) => (): number => {
/**
* @returns The current y position scaled to 0-127 using screen height
*/
return Math.floor((app._mouseY / document.body.clientHeight) * 127);
};
export const noteY = (app: Editor) => (): number => {
/**
* @returns The current y position scaled to 0-127 using screen height
*/
return Math.floor((app._mouseY / document.body.clientHeight) * 127);
};