Skip to content

Commit

Permalink
Fixed little bug : dragging and clicking edgecase x = 0, y = 0 was no…
Browse files Browse the repository at this point in the history
…t working.
  • Loading branch information
timknapen committed Feb 22, 2018
1 parent 73f569d commit 351df31
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/ButtonPanel/ColorPickerItem.cpp
Expand Up @@ -79,7 +79,7 @@ bool ColorPickerItem::checkClick(int x, int y){
int imgw = img.getWidth();
int imgh = img.getHeight();
selected = false;
if(imgPos.x > 0 && imgPos.x < imgw && imgPos.y > 0 && imgPos.y < imgh){
if(imgPos.x >= 0 && imgPos.x < imgw && imgPos.y >= 0 && imgPos.y < imgh){
selected = true;
}
if (selected) {
Expand Down Expand Up @@ -111,7 +111,7 @@ void ColorPickerItem::drag(int x, int y){
imgPos.y = imgh-1;
}

if(imgPos.x > 0 && imgPos.x < imgw && imgPos.y > 0 && imgPos.y < imgh){
if(imgPos.x >= 0 && imgPos.x < imgw && imgPos.y >= 0 && imgPos.y < imgh){
ofPixels pix = img.getPixels();
int id = (int)imgPos.x + (int)imgPos.y * imgw;
color->set(pix[3*id], pix[3*id+1], pix[3*id+2]);
Expand Down

0 comments on commit 351df31

Please sign in to comment.