Skip to content

Commit

Permalink
Fixed more bugs based on CI.
Browse files Browse the repository at this point in the history
  • Loading branch information
Elixonus committed Mar 5, 2023
1 parent 1b5c3bb commit 6648eba
Showing 1 changed file with 4 additions and 36 deletions.
40 changes: 4 additions & 36 deletions optics/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,18 +97,6 @@ class Point {
return this;
}

absolute(x = true, y = true) {
if (x) {
this.x = Math.abs(x);
}

if (y) {
this.y = Math.abs(y);
}

return this;
}

interpolateToPointLinear(p, t) {
this.x = interpolateLinear(this.x, p.x, t);
this.y = interpolateLinear(this.y, p.y, t);
Expand Down Expand Up @@ -282,10 +270,10 @@ class Object {
constructor(position, rotation) {
this.setPositionTo(position);
this.setRotationTo(rotation);
this.dragOffset;
this.dragPosition;
this.dragRotation;
this.dragIndexOfRefraction;
this.dragOffset = undefined;
this.dragPosition = undefined;
this.dragRotation = undefined;
this.dragIndexOfRefraction = undefined;
this.interactive = true;
this.animate();
}
Expand Down Expand Up @@ -1678,10 +1666,6 @@ function resize() {
}

function mousedown(event) {
if (!event) {
event = window.event;
}

if (time < 90) {
return;
}
Expand Down Expand Up @@ -1821,10 +1805,6 @@ function mousedown(event) {
}

function mouseup(event) {
if (!event) {
event = window.event;
}

mouseButtons[event.button] = false;

if (scene.draggedObject !== false) {
Expand All @@ -1835,19 +1815,11 @@ function mouseup(event) {
}

function mousemove(event) {
if (!event) {
event = window.event;
}

let rect = canvas.getBoundingClientRect();
mousePosition.setTo(new Point(((event.clientX - rect.left) / (rect.right - rect.left) - 0.5) * 1920, ((event.clientY - rect.top) / (rect.bottom - rect.top) - 0.5) * 1080));
}

function keydown(event) {
if (!event) {
event = window.event;
}

const eventKey = event.key;

if (keysPressed.includes(eventKey) === false) {
Expand Down Expand Up @@ -1896,10 +1868,6 @@ function keydown(event) {
}

function keyup(event) {
if (!event) {
event = window.event;
}

const eventKey = event.key;

keysPressed.splice(keysPressed.indexOf(eventKey), 1);
Expand Down

0 comments on commit 6648eba

Please sign in to comment.