Fix mouse detection
This commit is contained in:
@ -228,6 +228,8 @@ export class UserAPI {
|
|||||||
scope: (config: OscilloscopeConfig) => void;
|
scope: (config: OscilloscopeConfig) => void;
|
||||||
randI: any;
|
randI: any;
|
||||||
rand: any;
|
rand: any;
|
||||||
|
ir: any;
|
||||||
|
r: any;
|
||||||
seed: any;
|
seed: any;
|
||||||
localSeededRandom: any;
|
localSeededRandom: any;
|
||||||
clearLocalSeed: any;
|
clearLocalSeed: any;
|
||||||
@ -282,7 +284,6 @@ export class UserAPI {
|
|||||||
this.bpb = Transport.bpb(this.app);
|
this.bpb = Transport.bpb(this.app);
|
||||||
this.ppqn = Transport.ppqn(this.app);
|
this.ppqn = Transport.ppqn(this.app);
|
||||||
this.time_signature = Transport.time_signature(this.app);
|
this.time_signature = Transport.time_signature(this.app);
|
||||||
this.onMouseMove = Mouse.onmousemove(this.app);
|
|
||||||
this.mouseX = Mouse.mouseX(this.app);
|
this.mouseX = Mouse.mouseX(this.app);
|
||||||
this.mouseY = Mouse.mouseY(this.app);
|
this.mouseY = Mouse.mouseY(this.app);
|
||||||
this.noteX = Mouse.noteX(this.app);
|
this.noteX = Mouse.noteX(this.app);
|
||||||
@ -399,7 +400,9 @@ export class UserAPI {
|
|||||||
this.gif = Canvas.gif(this.app);
|
this.gif = Canvas.gif(this.app);
|
||||||
this.scope = Canvas.scope(this.app);
|
this.scope = Canvas.scope(this.app);
|
||||||
this.randI = Randomness.randI(this);
|
this.randI = Randomness.randI(this);
|
||||||
|
this.ir = this.randI;
|
||||||
this.rand = Randomness.rand(this);
|
this.rand = Randomness.rand(this);
|
||||||
|
this.r = this.rand;
|
||||||
this.seed = Randomness.seed(this);
|
this.seed = Randomness.seed(this);
|
||||||
this.localSeededRandom = Randomness.localSeededRandom(this);
|
this.localSeededRandom = Randomness.localSeededRandom(this);
|
||||||
this.clearLocalSeed = Randomness.clearLocalSeed(this);
|
this.clearLocalSeed = Randomness.clearLocalSeed(this);
|
||||||
@ -610,4 +613,10 @@ export class UserAPI {
|
|||||||
functionName = typeof functionName === "function" ? functionName.name : functionName;
|
functionName = typeof functionName === "function" ? functionName.name : functionName;
|
||||||
this.cueTimes[functionName] = this.app.clock.pulses_since_origin;
|
this.cueTimes[functionName] = this.app.clock.pulses_since_origin;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
onmousemove = (e: MouseEvent) => {
|
||||||
|
this.app._mouseX = e.pageX;
|
||||||
|
this.app._mouseY = e.pageY;
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,11 +1,5 @@
|
|||||||
import { Editor } from "../main";
|
import { Editor } from "../main";
|
||||||
|
|
||||||
// mouse.ts
|
|
||||||
export const onmousemove = (app: Editor) => (e: MouseEvent): void => {
|
|
||||||
app._mouseX = e.pageX;
|
|
||||||
app._mouseY = e.pageY;
|
|
||||||
};
|
|
||||||
|
|
||||||
export const mouseX = (app: Editor) => (): number => {
|
export const mouseX = (app: Editor) => (): number => {
|
||||||
/**
|
/**
|
||||||
* @returns The current x position of the mouse
|
* @returns The current x position of the mouse
|
||||||
|
|||||||
@ -8,6 +8,7 @@ export const randI = (api: UserAPI) => (min: number, max: number): number => {
|
|||||||
export const rand = (api: UserAPI) => (min: number, max: number): number => {
|
export const rand = (api: UserAPI) => (min: number, max: number): number => {
|
||||||
return api.randomGen() * (max - min) + min;
|
return api.randomGen() * (max - min) + min;
|
||||||
};
|
};
|
||||||
|
export const r = rand
|
||||||
|
|
||||||
export const seed = (api: UserAPI) => (seed: string | number): void => {
|
export const seed = (api: UserAPI) => (seed: string | number): void => {
|
||||||
if (typeof seed === "number") seed = seed.toString();
|
if (typeof seed === "number") seed = seed.toString();
|
||||||
|
|||||||
Reference in New Issue
Block a user