mirror of
https://github.com/creyD/intelliphoto.git
synced 2026-04-12 19:40:28 +02:00
hotfix, rechtsklick bringte das programm zum abstürzen
This commit is contained in:
@@ -29,13 +29,10 @@ void IntelliToolGradient::onMouseRightPressed(int x, int y){
|
||||
}
|
||||
|
||||
void IntelliToolGradient::onMouseLeftReleased(int x, int y){
|
||||
if(hasMoved){
|
||||
if(hasMoved && this->isDrawing){
|
||||
computeGradientLayer();
|
||||
IntelliTool::onMouseLeftReleased(x,y);
|
||||
}
|
||||
else{
|
||||
IntelliTool::onMouseRightPressed(x,y);
|
||||
}
|
||||
}
|
||||
|
||||
void IntelliToolGradient::onMouseRightReleased(int x, int y){
|
||||
@@ -43,16 +40,18 @@ void IntelliToolGradient::onMouseRightReleased(int x, int y){
|
||||
}
|
||||
|
||||
void IntelliToolGradient::onMouseMoved(int x, int y){
|
||||
hasMoved = true;
|
||||
B = QPoint(x,y);
|
||||
VectorAB[0] = static_cast<float>(B.x() - A.x());
|
||||
VectorAB[1] = static_cast<float>(B.y() - A.y());
|
||||
NormalVector[0] = VectorAB[1];
|
||||
NormalVector[1] = (-1*VectorAB[0]);
|
||||
NormalDotNormal = dotProduct(NormalVector,NormalVector);
|
||||
this->Canvas->image->drawPlain(Qt::transparent);
|
||||
computeGradientLayer();
|
||||
Canvas->image->drawLine(A,B,LineColor,1);
|
||||
if(this->isDrawing){
|
||||
hasMoved = true;
|
||||
B = QPoint(x,y);
|
||||
VectorAB[0] = static_cast<float>(B.x() - A.x());
|
||||
VectorAB[1] = static_cast<float>(B.y() - A.y());
|
||||
NormalVector[0] = VectorAB[1];
|
||||
NormalVector[1] = (-1*VectorAB[0]);
|
||||
NormalDotNormal = dotProduct(NormalVector,NormalVector);
|
||||
this->Canvas->image->drawPlain(Qt::transparent);
|
||||
computeGradientLayer();
|
||||
Canvas->image->drawLine(A,B,LineColor,1);
|
||||
}
|
||||
IntelliTool::onMouseMoved(x,y);
|
||||
}
|
||||
|
||||
|
||||
@@ -3,6 +3,53 @@
|
||||
#include "IntelliTool.h"
|
||||
|
||||
class IntelliToolGradient : public IntelliTool{
|
||||
|
||||
public:
|
||||
IntelliToolGradient(PaintingArea* Area, IntelliColorPicker* colorPicker, IntelliToolsettings* Toolsettings);
|
||||
|
||||
virtual ~IntelliToolGradient() override;
|
||||
|
||||
/*!
|
||||
* \brief A function managing the right click Pressed of a Mouse. Constructing the Canvas to draw on. Call this in child classes!
|
||||
* \param x - The x coordinate relative to the active/canvas layer.
|
||||
* \param y - The y coordinate relative to the active/canvas layer.
|
||||
*/
|
||||
virtual void onMouseRightPressed(int x, int y) override;
|
||||
|
||||
/*!
|
||||
* \brief A function managing the right click Released of a Mouse. Merging the Canvas to Active. Call this in child classes!
|
||||
* \param x - The x coordinate relative to the active/canvas layer.
|
||||
* \param y - The y coordinate relative to the active/canvas layer.
|
||||
*/
|
||||
virtual void onMouseRightReleased(int x, int y) override;
|
||||
|
||||
/*!
|
||||
* \brief A function managing the left click Pressed of a Mouse. Resetting the current draw. Call this in child classes!
|
||||
* \param x - The x coordinate relative to the active/canvas layer.
|
||||
* \param y - The y coordinate relative to the active/canvas layer.
|
||||
*/
|
||||
virtual void onMouseLeftPressed(int x, int y) override;
|
||||
|
||||
/*!
|
||||
* \brief A function managing the left click Released of a Mouse. Call this in child classes!
|
||||
* \param x - The x coordinate relative to the active/canvas layer.
|
||||
* \param y - The y coordinate relative to the active/canvas layer.
|
||||
*/
|
||||
virtual void onMouseLeftReleased(int x, int y) override;
|
||||
|
||||
/*!
|
||||
* \brief A function managing the scroll event. A positive value means scrolling outwards. Call this in child classes!
|
||||
* \param value - The absolute the scroll has changed.
|
||||
*/
|
||||
virtual void onWheelScrolled(int value) override;
|
||||
|
||||
/*!
|
||||
* \brief A function managing the mouse moved event. Call this in child classes!
|
||||
* \param x - The x coordinate of the new mouse position.
|
||||
* \param y - The y coordinate of the new mouse position.
|
||||
*/
|
||||
virtual void onMouseMoved(int x, int y) override;
|
||||
|
||||
private:
|
||||
QPoint A;
|
||||
QPoint B;
|
||||
@@ -13,52 +60,6 @@ private:
|
||||
QColor LineColor;
|
||||
bool hasMoved;
|
||||
|
||||
public:
|
||||
IntelliToolGradient(PaintingArea* Area, IntelliColorPicker* colorPicker, IntelliToolsettings* Toolsettings);
|
||||
|
||||
~IntelliToolGradient();
|
||||
|
||||
/*!
|
||||
* \brief A function managing the right click Pressed of a Mouse. Constructing the Canvas to draw on. Call this in child classes!
|
||||
* \param x - The x coordinate relative to the active/canvas layer.
|
||||
* \param y - The y coordinate relative to the active/canvas layer.
|
||||
*/
|
||||
virtual void onMouseRightPressed(int x, int y);
|
||||
|
||||
/*!
|
||||
* \brief A function managing the right click Released of a Mouse. Merging the Canvas to Active. Call this in child classes!
|
||||
* \param x - The x coordinate relative to the active/canvas layer.
|
||||
* \param y - The y coordinate relative to the active/canvas layer.
|
||||
*/
|
||||
virtual void onMouseRightReleased(int x, int y);
|
||||
|
||||
/*!
|
||||
* \brief A function managing the left click Pressed of a Mouse. Resetting the current draw. Call this in child classes!
|
||||
* \param x - The x coordinate relative to the active/canvas layer.
|
||||
* \param y - The y coordinate relative to the active/canvas layer.
|
||||
*/
|
||||
virtual void onMouseLeftPressed(int x, int y);
|
||||
|
||||
/*!
|
||||
* \brief A function managing the left click Released of a Mouse. Call this in child classes!
|
||||
* \param x - The x coordinate relative to the active/canvas layer.
|
||||
* \param y - The y coordinate relative to the active/canvas layer.
|
||||
*/
|
||||
virtual void onMouseLeftReleased(int x, int y);
|
||||
|
||||
/*!
|
||||
* \brief A function managing the scroll event. A positive value means scrolling outwards. Call this in child classes!
|
||||
* \param value - The absolute the scroll has changed.
|
||||
*/
|
||||
virtual void onWheelScrolled(int value);
|
||||
|
||||
/*!
|
||||
* \brief A function managing the mouse moved event. Call this in child classes!
|
||||
* \param x - The x coordinate of the new mouse position.
|
||||
* \param y - The y coordinate of the new mouse position.
|
||||
*/
|
||||
virtual void onMouseMoved(int x, int y);
|
||||
|
||||
void computePixelColor(QPoint Point);
|
||||
|
||||
double dotProduct(double Vector1[2], double Vector2[2]);
|
||||
|
||||
Reference in New Issue
Block a user