Skip to content

Commit

Permalink
fixed pixel density
Browse files Browse the repository at this point in the history
  • Loading branch information
alexyixuanxu committed Feb 5, 2019
1 parent cd60b1f commit cb79d11
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
2 changes: 1 addition & 1 deletion examples/simplearraytest/mySketch.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ function setup() {

// PLOT COMMAND:
// LINE
foo.plot({ type: 'point', data: e});
foo.plot({ type: 'line', data: e});
}

function draw() {
Expand Down
9 changes: 4 additions & 5 deletions lib/p5.plot.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
this.data = {};
this.xkey = ""; // key value for x axis
this.ykey = ""; // key value for y axis
this.pd = 1; // pixeldensity
//this.pd = 1; // pixeldensity

this.typelist = {};

Expand Down Expand Up @@ -126,10 +126,9 @@
}

push();
//noLoop();
this.graphics = createGraphics((this.right-this.left), (this.bottom-this.top));
pop();
this.graphics.pixelDensity(this.pd);
//this.graphics.pixelDensity(this.pd);

this.plotData = []; // create a new dataset to workwith instead of changing the original!!!!!!!!!!!!
console.log('p5 plot!');
Expand Down Expand Up @@ -167,7 +166,7 @@
//
drawBackground(){
this.graphics.push();
this.graphics.scale(1/this.pd);
// this.graphics.scale(1/this.pd);
// dont need bg rect anymore cuz graphics is a new canvas
this.graphics.background(this.backgroundcolor);

Expand Down Expand Up @@ -348,7 +347,7 @@
let py = 0;

that.graphics.push();
that.graphics.scale(1/that.pd);
// that.graphics.scale(1/that.pd);
that.graphics.fill(that.fillcolor);
that.graphics.stroke(that.strokecolor);
that.graphics.strokeWeight(that.strokeweight);
Expand Down

0 comments on commit cb79d11

Please sign in to comment.