fix floating drop
This commit is contained in:
10
src/node.cpp
10
src/node.cpp
@@ -607,6 +607,9 @@ bool Node::is_child(Node* o) const
|
|||||||
|
|
||||||
void Node::mouse_capture()
|
void Node::mouse_capture()
|
||||||
{
|
{
|
||||||
|
if (!m_parent || !m_manager)
|
||||||
|
return;
|
||||||
|
|
||||||
auto root = m_manager->get_ref("main");
|
auto root = m_manager->get_ref("main");
|
||||||
if (!root) return;
|
if (!root) return;
|
||||||
|
|
||||||
@@ -649,7 +652,7 @@ void Node::mouse_capture()
|
|||||||
|
|
||||||
void Node::mouse_release()
|
void Node::mouse_release()
|
||||||
{
|
{
|
||||||
if (!m_parent)
|
if (!m_parent || !m_manager)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
auto root = m_manager->get_ref("main");
|
auto root = m_manager->get_ref("main");
|
||||||
@@ -678,7 +681,7 @@ void Node::mouse_release()
|
|||||||
|
|
||||||
void Node::key_capture()
|
void Node::key_capture()
|
||||||
{
|
{
|
||||||
if (!m_parent)
|
if (!m_parent || !m_manager)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
auto root = m_manager->get_ref("main");
|
auto root = m_manager->get_ref("main");
|
||||||
@@ -690,6 +693,9 @@ void Node::key_capture()
|
|||||||
|
|
||||||
void Node::key_release()
|
void Node::key_release()
|
||||||
{
|
{
|
||||||
|
if (!m_parent || !m_manager)
|
||||||
|
return;
|
||||||
|
|
||||||
auto root = m_manager->get_ref("main");
|
auto root = m_manager->get_ref("main");
|
||||||
if (!root) return;
|
if (!root) return;
|
||||||
|
|
||||||
|
|||||||
@@ -167,8 +167,12 @@ kEventResult NodePanelFloating::handle_event(Event* e)
|
|||||||
m_dragging = false;
|
m_dragging = false;
|
||||||
if (m_action == kDragAction::Move)
|
if (m_action == kDragAction::Move)
|
||||||
{
|
{
|
||||||
|
glm::vec2 outline_pos(0);
|
||||||
if (m_outline)
|
if (m_outline)
|
||||||
|
{
|
||||||
|
outline_pos = m_outline->m_pos;
|
||||||
m_outline->destroy();
|
m_outline->destroy();
|
||||||
|
}
|
||||||
int drop_pos = 0;
|
int drop_pos = 0;
|
||||||
if (m_drop_placeholder)
|
if (m_drop_placeholder)
|
||||||
{
|
{
|
||||||
@@ -204,7 +208,7 @@ kEventResult NodePanelFloating::handle_event(Event* e)
|
|||||||
{
|
{
|
||||||
auto cont = root()->find("floatings");
|
auto cont = root()->find("floatings");
|
||||||
SetPositioning(YGPositionTypeAbsolute);
|
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);
|
SetPosition(newpos);
|
||||||
cont->add_child(ref);
|
cont->add_child(ref);
|
||||||
m_dock.reset();
|
m_dock.reset();
|
||||||
|
|||||||
Reference in New Issue
Block a user