limit cycle radius
This commit is contained in:
parent
f19688ace6
commit
0c9caab59e
@ -24,10 +24,16 @@ void DrawRender::graphicsUpdate(int type) {
|
|||||||
oldCircle.getUperLeft().x, oldCircle.getUperLeft().y);
|
oldCircle.getUperLeft().x, oldCircle.getUperLeft().y);
|
||||||
|
|
||||||
int radius = utils::getDistance(getMouseLeftDownPosition(), getMousePostion()) / 2;
|
int radius = utils::getDistance(getMouseLeftDownPosition(), getMousePostion()) / 2;
|
||||||
|
|
||||||
vkvm::Coordinates center;
|
vkvm::Coordinates center;
|
||||||
center.x = (mousePosition.x + mouseLeftDownPosition.x) / 2;
|
center.x = (mousePosition.x + mouseLeftDownPosition.x) / 2;
|
||||||
center.y = (mousePosition.y + mouseLeftDownPosition.y) / 2;
|
center.y = (mousePosition.y + mouseLeftDownPosition.y) / 2;
|
||||||
|
|
||||||
|
if(center.x + radius > windowWidth || center.x - radius < 0
|
||||||
|
|| center.y + radius > windowHeight || center.y - radius < 0) {
|
||||||
|
radius = utils::min(utils::min(center.x, windowWidth - center.x), utils::min(center.y, windowHeight - center.y));
|
||||||
|
}
|
||||||
|
|
||||||
oldCircle = Circle(center, radius, penWidth, false);
|
oldCircle = Circle(center, radius, penWidth, false);
|
||||||
|
|
||||||
painting = true;
|
painting = true;
|
||||||
|
Loading…
Reference in New Issue
Block a user