Widgets Additions and sketch3d new gui
This commit is contained in:
parent
afad2c80e5
commit
e10a494223
44 changed files with 1015 additions and 322 deletions
22
Widgets/private/widgets/ColorPickerWidget.cpp
Normal file
22
Widgets/private/widgets/ColorPickerWidget.cpp
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
#include "ColorPickerWidget.hpp"
|
||||
|
||||
using namespace tp;
|
||||
|
||||
void RGBPickerWidget::process(const EventHandler& events) {
|
||||
if (events.isPressed(InputID::MOUSE1)) {
|
||||
mColorWheel.fromPoint(getArea().relative(), events.getPointer());
|
||||
lockFocus();
|
||||
}
|
||||
|
||||
if (events.isReleased(InputID::MOUSE1)) {
|
||||
freeFocus();
|
||||
}
|
||||
|
||||
if (events.getPointerDelta().length() > EPSILON && events.isDown(InputID::MOUSE1)) {
|
||||
mColorWheel.fromPoint(getArea().relative(), events.getPointer());
|
||||
}
|
||||
}
|
||||
|
||||
void RGBPickerWidget::draw(Canvas& canvas) {
|
||||
canvas.colorWheel(getArea().relative(), mColorWheel);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue