fix docking panels size

This commit is contained in:
2019-04-06 00:34:49 +02:00
parent 9aaaaef705
commit 1bb9b5dec5
3 changed files with 41 additions and 11 deletions

View File

@@ -21,7 +21,7 @@
<slider-h id="opacity" value="1" grow="1" width="1" margin="0 5 0 0"/> <slider-h id="opacity" value="1" grow="1" width="1" margin="0 5 0 0"/>
</border> </border>
<scroll id="layers-container" pad="5" color=".4" dir="col" flood-events="1"> <scroll id="layers-container" pad="5" color=".4" dir="col" flood-events="1" grow="1">
<!--layers list--> <!--layers list-->
</scroll> </scroll>
@@ -666,7 +666,7 @@
</node> </node>
</node> </node>
<scroll id="scroller" color=".4" scroll-color=".2"> <scroll id="scroller" color=".4" scroll-color=".2" grow="1">
<node dir="row"> <node dir="row">
<node width="36%" dir="col"> <node width="36%" dir="col">
<node height="20" justify="center"> <node height="20" justify="center">
@@ -1736,7 +1736,7 @@ Here's a list of what's available in this release.
</node> </node>
</border> </border>
<border id="drop-left" color="0 0 0 .6" min-width="10" mouse-capture="true"/> <scroll id="drop-left" color="0 0 0 .6" min-width="10" mouse-capture="true"/>
<!--quick bar--> <!--quick bar-->
<node justify="center" align="center" dir="col"> <node justify="center" align="center" dir="col">
@@ -1746,7 +1746,7 @@ Here's a list of what's available in this release.
<node id="floatings" color="0 0 0 1" width="1" grow="1" height="100%"/> <node id="floatings" color="0 0 0 1" width="1" grow="1" height="100%"/>
<border id="drop-right" color="0 0 0 .6" min-width="10" mouse-capture="true"/> <scroll id="drop-right" color="0 0 0 .6" min-width="10" mouse-capture="true"/>
<!-- timeline --> <!-- timeline -->
<!-- <!--

View File

@@ -231,6 +231,11 @@ void App::init_sidebar()
button->on_click = [this, button](Node*) { button->on_click = [this, button](Node*) {
auto screen = layout[main_id]->m_size; auto screen = layout[main_id]->m_size;
glm::vec2 pos = button->m_pos + glm::vec2(button->m_size.x * 0.5f, button->m_size.y); glm::vec2 pos = button->m_pos + glm::vec2(button->m_size.x * 0.5f, button->m_size.y);
if (stroke->m_parent)
{
if (auto fp = dynamic_cast<NodePanelFloating*>(stroke->m_parent->m_parent))
fp->destroy();
}
layout[main_id]->add_child(stroke); layout[main_id]->add_child(stroke);
auto tick = layout[main_id]->add_child<NodeImage>(); auto tick = layout[main_id]->add_child<NodeImage>();
tick->SetPositioning(YGPositionTypeAbsolute); tick->SetPositioning(YGPositionTypeAbsolute);
@@ -300,6 +305,12 @@ void App::init_sidebar()
button->on_click = [this, button](Node*) { button->on_click = [this, button](Node*) {
auto screen = layout[main_id]->m_size; auto screen = layout[main_id]->m_size;
glm::vec2 pos = button->m_pos + glm::vec2(button->m_size.x * 0.5f, button->m_size.y); glm::vec2 pos = button->m_pos + glm::vec2(button->m_size.x * 0.5f, button->m_size.y);
layers->SetSize(350, YGUndefined);
if (layers->m_parent)
{
if (auto fp = dynamic_cast<NodePanelFloating*>(layers->m_parent->m_parent))
fp->destroy();
}
layout[main_id]->add_child(layers); layout[main_id]->add_child(layers);
auto tick = layout[main_id]->add_child<NodeImage>(); auto tick = layout[main_id]->add_child<NodeImage>();
tick->SetPositioning(YGPositionTypeAbsolute); tick->SetPositioning(YGPositionTypeAbsolute);
@@ -327,6 +338,12 @@ void App::init_sidebar()
button->on_click = [this, button](Node*) { button->on_click = [this, button](Node*) {
auto screen = layout[main_id]->m_size; auto screen = layout[main_id]->m_size;
glm::vec2 pos = button->m_pos + glm::vec2(button->m_size.x * 0.5f, button->m_size.y); glm::vec2 pos = button->m_pos + glm::vec2(button->m_size.x * 0.5f, button->m_size.y);
grid->SetSize(350, YGUndefined);
if (grid->m_parent)
{
if (auto fp = dynamic_cast<NodePanelFloating*>(grid->m_parent->m_parent))
fp->destroy();
}
layout[main_id]->add_child(grid); layout[main_id]->add_child(grid);
auto tick = layout[main_id]->add_child<NodeImage>(); auto tick = layout[main_id]->add_child<NodeImage>();
tick->SetPositioning(YGPositionTypeAbsolute); tick->SetPositioning(YGPositionTypeAbsolute);
@@ -816,12 +833,13 @@ void App::init_menu_experimental()
if (visible(floating_picker.get())) if (visible(floating_picker.get()))
return; return;
auto fpanel = floatings_container->add_child<NodePanelFloating>(); auto fpanel = floatings_container->add_child<NodePanelFloating>();
fpanel->SetHeight(300); fpanel->SetHeight(YGUndefined);
fpanel->SetWidth(300);
if (!floating_picker) if (!floating_picker)
{ {
floating_picker = fpanel->m_container->add_child_ref<NodeColorPicker>(); floating_picker = fpanel->m_container->add_child_ref<NodeColorPicker>();
//floating_picker->SetHeightP(100); //floating_picker->SetHeightP(100);
floating_picker->SetWidth(250); //floating_picker->SetWidth(250);
floating_picker->m_autohide = false; floating_picker->m_autohide = false;
floating_picker->on_color_change = [this](Node* target, glm::vec3 color) { floating_picker->on_color_change = [this](Node* target, glm::vec3 color) {
Canvas::I->m_current_brush->m_tip_color = glm::vec4(color, 1.f); Canvas::I->m_current_brush->m_tip_color = glm::vec4(color, 1.f);
@@ -851,7 +869,13 @@ void App::init_menu_experimental()
if (visible(layers.get())) if (visible(layers.get()))
return; return;
auto fpanel = floatings_container->add_child<NodePanelFloating>(); auto fpanel = floatings_container->add_child<NodePanelFloating>();
fpanel->SetMinHeight(100);
fpanel->m_container->add_child(layers); fpanel->m_container->add_child(layers);
layers->SetPositioning(YGPositionTypeRelative);
layers->SetPosition(0, 0);
layers->SetWidthP(100);
layers->SetHeightP(100);
layers->SetFlexShrink(0);
popup_time->destroy(); popup_time->destroy();
popup_exp->destroy(); popup_exp->destroy();
@@ -861,7 +885,9 @@ void App::init_menu_experimental()
return; return;
auto fpanel = floatings_container->add_child<NodePanelFloating>(); auto fpanel = floatings_container->add_child<NodePanelFloating>();
fpanel->m_container->add_child(stroke); fpanel->m_container->add_child(stroke);
stroke->SetPositioning(YGPositionTypeRelative);
stroke->SetPosition(0, 0);
popup_time->destroy(); popup_time->destroy();
popup_exp->destroy(); popup_exp->destroy();
}; };
@@ -870,7 +896,11 @@ void App::init_menu_experimental()
return; return;
auto fpanel = floatings_container->add_child<NodePanelFloating>(); auto fpanel = floatings_container->add_child<NodePanelFloating>();
fpanel->m_container->add_child(grid); fpanel->m_container->add_child(grid);
grid->SetPositioning(YGPositionTypeRelative);
grid->SetPosition(0, 0);
grid->SetWidthP(100);
grid->SetHeightP(100);
popup_time->destroy(); popup_time->destroy();
popup_exp->destroy(); popup_exp->destroy();
}; };

View File

@@ -62,7 +62,7 @@ kEventResult NodePanelFloating::handle_event(Event* e)
m_dragging = true; m_dragging = true;
if (me->m_pos.y - m_pos.y > m_size.y - 20.f) if (me->m_pos.y - m_pos.y > m_size.y - 20.f)
{ {
if (me->m_pos.x - m_pos.x > m_size.x - 20.f) if (m_dock.expired() && me->m_pos.x - m_pos.x > m_size.x - 20.f)
{ {
m_action = kDragAction::Resize; m_action = kDragAction::Resize;
} }
@@ -83,7 +83,7 @@ kEventResult NodePanelFloating::handle_event(Event* e)
m_outline->m_color = { 0, 0, 0, 0.1 }; m_outline->m_color = { 0, 0, 0, 0.1 };
m_outline->m_thinkness = 1; m_outline->m_thinkness = 1;
m_drop_placeholder = std::make_shared<NodeBorder>(); m_drop_placeholder = std::make_shared<NodeBorder>();
m_drop_placeholder->SetSize(300, 10); m_drop_placeholder->SetSize(350, 10);
m_drop_placeholder->m_color = { 0, 0, 0, 0.1 }; m_drop_placeholder->m_color = { 0, 0, 0, 0.1 };
m_drop_placeholder->m_thinkness = 1; m_drop_placeholder->m_thinkness = 1;
} }
@@ -178,7 +178,7 @@ kEventResult NodePanelFloating::handle_event(Event* e)
SetPosition(0, 0); SetPosition(0, 0);
if (m_dock.lock() != c) if (m_dock.lock() != c)
{ {
SetWidth(300); SetWidth(350);
c->add_child(ref, drop_pos); c->add_child(ref, drop_pos);
m_dock = c; m_dock = c;
} }