Status: New Owner: ---- Labels: Type-Defect Priority-Medium
New issue 904 by benjamin...@gmail.com: Roassal dragging subtrees (feature contribution) http://code.google.com/p/moose-technology/issues/detail?id=904
With a tree layout, when dragging an element I needed to drag all the children at the same time. I knocked up a solution sufficient to my needs in about 40 minutes - see attached changeset. I might be a nice general feature to add to Roassal but its a bit rough. It will likely need some critical love to polish it before integration. Later it might be made to work with ROSelection and multi-selected elements - but that is out of my scope for the moment.
Attachments: RODraggableWithOthers.2.cs 1.3 KB
Updates: Status: Fixed
Comment #1 on issue 904 by alexandr...@gmail.com: Roassal dragging subtrees (feature contribution) http://code.google.com/p/moose-technology/issues/detail?id=904
Hi Ben,
Thanks for your suggestion. I wrote a contribution inspired from your example.
Fixed in 1.457 of Roassal. Try this:
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= | view elements | view := ROView new.
0 to: 50 by: 10 do: [ :i | elements := (ROBox green size: 10) elementsOn: (i to: i + 9). elements do: [ :e | e @ RODraggable @ ROPopup ]. view addAll: elements.
ROLine buildEdgesFromElement: elements first from: #yourself toAll: [ :v | (v + 1 to: v + 9) ].
ROTreeLayout on: elements. (view elementFromModel: i) - ROBox + ROBox red. (view elementFromModel: i) @ ROAllConnectedNodeDraggable ; translateBy: i * 15 @ 10. ].
view open -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
A cursory review of the code seems like it would only work for one layer. How would ROAllConnectedNodeDraggable work with the three layers of the following example[1]? For my project I came up with an alternative implementation 'LEKDraggableSubtree.' I'd be interested in what you think of the attached mcz.
cheers -ben
[1]------------------------------- | view toElement fromElement draggableCase | draggableCase := RODraggable. "draggableCase := ROAllConnectedNodeDraggable " "draggableCase := LEKDraggableSubtree withEdges: [ :selectedElement | selectedElement view onlyEdges ] . " view := ROView new. 1 to: 7 do: [ :n | toElement := ((ROLabel elementOn: n) extent: 50@50 ) + ROBorder @ draggableCase. view add: toElement. ((fromElement := view elementFromModel: n // 2) ) ifNotNil: [ view add: (ROEdge from: fromElement to: toElement ) + ROLine ] ]. ROHorizontalTreeLayout new on: view elements. view open. -------------------------------
moose-technology@googlecode.com wrote:
Updates: Status: Fixed
Comment #1 on issue 904 by alexandr...@gmail.com: Roassal dragging subtrees (feature contribution) http://code.google.com/p/moose-technology/issues/detail?id=904
Hi Ben,
Thanks for your suggestion. I wrote a contribution inspired from your example.
Fixed in 1.457 of Roassal. Try this:
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= | view elements | view := ROView new.
0 to: 50 by: 10 do: [ :i | elements := (ROBox green size: 10) elementsOn: (i to: i + 9). elements do: [ :e | e @ RODraggable @ ROPopup ]. view addAll: elements.
ROLine buildEdgesFromElement: elements first from: #yourself
toAll: [ :v | (v + 1 to: v + 9) ].
ROTreeLayout on: elements. (view elementFromModel: i) - ROBox + ROBox red. (view elementFromModel: i) @ ROAllConnectedNodeDraggable ; translateBy: i * 15 @ 10.
].
view open
Hi!
Good point. I have added a new interaction class: ROAllRecursivelyConnectedNodeDraggable Try the following example -=-=-=-=-=-=-=-=-=-=-=-= | view toElement fromElement draggableCase | draggableCase := RODraggable. "draggableCase := ROAllConnectedNodeDraggable " "draggableCase := LEKDraggableSubtree withEdges: [ :selectedElement | selectedElement view onlyEdges ] . " view := ROView new. 1 to: 7 do: [ :n | toElement := ((ROLabel elementOn: n) extent: 50@50 ) + ROBorder @ draggableCase. view add: toElement. ((fromElement := view elementFromModel: n // 2) ) ifNotNil: [ view add: (ROEdge from: fromElement to: toElement ) + ROLine ] ]. ROHorizontalTreeLayout new on: view elements.
view elements first @ ROAllRecursivelyConnectedNodeDraggable. view elements first - ROBorder + ROBorder red. view open. -=-=-=-=-=-=-=-=-=-=-=-=
Your .mcz file goes in the right direction. However I have found a simpler solution I think, which also handle cycles. Let me know whether this new version helps.
Cheers, Alexandre
On Oct 21, 2013, at 4:20 PM, Ben Coman btc@openInWorld.com wrote:
A cursory review of the code seems like it would only work for one layer. How would ROAllConnectedNodeDraggable work with the three layers of the following example[1]? For my project I came up with an alternative implementation 'LEKDraggableSubtree.' I'd be interested in what you think of the attached mcz.
cheers -ben
[1]------------------------------- | view toElement fromElement draggableCase | draggableCase := RODraggable. "draggableCase := ROAllConnectedNodeDraggable " "draggableCase := LEKDraggableSubtree withEdges: [ :selectedElement | selectedElement view onlyEdges ] . " view := ROView new. 1 to: 7 do: [ :n | toElement := ((ROLabel elementOn: n) extent: 50@50 ) + ROBorder @ draggableCase. view add: toElement. ((fromElement := view elementFromModel: n // 2) ) ifNotNil: [ view add: (ROEdge from: fromElement to: toElement ) + ROLine ] ]. ROHorizontalTreeLayout new on: view elements. view open.
moose-technology@googlecode.com wrote:
Updates: Status: Fixed
Comment #1 on issue 904 by alexandr...@gmail.com: Roassal dragging subtrees (feature contribution) http://code.google.com/p/moose-technology/issues/detail?id=904
Hi Ben,
Thanks for your suggestion. I wrote a contribution inspired from your example.
Fixed in 1.457 of Roassal. Try this:
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= | view elements | view := ROView new.
0 to: 50 by: 10 do: [ :i | elements := (ROBox green size: 10) elementsOn: (i to: i + 9). elements do: [ :e | e @ RODraggable @ ROPopup ]. view addAll: elements.
ROLine buildEdgesFromElement: elements first from: #yourself toAll: [ :v | (v + 1 to: v + 9) ].
ROTreeLayout on: elements. (view elementFromModel: i) - ROBox + ROBox red. (view elementFromModel: i) @ ROAllConnectedNodeDraggable ; translateBy: i * 15 @ 10. ].
view open
<BTCRoassalExtension-BenComan.1.mcz>_______________________________________________ Moose-dev mailing list Moose-dev@iam.unibe.ch https://www.iam.unibe.ch/mailman/listinfo/moose-dev