avoid animation panel from dropping to the side panel
This commit is contained in:
@@ -428,6 +428,9 @@
|
||||
</button-custom>
|
||||
-->
|
||||
</border>
|
||||
|
||||
<!--<scroll id="drop-top" color="0 0 0 .5" min-height="10" mouse-capture="true" rtl="ltr"/>-->
|
||||
|
||||
<!-- central row -->
|
||||
<node grow="1" dir="row" wrap="1" height="0" id="central-row">
|
||||
<border color="0 0 0 0.6" pad="0 5 55 0" justify="center" dir="col" wrap="1" flood-events="1" mouse-capture="true">
|
||||
@@ -466,7 +469,7 @@
|
||||
</button-custom>
|
||||
</border>
|
||||
|
||||
<scroll id="drop-left" color="0 0 0 .6" min-width="10" mouse-capture="true" rtl="ltr"/>
|
||||
<scroll id="drop-left" color="0 0 0 .5" min-width="10" mouse-capture="true" rtl="ltr"/>
|
||||
|
||||
<node dir="col" width="1" grow="1" height="100%">
|
||||
<!-- timeline -->
|
||||
@@ -482,23 +485,23 @@
|
||||
</button-custom>
|
||||
</border>
|
||||
</node>
|
||||
|
||||
|
||||
<!--tools options-->
|
||||
<border id="tools-container" color="0 0 0 0.3" dir="row" justify="center" mouse-capture="true">
|
||||
</border>
|
||||
|
||||
<node dir="row" height="200" grow="1">
|
||||
<!--floating area-->
|
||||
<node id="floatings" positioning="absolute" color="0 0 0 1" width="100%" grow="1" height="100%" rtl="ltr"/>
|
||||
<!--quick bar-->
|
||||
<node justify="center" align="center" dir="col" rtl="ltr">
|
||||
<panel-quick id="panel-quick"/>
|
||||
<node height="0" grow="1" max-height="50"/>
|
||||
</node>
|
||||
<!--floating area-->
|
||||
<node id="floatings" color="0 0 0 1" width="1" grow="1" height="100%" rtl="ltr"/>
|
||||
</node>
|
||||
</node>
|
||||
|
||||
<scroll id="drop-right" color="0 0 0 .6" min-width="10" mouse-capture="true" rtl="ltr"/>
|
||||
<scroll id="drop-right" color="0 0 0 .5" min-width="10" mouse-capture="true" rtl="ltr"/>
|
||||
|
||||
<!--<node height="100%" width="1" grow="1" dir="col" align="center" justify="flex-start" rtl="ltr">
|
||||
<border border-color="0 0 0 0" thickness="2" color=".2 .2 .2 .6" pad="10" dir="row" margin="2 0 0 0">
|
||||
@@ -523,8 +526,11 @@
|
||||
</node>-->
|
||||
|
||||
</node>
|
||||
|
||||
<!--<scroll id="drop-bottom" color="0 0 0 .5" min-height="10" mouse-capture="true" rtl="ltr"/>-->
|
||||
|
||||
<!-- status bar -->
|
||||
<border height="10" color="0 0 0 .6" mouse-capture="true"/>
|
||||
<!--<border height="10" color="0 0 0 .6" mouse-capture="true"/>-->
|
||||
<!--<border height="30" width="100%" color=".15" border-color=".3" dir="row" pad="0 0 0 10" align="center">
|
||||
--><!--<text-input width="100" height="100%" color=".3"/>--><!--
|
||||
<text text="Status Bar: nothing to show here."/>
|
||||
|
||||
@@ -919,6 +919,7 @@ void App::init_menu_tools()
|
||||
fpanel->m_container->add_child(animation);
|
||||
fpanel->SetHeight(300);
|
||||
fpanel->m_title->set_text("Animation");
|
||||
fpanel->m_droppable = false;
|
||||
grid->SetPositioning(YGPositionTypeRelative);
|
||||
grid->SetPosition(0, 0);
|
||||
grid->SetWidthP(100);
|
||||
@@ -1626,6 +1627,7 @@ void App::ui_restore()
|
||||
break;
|
||||
case NodePanelFloating::kClass::Animation:
|
||||
f->m_container->add_child(animation);
|
||||
f->m_droppable = false;
|
||||
//grid->find("title")->SetVisibility(false);
|
||||
animation->SetPositioning(YGPositionTypeRelative);
|
||||
animation->SetPosition(0, 0);
|
||||
|
||||
@@ -114,39 +114,42 @@ kEventResult NodePanelFloating::handle_event(Event* e)
|
||||
m_outline->SetPosition(m_parent->m_pos + m_drag_start_pos + me->m_pos - m_drag_start_cur);
|
||||
m_outline->SetSize(GetSize());
|
||||
|
||||
std::vector<std::shared_ptr<Node>> nodes;
|
||||
if (auto uir = root()->find("ui-root"))
|
||||
nodes = uir->get_children_at_point(me->m_pos);
|
||||
bool docked = false;
|
||||
for (auto const& c : nodes)
|
||||
if (m_droppable)
|
||||
{
|
||||
if (c->m_nodeID_s.find("drop") == 0)
|
||||
std::vector<std::shared_ptr<Node>> nodes;
|
||||
if (auto uir = root()->find("ui-root"))
|
||||
nodes = uir->get_children_at_point(me->m_pos);
|
||||
for (auto const& c : nodes)
|
||||
{
|
||||
m_outline->SetPosition(c->m_pos);
|
||||
m_outline->SetSize(c->m_size);
|
||||
m_drop_placeholder->remove_from_parent();
|
||||
int i = 0;
|
||||
float y = 0;
|
||||
for (; i < c->m_children.size(); i++)
|
||||
if (c->m_nodeID_s.find("drop") == 0)
|
||||
{
|
||||
if (c->m_children[i] == m_drop_placeholder)
|
||||
continue;
|
||||
float y = c->m_children[i]->m_pos.y - c->m_pos.y + c->m_children[i]->m_size.y / 2.f;
|
||||
float my = me->m_pos.y - c->m_pos.y;
|
||||
if (my <= y)
|
||||
break;
|
||||
m_outline->SetPosition(c->m_pos);
|
||||
m_outline->SetSize(c->m_size);
|
||||
m_drop_placeholder->remove_from_parent();
|
||||
int i = 0;
|
||||
float y = 0;
|
||||
for (; i < c->m_children.size(); i++)
|
||||
{
|
||||
if (c->m_children[i] == m_drop_placeholder)
|
||||
continue;
|
||||
float y = c->m_children[i]->m_pos.y - c->m_pos.y + c->m_children[i]->m_size.y / 2.f;
|
||||
float my = me->m_pos.y - c->m_pos.y;
|
||||
if (my <= y)
|
||||
break;
|
||||
}
|
||||
i = std::min(i, (int)c->m_children.size());
|
||||
if (/*m_parent != c.get() && */m_drop_placeholder->m_parent != c.get())
|
||||
{
|
||||
c->add_child(m_drop_placeholder, i);
|
||||
}
|
||||
else
|
||||
{
|
||||
c->move_child(m_drop_placeholder.get(), i);
|
||||
}
|
||||
docked = true;
|
||||
break;
|
||||
}
|
||||
i = std::min(i, (int)c->m_children.size());
|
||||
if (/*m_parent != c.get() && */m_drop_placeholder->m_parent != c.get())
|
||||
{
|
||||
c->add_child(m_drop_placeholder, i);
|
||||
}
|
||||
else
|
||||
{
|
||||
c->move_child(m_drop_placeholder.get(), i);
|
||||
}
|
||||
docked = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!docked && m_drop_placeholder->m_parent)
|
||||
@@ -183,29 +186,31 @@ kEventResult NodePanelFloating::handle_event(Event* e)
|
||||
m_drop_placeholder->destroy();
|
||||
m_drop_placeholder->remove_from_parent();
|
||||
}
|
||||
std::vector<std::shared_ptr<Node>> nodes;
|
||||
if (auto uir = root()->find("ui-root"))
|
||||
nodes = uir->get_children_at_point(me->m_pos);
|
||||
bool docked = false;
|
||||
auto ref = m_parent->m_children[m_parent->get_child_index(this)];
|
||||
for (auto const& c : nodes)
|
||||
if (m_droppable)
|
||||
{
|
||||
if (c->m_nodeID_s.find("drop") == 0)
|
||||
std::vector<std::shared_ptr<Node>> nodes;
|
||||
if (auto uir = root()->find("ui-root"))
|
||||
nodes = uir->get_children_at_point(me->m_pos);
|
||||
for (auto const& c : nodes)
|
||||
{
|
||||
SetPositioning(YGPositionTypeRelative);
|
||||
SetPosition(0, 0);
|
||||
if (m_dock.lock() != c)
|
||||
if (c->m_nodeID_s.find("drop") == 0)
|
||||
{
|
||||
SetWidth(350);
|
||||
c->add_child(ref, drop_pos);
|
||||
m_dock = c;
|
||||
SetPositioning(YGPositionTypeRelative);
|
||||
SetPosition(0, 0);
|
||||
if (m_dock.lock() != c)
|
||||
{
|
||||
SetWidth(350);
|
||||
c->add_child(shared_from_this(), drop_pos);
|
||||
m_dock = c;
|
||||
}
|
||||
else
|
||||
{
|
||||
c->move_child(this, std::min((int)c->m_children.size() - 1, drop_pos));
|
||||
}
|
||||
docked = true;
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
c->move_child(ref.get(), std::min((int)c->m_children.size() - 1, drop_pos));
|
||||
}
|
||||
docked = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!docked && !m_dock.expired())
|
||||
@@ -214,7 +219,7 @@ kEventResult NodePanelFloating::handle_event(Event* e)
|
||||
SetPositioning(YGPositionTypeAbsolute);
|
||||
auto newpos = glm::clamp(outline_pos - cont->m_pos, { 0, 0 }, cont->m_size - m_size);
|
||||
SetPosition(newpos);
|
||||
cont->add_child(ref);
|
||||
cont->add_child(shared_from_this());
|
||||
m_dock.reset();
|
||||
}
|
||||
m_outline = nullptr;
|
||||
|
||||
@@ -15,12 +15,15 @@ class NodePanelFloating : public NodeBorder
|
||||
NodeBorder* m_outline;
|
||||
std::shared_ptr<NodeBorder> m_drop_placeholder;
|
||||
public:
|
||||
Node* m_container;
|
||||
NodeText* m_title;
|
||||
std::weak_ptr<Node> m_dock;
|
||||
using this_class = NodePanelFloating;
|
||||
using parent = NodeBorder;
|
||||
enum class kClass : uint8_t { Presets, Color, ColorAdv, Layers, Brush, Grids, Animation, Generic } m_class = kClass::Generic;
|
||||
|
||||
Node* m_container;
|
||||
NodeText* m_title;
|
||||
std::weak_ptr<Node> m_dock;
|
||||
bool m_droppable = true;
|
||||
|
||||
virtual Node* clone_instantiate() const override;
|
||||
virtual void clone_finalize(Node* dest) const override;
|
||||
virtual kEventResult handle_event(Event* e) override;
|
||||
|
||||
Reference in New Issue
Block a user