Tool anpassungen

This commit is contained in:
Sonaion
2019-12-19 13:54:17 +01:00
parent a3c19e9851
commit ec37be62fc
6 changed files with 74 additions and 87 deletions

View File

@@ -23,6 +23,9 @@ void IntelliToolFloodFill::onMouseRightReleased(int x, int y){
}
void IntelliToolFloodFill::onMouseLeftPressed(int x, int y){
if(!(x>=0 && x<Area->getWidthOfActive() && y>=0 && y<Area->getHeightOfActive())){
return;
}
IntelliTool::onMouseLeftPressed(x,y);
QPoint start(x,y);
@@ -50,11 +53,11 @@ void IntelliToolFloodFill::onMouseLeftPressed(int x, int y){
Canvas->image->drawPixel(left,newColor);
Q.push(left);
}
if((top.y() < Canvas->hight) && (Canvas->image->getPixelColor(top) != newColor) && (Active->image->getPixelColor(top) == oldColor)){
if((top.y() >= 0) && (Canvas->image->getPixelColor(top) != newColor) && (Active->image->getPixelColor(top) == oldColor)){
Canvas->image->drawPixel(top,newColor);
Q.push(top);
}
if((down.y() >= 0) && (Canvas->image->getPixelColor(down) != newColor) && (Active->image->getPixelColor(down) == oldColor)){
if((down.y() < Canvas->hight) && (Canvas->image->getPixelColor(down) != newColor) && (Active->image->getPixelColor(down) == oldColor)){
Canvas->image->drawPixel(down,newColor);
Q.push(down);
}