Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

fix odd small patterns

  • Loading branch information...
commit eab8396ec109fd47de590a13e47dcb7986553216 1 parent 228230e
@mcanet authored
Showing with 11 additions and 6 deletions.
  1. +11 −6 protoAppKnitic_p5/buttons_actions.pde
View
17 protoAppKnitic_p5/buttons_actions.pde
@@ -96,11 +96,16 @@ void fillArrayWithImage(String imgPath) {
lastEndLineStarted = false;
if (cols>0 && rows>0) loadPattern = true;
pixelArray = new int[cols][rows];
- int restPixels = 200-cols;
- leftStick = 100-(restPixels/2);
- rightStick = 100-(restPixels/2);
- if ( (100-leftStick)+cols+(100-rightStick) !=200) {
- rightStick +=1;
+ if(cols==200){
+ leftStick = 100;
+ rightStick = 100;
+ }else{
+ int restPixels = (200-cols);
+ leftStick = (100-(restPixels/2));
+ rightStick = 100-(restPixels/2);
+ if ( (100-leftStick)+cols+(100-rightStick) !=200) {
+ rightStick -=1;
+ }
}
if (cols!=200) {
@@ -137,7 +142,7 @@ void howMuchPatternToLeft(String message) {
userStartStick = JOptionPane.showInputDialog(frame, message, Integer.toString(cols-100));
}
if (!userStartStick.equals(Integer.toString(leftStick))) {
- if ((100-Integer.valueOf(userStartStick))+cols>200 ) {
+ if ((100-(Integer.valueOf(userStartStick)))+cols>200 ) {
howMuchPatternToLeft("Is not possible to put that right. The maxium is "+Integer.toString((cols-100)));
}
else {
Please sign in to comment.
Something went wrong with that request. Please try again.