fix popup menu on_select event
This commit is contained in:
@@ -469,7 +469,7 @@ void NodePanelBrushPreset::init()
|
|||||||
case 0: // download
|
case 0: // download
|
||||||
break;
|
break;
|
||||||
case 1: // import
|
case 1: // import
|
||||||
App::I->pick_file({".abr", ".ABR"}, [] (std::string path) {
|
App::I->pick_file({"abr", "ppbr"}, [] (std::string path) {
|
||||||
std::thread([path] {
|
std::thread([path] {
|
||||||
BT_SetTerminate();
|
BT_SetTerminate();
|
||||||
App::I->stroke->import_abr(path);
|
App::I->stroke->import_abr(path);
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
#include "pch.h"
|
#include "pch.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
#include "node_popup_menu.h"
|
#include "node_popup_menu.h"
|
||||||
|
#include "node_button_custom.h"
|
||||||
|
|
||||||
Node* NodePopupMenu::clone_instantiate() const
|
Node* NodePopupMenu::clone_instantiate() const
|
||||||
{
|
{
|
||||||
@@ -9,11 +10,11 @@ Node* NodePopupMenu::clone_instantiate() const
|
|||||||
|
|
||||||
void NodePopupMenu::init()
|
void NodePopupMenu::init()
|
||||||
{
|
{
|
||||||
m_flood_events = true;
|
|
||||||
SetPosition(0, 0);
|
SetPosition(0, 0);
|
||||||
SetWidth(100);
|
SetWidth(100);
|
||||||
SetHeight(500);
|
SetHeight(500);
|
||||||
SetPositioning(YGPositionTypeAbsolute);
|
SetPositioning(YGPositionTypeAbsolute);
|
||||||
|
m_flood_events = true;
|
||||||
m_mouse_ignore = false;
|
m_mouse_ignore = false;
|
||||||
m_capture_children = false;
|
m_capture_children = false;
|
||||||
}
|
}
|
||||||
@@ -57,4 +58,14 @@ void NodePopupMenu::added(Node* parent)
|
|||||||
m_mouse_ignore = false;
|
m_mouse_ignore = false;
|
||||||
m_flood_events = true;
|
m_flood_events = true;
|
||||||
m_capture_children = false;
|
m_capture_children = false;
|
||||||
|
for (int i = 0; i < m_children.size(); i++)
|
||||||
|
{
|
||||||
|
if (auto b = std::dynamic_pointer_cast<NodeButtonCustom>(m_children[i]))
|
||||||
|
{
|
||||||
|
b->on_click = [this, i](Node* target) {
|
||||||
|
if (on_select)
|
||||||
|
on_select(this, i);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user