fix floating drop

This commit is contained in:
2019-09-26 21:47:24 +02:00
parent 755e1ff856
commit fb25178416
2 changed files with 13 additions and 3 deletions

View File

@@ -607,6 +607,9 @@ bool Node::is_child(Node* o) const
void Node::mouse_capture()
{
if (!m_parent || !m_manager)
return;
auto root = m_manager->get_ref("main");
if (!root) return;
@@ -649,7 +652,7 @@ void Node::mouse_capture()
void Node::mouse_release()
{
if (!m_parent)
if (!m_parent || !m_manager)
return;
auto root = m_manager->get_ref("main");
@@ -678,7 +681,7 @@ void Node::mouse_release()
void Node::key_capture()
{
if (!m_parent)
if (!m_parent || !m_manager)
return;
auto root = m_manager->get_ref("main");
@@ -690,6 +693,9 @@ void Node::key_capture()
void Node::key_release()
{
if (!m_parent || !m_manager)
return;
auto root = m_manager->get_ref("main");
if (!root) return;

View File

@@ -167,8 +167,12 @@ kEventResult NodePanelFloating::handle_event(Event* e)
m_dragging = false;
if (m_action == kDragAction::Move)
{
glm::vec2 outline_pos(0);
if (m_outline)
{
outline_pos = m_outline->m_pos;
m_outline->destroy();
}
int drop_pos = 0;
if (m_drop_placeholder)
{
@@ -204,7 +208,7 @@ kEventResult NodePanelFloating::handle_event(Event* e)
{
auto cont = root()->find("floatings");
SetPositioning(YGPositionTypeAbsolute);
auto newpos = glm::clamp(m_outline->m_pos - cont->m_pos, { 0, 0 }, cont->m_size - m_size);
auto newpos = glm::clamp(outline_pos - cont->m_pos, { 0, 0 }, cont->m_size - m_size);
SetPosition(newpos);
cont->add_child(ref);
m_dock.reset();