Drag'n'drop item to end of an SvTreeListBox

Brian Fraser brian at softfrog.ca
Wed Oct 10 04:02:09 UTC 2018


Hello,

I'm working on drag'n'drop support for reordering animations in Impress
(the CustomAnimationList UI element, which inherits from SvTreeListBox). I
need to support dragging an effect to below the last effect in the list in
order to move it to the end of the list.

I'm overriding the NotifyMoving(...) function to get notifications of when
an effect has moved. It tells me which effect was dragged, and over top of
which effect it was dropped. I can then move the effect above the target in
the tree to reorder it. However, this does not support dragging 'n dropping
the effect to the end of the list, as dropping it past the last effect has
NotifyMoving() tell me it's target is the last element in the list (and
hence goes above it).

Is there a good way to resolve this?

I have a couple ideas which I would welcome comments on:
1. Create a blank 'fake' entry at the end of the list when dragging starts.
If NotifyMoving() tells me it's target is the fake, I know to put it at the
end (and remove the fake when done).

2. If an effect is being dragged 'up' the list, put it above the target; if
it's being dragged 'down' the list, put it after the target. This might be
confusing to the user as the above/below behaviour would be context
specific. This might be less jarring if I were to also incorporate an
animation effect on the UI to show where the moving effect will appear.
(Suggestions on this are also of interest!)

Thank you for your ideas!
Brian.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/libreoffice/attachments/20181009/fdd038bb/attachment.html>


More information about the LibreOffice mailing list