partial fix was applied to solve window reszing to zero height issue

This commit is contained in:
kisarur
2017-08-02 22:42:14 +05:30
parent 4b26da92cd
commit f5a0b637dc
+8 -1
View File
@@ -2254,7 +2254,12 @@ public class PApplet implements PConstants {
// if (!primary) {
// surface.initImage(pg, w, h);
// }
pg.setSize(w, h);
if(w <= 0 and h <= 0) { //setting size to 0 if size is invalid
pg.setSize(0, 0);
} else {
pg.setSize(w, h);
}
// everything worked, return it
return pg;
@@ -2299,6 +2304,8 @@ public class PApplet implements PConstants {
if (e.getMessage().contains("cannot be <= 0")) {
// IllegalArgumentException will be thrown if w/h is <= 0
// http://code.google.com/p/processing/issues/detail?id=983
// a fix should be done here to resize the window back to 0 if new size is not valid
throw new RuntimeException(e);
} else {