mirror of
https://github.com/Noratrieb/redox.git
synced 2026-01-15 16:55:03 +01:00
cool toolbar
This commit is contained in:
parent
78853473ff
commit
b754525595
11 changed files with 186 additions and 59 deletions
|
|
@ -3,6 +3,7 @@ import Particle, {colorFromCharge} from "./classes/Particle";
|
|||
import Vector from "./classes/Vector";
|
||||
import {CANVAS_HEIGHT, CANVAS_WIDTH} from "../App";
|
||||
import {circle} from "./Shapes";
|
||||
import {LeftClickAction} from "./ui/main/UI";
|
||||
|
||||
let particles: Particle[] = [];
|
||||
let mouseProperties: MouseProperties = {charge: 0, strength: 1, pos: new Vector()};
|
||||
|
|
@ -26,6 +27,14 @@ interface MouseProperties {
|
|||
pos: Vector
|
||||
}
|
||||
|
||||
export function getMousePosition(): Vector {
|
||||
return mouseProperties.pos;
|
||||
}
|
||||
|
||||
export function invokeDefaultLeftClickAction(action: LeftClickAction, mousePos: Vector) {
|
||||
particles = action(mousePos, particles);
|
||||
}
|
||||
|
||||
export function changeMouseProperties(transformer: (old: MouseProperties) => MouseProperties) {
|
||||
mouseProperties = transformer(mouseProperties);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue