Fixed paint popup menu collision problems
This commit is contained in:
parent
2eb2672329
commit
60c12ce150
5 changed files with 8 additions and 16 deletions
|
|
@ -98,8 +98,6 @@ void DrawingProgram::input_mouse_button_callback(const InputManager::MouseButton
|
|||
}
|
||||
}
|
||||
else {
|
||||
if(!rightClickPopupHoverOnClick)
|
||||
clear_right_click_popup();
|
||||
if(!world.main.g.gui.cursor_obstructed()) {
|
||||
if(button.button == InputManager::MouseButton::LEFT && !controls.middleClickHeld) {
|
||||
controls.leftClickHeld = true;
|
||||
|
|
@ -389,7 +387,6 @@ void DrawingProgram::right_click_popup_gui() {
|
|||
void DrawingProgram::set_right_click_popup_location(const Vector2f& newLoc) {
|
||||
if(!rightClickPopupLocation.has_value() || rightClickPopupLocation.value() != newLoc) {
|
||||
rightClickPopupLocation = newLoc;
|
||||
rightClickPopupHoverOnClick = false;
|
||||
world.main.g.gui.set_to_layout();
|
||||
}
|
||||
}
|
||||
|
|
@ -398,7 +395,6 @@ void DrawingProgram::clear_right_click_popup() {
|
|||
if(rightClickPopupLocation.has_value()) {
|
||||
rightClickPopupLocation = std::nullopt;
|
||||
world.main.g.gui.set_to_layout();
|
||||
rightClickPopupHoverOnClick = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -70,7 +70,9 @@ class DrawingProgram {
|
|||
void input_pen_touch_callback(const InputManager::PenTouchCallbackArgs& touch);
|
||||
void input_pen_motion_callback(const InputManager::PenMotionCallbackArgs& motion);
|
||||
void input_pen_axis_callback(const InputManager::PenAxisCallbackArgs& axis);
|
||||
bool rightClickPopupHoverOnClick = false;
|
||||
|
||||
void set_right_click_popup_location(const Vector2f& newLoc);
|
||||
void clear_right_click_popup();
|
||||
private:
|
||||
void process_transform_message(const std::vector<std::pair<NetworkingObjects::NetObjID, CoordSpaceHelper>>& transforms);
|
||||
|
||||
|
|
@ -129,8 +131,6 @@ class DrawingProgram {
|
|||
|
||||
std::optional<Vector2f> rightClickPopupLocation;
|
||||
|
||||
void set_right_click_popup_location(const Vector2f& newLoc);
|
||||
void clear_right_click_popup();
|
||||
|
||||
uint32_t nextID = 0;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,12 +1,11 @@
|
|||
#include "PopupHelpers.hpp"
|
||||
#include "../Elements/LayoutElement.hpp"
|
||||
|
||||
namespace GUIStuff { namespace ElementHelpers {
|
||||
|
||||
void paint_circle_popup_menu(GUIManager& gui, const char* id, const Vector2f& centerPos, const PaintCircleMenu::Data& val) {
|
||||
constexpr float size = 300.0f;
|
||||
gui.element<LayoutElement>(id, [&] (const Clay_ElementId& lId) {
|
||||
CLAY(lId, {.layout = {
|
||||
gui.new_id(id, [&] {
|
||||
CLAY_AUTO_ID({.layout = {
|
||||
.sizing = {.width = CLAY_SIZING_FIXED(size), .height = CLAY_SIZING_FIXED(size)}
|
||||
},
|
||||
.floating = {
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ void PaintCircleMenu::layout(const Clay_ElementId& id, const Data& data) {
|
|||
}
|
||||
|
||||
bool PaintCircleMenu::collides_with_point(const Vector2f& p) const {
|
||||
return boundingBox.has_value() && SCollision::collide(SCollision::Circle<float>(boundingBox.value().center(), CIRCLE_END), p);
|
||||
return boundingBox.has_value() && SCollision::collide(SCollision::Circle<float>(boundingBox.value().center(), CIRCLE_END), p) && !SCollision::collide(SCollision::Circle<float>(boundingBox.value().center(), PALETTE_START), p);
|
||||
}
|
||||
|
||||
void PaintCircleMenu::input_mouse_button_callback(const InputManager::MouseButtonCallbackArgs& button, bool mouseHovering) {
|
||||
|
|
@ -100,10 +100,6 @@ void PaintCircleMenu::clay_draw(SkCanvas* canvas, UpdateInputData& io, Clay_Rend
|
|||
|
||||
draw_rotate_bar(canvas, io, skiaAA);
|
||||
draw_palette_bar(canvas, io, skiaAA);
|
||||
SkPaint p;
|
||||
p.setAntiAlias(skiaAA);
|
||||
p.setColor4f(color_mul_alpha(io.theme->backColor1, 0.5f));
|
||||
canvas->drawCircle(0.0f, 0.0f, PALETTE_START, p);
|
||||
|
||||
canvas->restore();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -425,7 +425,8 @@ void Toolbar::paint_popup(Vector2f popupPos) {
|
|||
gui.set_to_layout();
|
||||
},
|
||||
.mouseButton = [&](const InputManager::MouseButtonCallbackArgs& button, bool mouseHovering) {
|
||||
main.world->drawProg.rightClickPopupHoverOnClick = mouseHovering;
|
||||
if(!mouseHovering && button.down && button.button != InputManager::MouseButton::RIGHT)
|
||||
main.world->drawProg.clear_right_click_popup();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue