From f44b452678af6f236da84fb0fb003d3dfd849443 Mon Sep 17 00:00:00 2001 From: Andreas Butti Date: Sun, 3 May 2015 20:41:21 +0200 Subject: [PATCH] Fixed "Rendering of circles" for Ticket #85 --- src/control/ToolHandler.cpp | 25 +++++++++++++++++++++---- src/control/tools/InputHandler.cpp | 7 +++---- 2 files changed, 24 insertions(+), 8 deletions(-) diff --git a/src/control/ToolHandler.cpp b/src/control/ToolHandler.cpp index 5a6d3fce..f0de83fd 100644 --- a/src/control/ToolHandler.cpp +++ b/src/control/ToolHandler.cpp @@ -252,7 +252,12 @@ void ToolHandler::setRuler(bool ruler, bool disableOthers) { XOJ_CHECK_TYPE(ToolHandler); - if (ruler && disableOthers) setAll(false); + if (ruler && disableOthers) + { + setAll(false); + } + + this->current->ruler = ruler; } @@ -260,7 +265,11 @@ void ToolHandler::setRectangle(bool rectangle, bool disableOthers) { XOJ_CHECK_TYPE(ToolHandler); - if (rectangle && disableOthers) setAll(false); + if (rectangle && disableOthers) + { + setAll(false); + } + this->current->rectangle = rectangle; } @@ -268,7 +277,11 @@ void ToolHandler::setCircle(bool circle, bool disableOthers) { XOJ_CHECK_TYPE(ToolHandler); - if (circle && disableOthers) setAll(false); + if (circle && disableOthers) + { + setAll(false); + } + this->current->circle = circle; } @@ -276,7 +289,11 @@ void ToolHandler::setArrow(bool arrow, bool disableOthers) { XOJ_CHECK_TYPE(ToolHandler); - if (arrow && disableOthers) setAll(false); + if (arrow && disableOthers) + { + setAll(false); + } + this->current->arrow = arrow; } diff --git a/src/control/tools/InputHandler.cpp b/src/control/tools/InputHandler.cpp index 42334c53..2c555580 100644 --- a/src/control/tools/InputHandler.cpp +++ b/src/control/tools/InputHandler.cpp @@ -131,15 +131,14 @@ void InputHandler::addPointToTmpStroke(GdkEventMotion* event) Point p = tmpStroke->getPoint(0); //set resolution proportional to radius double diameter = sqrt(pow(x - p.x, 2.0) + pow(y - p.y, 2.0)); - int npts = (int) (diameter / 2.0); + int npts = (int) (diameter * 2.0); double center_x = (x + p.x) / 2.0; double center_y = (y + p.y) / 2.0; double angle = atan2((y - p.y), (x - p.x)); - - if (npts < 12) + if (npts < 24) { - npts = 12; // min. number of points + npts = 24; // min. number of points } //remove previous points