Centralize retained popup activation
This commit is contained in:
@@ -486,9 +486,7 @@ void App::init_sidebar()
|
||||
|
||||
stroke->SetPosition(pos.x - stroke->m_size.x / 2.f, pos.y + 16);
|
||||
stroke->SetPositioning(YGPositionTypeAbsolute);
|
||||
stroke->m_capture_children = false;
|
||||
stroke->m_mouse_ignore = false;
|
||||
stroke->mouse_capture();
|
||||
pp::panopainter::activate_legacy_popup_overlay(*stroke);
|
||||
auto scroll = stroke->find<NodeScroll>("scroller");
|
||||
//scroll->SetHeight(glm::max(100.f, screen.y - pos.y - 200.f));
|
||||
|
||||
@@ -531,9 +529,7 @@ void App::init_sidebar()
|
||||
|
||||
color->SetPosition(pos.x - color->m_size.x / 2.f, pos.y + 16);
|
||||
color->SetPositioning(YGPositionTypeAbsolute);
|
||||
color->m_capture_children = false;
|
||||
color->m_mouse_ignore = false;
|
||||
color->mouse_capture();
|
||||
pp::panopainter::activate_legacy_popup_overlay(*color);
|
||||
|
||||
color->on_popup_close = [this, tick](Node*) {
|
||||
tick->destroy();
|
||||
@@ -566,9 +562,7 @@ void App::init_sidebar()
|
||||
|
||||
layers->SetPosition(pos.x - layers->m_size.x / 2.f, pos.y + 16);
|
||||
layers->SetPositioning(YGPositionTypeAbsolute);
|
||||
layers->m_capture_children = false;
|
||||
layers->m_mouse_ignore = false;
|
||||
layers->mouse_capture();
|
||||
pp::panopainter::activate_legacy_popup_overlay(*layers);
|
||||
auto scroll = layers->find<NodeScroll>("layers-container");
|
||||
scroll->SetMaxHeight(glm::max(100.f, screen.y - pos.y - 200.f));
|
||||
|
||||
@@ -603,9 +597,7 @@ void App::init_sidebar()
|
||||
|
||||
grid->SetPosition(pos.x - grid->m_size.x / 2.f, pos.y + 16);
|
||||
grid->SetPositioning(YGPositionTypeAbsolute);
|
||||
grid->m_capture_children = false;
|
||||
grid->m_mouse_ignore = false;
|
||||
grid->mouse_capture();
|
||||
pp::panopainter::activate_legacy_popup_overlay(*grid);
|
||||
auto scroll = grid->find<NodeScroll>("scroller");
|
||||
scroll->SetMaxHeight(glm::max(100.f, screen.y - pos.y - 250.f));
|
||||
|
||||
|
||||
@@ -114,10 +114,7 @@ private:
|
||||
tick->SetPosition(tick_pos.x, tick_pos.y + (button->m_size.y - tick_sz.y) * 0.5f);
|
||||
popup->update();
|
||||
|
||||
popup->m_mouse_ignore = false;
|
||||
popup->m_flood_events = true;
|
||||
popup->m_capture_children = false;
|
||||
popup->mouse_capture();
|
||||
activate_legacy_popup_overlay(*popup);
|
||||
|
||||
popup->on_popup_close = [tick](Node*) {
|
||||
tick->destroy();
|
||||
@@ -173,10 +170,7 @@ private:
|
||||
tick->SetPosition(tick_pos.x, tick_pos.y + (target->m_size.y - tick_sz.y) * 0.5f);
|
||||
popup->update();
|
||||
|
||||
popup->m_mouse_ignore = false;
|
||||
popup->m_flood_events = true;
|
||||
popup->m_capture_children = false;
|
||||
popup->mouse_capture();
|
||||
activate_legacy_popup_overlay(*popup);
|
||||
|
||||
auto c = static_cast<NodeBorder*>(target->m_children[0].get());
|
||||
panel_.m_picker->set_color(c->m_color);
|
||||
|
||||
@@ -15,6 +15,19 @@ void initialize_legacy_overlay_node(App& app, Node& node)
|
||||
node.loaded();
|
||||
}
|
||||
|
||||
void configure_legacy_popup_overlay(Node& node) noexcept
|
||||
{
|
||||
node.m_mouse_ignore = false;
|
||||
node.m_flood_events = true;
|
||||
node.m_capture_children = false;
|
||||
}
|
||||
|
||||
void activate_legacy_popup_overlay(Node& node) noexcept
|
||||
{
|
||||
configure_legacy_popup_overlay(node);
|
||||
node.mouse_capture();
|
||||
}
|
||||
|
||||
pp::foundation::Status attach_legacy_overlay_node(
|
||||
App& app,
|
||||
const std::shared_ptr<Node>& node) noexcept
|
||||
|
||||
@@ -12,6 +12,9 @@ namespace pp::panopainter {
|
||||
|
||||
void initialize_legacy_overlay_node(App& app, Node& node);
|
||||
|
||||
void configure_legacy_popup_overlay(Node& node) noexcept;
|
||||
void activate_legacy_popup_overlay(Node& node) noexcept;
|
||||
|
||||
[[nodiscard]] pp::foundation::Status attach_legacy_overlay_node(
|
||||
App& app,
|
||||
const std::shared_ptr<Node>& node) noexcept;
|
||||
|
||||
@@ -76,10 +76,7 @@ void NodeComboBox::loaded()
|
||||
popup->SetFlexGrow(1.f);
|
||||
popup->update();
|
||||
root()->update();
|
||||
popup->mouse_capture();
|
||||
popup->m_mouse_ignore = false;
|
||||
popup->m_flood_events = true;
|
||||
popup->m_capture_children = false;
|
||||
pp::panopainter::activate_legacy_popup_overlay(*popup);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -270,9 +270,7 @@ void NodePanelStroke::init_controls()
|
||||
m_brush_popup->loaded();
|
||||
m_brush_popup->SetPositioning(YGPositionTypeAbsolute);
|
||||
m_brush_popup->SetSize(300, 400);
|
||||
m_brush_popup->m_mouse_ignore = false;
|
||||
m_brush_popup->m_flood_events = true;
|
||||
m_brush_popup->m_capture_children = false;
|
||||
pp::panopainter::configure_legacy_popup_overlay(*m_brush_popup);
|
||||
|
||||
m_pattern_popup = std::make_shared<NodePanelBrush>();
|
||||
m_pattern_popup->set_manager(m_manager);
|
||||
@@ -282,9 +280,7 @@ void NodePanelStroke::init_controls()
|
||||
m_pattern_popup->loaded();
|
||||
m_pattern_popup->SetPositioning(YGPositionTypeAbsolute);
|
||||
m_pattern_popup->SetSize(300, 400);
|
||||
m_pattern_popup->m_mouse_ignore = false;
|
||||
m_pattern_popup->m_flood_events = true;
|
||||
m_pattern_popup->m_capture_children = false;
|
||||
pp::panopainter::configure_legacy_popup_overlay(*m_pattern_popup);
|
||||
|
||||
//m_presets_popup = std::make_shared<NodePanelBrushPreset>();
|
||||
//m_presets_popup->m_manager = m_manager;
|
||||
@@ -334,10 +330,7 @@ void NodePanelStroke::init_controls()
|
||||
pos.y = 0;
|
||||
App::I->presets->SetPosition(pos.x + 16, pos.y);
|
||||
App::I->presets->SetPositioning(YGPositionTypeAbsolute);
|
||||
App::I->presets->m_mouse_ignore = false;
|
||||
App::I->presets->m_flood_events = true;
|
||||
App::I->presets->m_capture_children = false;
|
||||
App::I->presets->mouse_capture();
|
||||
pp::panopainter::activate_legacy_popup_overlay(*App::I->presets);
|
||||
root()->update();
|
||||
|
||||
App::I->presets->on_popup_close = [this, tick](Node*) {
|
||||
@@ -382,7 +375,7 @@ void NodePanelStroke::init_controls()
|
||||
if (pos.y < 0)
|
||||
pos.y = 0;
|
||||
m_brush_popup->SetPosition(pos.x + 16, pos.y);
|
||||
m_brush_popup->mouse_capture();
|
||||
pp::panopainter::activate_legacy_popup_overlay(*m_brush_popup);
|
||||
root()->update();
|
||||
|
||||
m_brush_popup->on_popup_close = [this, tick](Node*) {
|
||||
@@ -419,7 +412,7 @@ void NodePanelStroke::init_controls()
|
||||
if (pos.y < 0)
|
||||
pos.y = 0;
|
||||
m_brush_popup->SetPosition(pos.x + 16, pos.y);
|
||||
m_brush_popup->mouse_capture();
|
||||
pp::panopainter::activate_legacy_popup_overlay(*m_brush_popup);
|
||||
root()->update();
|
||||
|
||||
m_brush_popup->on_popup_close = [this, tick](Node*) {
|
||||
@@ -456,7 +449,7 @@ void NodePanelStroke::init_controls()
|
||||
if (pos.y < 0)
|
||||
pos.y = 0;
|
||||
m_pattern_popup->SetPosition(pos.x + 16, pos.y);
|
||||
m_pattern_popup->mouse_capture();
|
||||
pp::panopainter::activate_legacy_popup_overlay(*m_pattern_popup);
|
||||
root()->update();
|
||||
|
||||
m_pattern_popup->on_popup_close = [this, tick](Node*) {
|
||||
|
||||
Reference in New Issue
Block a user