Skip to content
This repository has been archived by the owner on Jan 3, 2024. It is now read-only.

Commit

Permalink
Update dann.js
Browse files Browse the repository at this point in the history
  • Loading branch information
matiasvlevi committed Sep 20, 2020
1 parent 1e283ba commit e67b7a1
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions dann.js
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,7 @@ class Graph {
this.max = 1;
this.lines = [];
this.color = [];
this.dragged = false;
}
addValue(x,color) {
this.color.push(color)
Expand All @@ -372,9 +373,9 @@ class Graph {
update() {
noFill();
rect(this.pos.x,this.pos.y,this.w,this.h);
if (mouseIsPressed&&mouseX >= this.pos.x && mouseX<=this.pos.x+this.w&&mouseY >= this.pos.y&&mouseY<=this.pos.y+this.h) {
this.pos.x = mouseX;
this.pos.y = mouseY;
if (this.dragged&&mouseX >= this.pos.x && mouseX<=this.pos.x+this.w&&mouseY >= this.pos.y&&mouseY<=this.pos.y+this.h) {
this.pos.x = mouseX-(this.w/2);
this.pos.y = mouseY-(this.h/2);
}
for (let a = 0; a < this.lines.length; a++) {
stroke(this.color[a]);
Expand Down

0 comments on commit e67b7a1

Please sign in to comment.