CodingTrain / CodingTrain/Suggestion-Box

windowResized() + line(pmouseX, pmouseY, mouseX, mouseY) problem

Open
#504 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
No language data
Stars
570
Forks
85
PR merge metrics
No merged PRs in 30d

Description

Hi There
Following this video along I bumped into a problem with no obvious solution:
https://www.youtube.com/watch?v=OIfEHD3KqCg&index=17&list=PLRqwX-V7Uu6bI1SlcCRfLH79HZrFAtBvX
Its a Q&A video that generated another Q!
If you resize the window the drawing made with line() disappears.
edit: testing again I realized that any drawing made like that would disappear with windowResized(). This is bad!
Here is the mini example:

```
function setup() {
canv = createCanvas(windowWidth, windowHeight);
canv.position(0, 0);
stroke(255, 0, 0);
}
function windowResized() {
resizeCanvas(windowWidth, windowHeight);
}
function draw() {
if (mouseIsPressed) {
line(pmouseX, pmouseY, mouseX, mouseY);
}
}
```

I may open an issue in the p5 Github about it. But still, maybe I'm missing something. In the forum no one knew the solution to that.

best regards,
Gil

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.