Hi!
Thanks Peter for having spotted the problem. I have fixed it somehow (“somehow” because
this is not an ideal solution, but good enough for now).
Try this after having updated Roassal:
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
| v lbls es e1 e2 a1 a2 layout stepping|
v := RTView new.
lbls := RTLabel new elementsOn: #(#First #Second).
es := RTEllipse new
size: 30;
borderColor: Color black;
elementsOn: #(#source #dest).
v
addAll: lbls;
addAll: es.
es @ RTDraggable.
es @ RTLabeled.
e1 := RTArrowedLine new
withContinuousCircleAttachPoint;
color: Color black;
edgeFrom: es first to: es second.
v add: e1.
e2 := RTArrowedLine new
withContinuousCircleAttachPoint;
color: Color black;
edgeFrom: es second to: es first.
v add: e2.
a1 := RTAnchorConstraint new.
a1 anchorShape size: 10.
a1 guideLine color: Color red.
a1
element: lbls first;
edge: e1;
balance: 0.2;
minDistance: 10;
build.
(a2 := RTAnchorConstraint new)
element: lbls second;
edge: e2;
balance: 0.2;
minDistance: 10;
build.
layout := RTForceBasedLayout new
charge: -450; length: 100;
doNotUseProgressBar; applyOn: es; yourself.
layout initialLayout: RTSugiyamaLayout new.
layout nodes: es.
layout start: es.
layout edges: { e1 . e2 }.
stepping := RTSpringLayoutStepping new
view: v; layoutWithoutPreparing: layout;
afterBlock: [ v canvas camera
focusOnCenter].
v addAnimation: stepping.
^ v
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Here is a screenshot:
And this is all animated. Cool stuff!
Alexandre
--
_,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
Alexandre Bergel
^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
On Mar 10, 2016, at 12:42 PM, Peter Uhnák
<i.uhnak(a)gmail.com> wrote:
To which problem?
The problem is that RTSpringLayoutStepping always uses all the elements in the view and
ignores what you set to the layout.
This is a problem, because it will try to also layout the anchor, but that will trigger
the anchor to fix itself… and we get endless spinning.
On Thu, Mar 10, 2016 at 4:21 PM, Johan Fabry <jfabry(a)dcc.uchile.cl
<mailto:jfabry@dcc.uchile.cl>> wrote:
On Mar 10, 2016, at 12:08, Alexandre Bergel
<alexandre.bergel(a)me.com <mailto:alexandre.bergel@me.com>> wrote:
There is no other solution? Alex, do you have any idea?
To which problem?
Copy-paste from original mail:
anchor constraints: they do not play well with layouts and animations. Try the code below
(adapted from the example to use the layout and animation of LRP ) and you will see that
the circles keep spinning around, they never stop. I think it would be better for them to
stop ;-)
| v lbls es e1 e2 a1 a2 layout stepping|
v := RTView new.
lbls := RTLabel new elementsOn: #(#First #Second).
es := RTEllipse new
size: 30;
borderColor: Color black;
elementsOn: #(#source #dest).
v
addAll: lbls;
addAll: es.
es @ RTDraggable.
es @ RTLabeled.
e1 := RTArrowedLine new
withContinuousCircleAttachPoint;
color: Color black;
edgeFrom: es first to: es second.
v add: e1.
e2 := RTArrowedLine new
withContinuousCircleAttachPoint;
color: Color black;
edgeFrom: es second to: es first.
v add: e2.
a1 := RTAnchorConstraint new.
a1 anchorShape size: 10.
a1 guideLine color: Color red.
a1
element: lbls first;
edge: e1;
balance: 0.2;
minDistance: 10;
build.
(a2 := RTAnchorConstraint new)
element: lbls second;
edge: e2;
balance: 0.2;
minDistance: 10;
build.
layout := RTForceBasedLayout new
charge: -450; length: 100;
doNotUseProgressBar; applyOn: es; yourself.
layout initialLayout: RTSugiyamaLayout new.
stepping := RTSpringLayoutStepping new
view: v; layout: layout;
afterBlock: [ v canvas camera
focusOnCenter].
v addAnimation: stepping.
^ v
---> Save our in-boxes!
http://emailcharter.org <http://emailcharter.org/>
<---
Johan Fabry -
http://pleiad.cl/~jfabry <http://pleiad.cl/~jfabry>
PLEIAD and RyCh labs - Computer Science Department (DCC) - University of Chile
_______________________________________________
Moose-dev mailing list
Moose-dev(a)list.inf.unibe.ch <mailto:Moose-dev@list.inf.unibe.ch>
https://www.list.inf.unibe.ch/listinfo/moose-dev
<https://www.list.inf.unibe.ch/listinfo/moose-dev>