Right click popups working
This commit is contained in:
parent
d89aabff81
commit
2eb2672329
29 changed files with 198 additions and 177 deletions
|
|
@ -34,26 +34,30 @@ float RotateWheel::wheel_end() {
|
|||
return boundingBox.value().width() * 0.5f;
|
||||
}
|
||||
|
||||
bool RotateWheel::input_mouse_button_callback(const InputManager::MouseButtonCallbackArgs& button, bool mouseHovering) {
|
||||
void RotateWheel::input_mouse_button_callback(const InputManager::MouseButtonCallbackArgs& button, bool mouseHovering) {
|
||||
isHovering = mouseHovering;
|
||||
isHeld = isHovering && button.button == InputManager::MouseButton::LEFT && button.down;
|
||||
update_rotate_wheel_mouse_hover(button.pos);
|
||||
isRotateBarHeld = isRotateBarHovered && isHeld;
|
||||
update_paint_circle_menu_mouse(button.pos);
|
||||
return Element::input_mouse_button_callback(button, mouseHovering);
|
||||
update_rotate_wheel_mouse(button.pos);
|
||||
Element::input_mouse_button_callback(button, mouseHovering);
|
||||
}
|
||||
|
||||
bool RotateWheel::input_mouse_motion_callback(const InputManager::MouseMotionCallbackArgs& motion, bool mouseHovering) {
|
||||
void RotateWheel::input_mouse_motion_callback(const InputManager::MouseMotionCallbackArgs& motion, bool mouseHovering) {
|
||||
isHovering = mouseHovering;
|
||||
update_paint_circle_menu_mouse(motion.pos);
|
||||
return Element::input_mouse_motion_callback(motion, mouseHovering);
|
||||
update_rotate_wheel_mouse_hover(motion.pos);
|
||||
update_rotate_wheel_mouse(motion.pos);
|
||||
Element::input_mouse_motion_callback(motion, mouseHovering);
|
||||
}
|
||||
|
||||
void RotateWheel::update_paint_circle_menu_mouse(const Vector2f& p) {
|
||||
void RotateWheel::update_rotate_wheel_mouse_hover(const Vector2f& p) {
|
||||
float distFromCenter = vec_distance(p, boundingBox.value().center());
|
||||
isRotateBarHovered = isHovering && distFromCenter > wheel_start() && distFromCenter < wheel_end();
|
||||
}
|
||||
|
||||
void RotateWheel::update_rotate_wheel_mouse(const Vector2f& p) {
|
||||
if(boundingBox.has_value()) {
|
||||
Vector2f vecFromCenter = (p - boundingBox.value().center()).normalized();
|
||||
float distFromCenter = vec_distance(p, boundingBox.value().center());
|
||||
isRotateBarHovered = isHovering && distFromCenter > wheel_start() && distFromCenter < wheel_end();
|
||||
|
||||
if(isRotateBarHeld) {
|
||||
gui.set_post_callback_func([&, vecFromCenter] {
|
||||
auto& rotationAngle = *rotateAngle;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue