mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-10 04:22:20 +02:00
Added "inside" dragging to listview
This commit is contained in:
parent
1f6fcfd6b2
commit
227b5f4982
2 changed files with 40 additions and 10 deletions
|
@ -655,6 +655,11 @@ namespace Beefy.theme.dark
|
|||
}
|
||||
else
|
||||
{
|
||||
var darkListView = (DarkListView)mListView;
|
||||
|
||||
if (mDragTarget.mParentItem != mListView.GetRoot())
|
||||
targetX += darkListView.mLabelX - darkListView.mChildIndent;
|
||||
|
||||
if ((mDragKind == .Inside) || (mDragKind == .After)) // Inside or after
|
||||
targetY += mDragTarget.mSelfHeight;
|
||||
|
||||
|
@ -805,16 +810,27 @@ namespace Beefy.theme.dark
|
|||
float childX;
|
||||
float childY;
|
||||
foundWidget.SelfToRootTranslate(0, 0, out childX, out childY);
|
||||
|
||||
float yOfs = aY - childY;
|
||||
if (yOfs < mHeight / 2)
|
||||
mDragKind = .Before;
|
||||
else
|
||||
{
|
||||
mDragKind = .After;
|
||||
if ((listViewItem.mOpenButton != null) && (listViewItem.mOpenButton.mIsOpen))
|
||||
mDragKind = .None;
|
||||
}
|
||||
|
||||
if ((listViewItem.mOpenButton != null) && (aX - childX < GS!(30)))
|
||||
{
|
||||
mDragKind = .Inside;
|
||||
}
|
||||
else
|
||||
{
|
||||
float yOfs = aY - childY;
|
||||
if (yOfs < mHeight / 2)
|
||||
mDragKind = .Before;
|
||||
else
|
||||
{
|
||||
mDragKind = .After;
|
||||
if ((listViewItem.mOpenButton != null) && (!listViewItem.mChildItems.IsEmpty) && (listViewItem.mOpenButton.mIsOpen))
|
||||
{
|
||||
var firstChild = listViewItem.mChildItems[0];
|
||||
foundWidget = firstChild;
|
||||
mDragKind = .Before;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (Math.Abs(dY) < mSelfHeight * 0.21f)
|
||||
{
|
||||
|
|
|
@ -1984,6 +1984,20 @@ namespace IDE.ui
|
|||
return;
|
||||
if (dragSource.mLabel == "")
|
||||
return;
|
||||
|
||||
if (dragKind == .Inside)
|
||||
{
|
||||
dragSource.SelfToRootTranslate(evt.mX, evt.mY, var rootX, var rootY);
|
||||
dragTarget.RootToSelfTranslate(rootX, rootY, var targetX, var targetY);
|
||||
|
||||
//dragSource.SelfToOtherTranslate(dragTarget, evt.mX, evt.mY, var targetX, var targetY);
|
||||
|
||||
if (targetY < dragTarget.mSelfHeight / 2)
|
||||
dragKind = .Before;
|
||||
else
|
||||
dragKind = .After;
|
||||
}
|
||||
|
||||
while (dragTarget.mParentItem != mListView.GetRoot())
|
||||
{
|
||||
// Check for if we're dragging after the last open child item. If so, treat it as if we're dragging to after the topmost parent
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue