It would be great to have a singleton pattern for the attach point

Alexandre

Le 25-04-2014 à 9:57, Ricardo Jacas <ricardo.jacas@gmail.com> a écrit :

The solution is a little verbose, but it does what you need :).
Please update Roassal 2, since I just found a bug there.

| view elements e1 e2 |
view := RTView new.
elements :=  ((RTEllipse new size: 30; color: Color white))
                        elementsOn: #(one two).
view addAll: elements.
elements @ RTDraggable.
RTCircleLayout new initialRadius: 70; on: elements.

e1 := RTEdge from: elements first to: elements second.
e1 + (RTDirectedLine new color: Color black; attachPoint: RTShorterDistanceAttachPoint new) + (RTArrow new color: Color black; attachPoint: RTShorterDistanceAttachPoint new) @ (RTLabelled new text: '12'; view: view).
view add: e1.
e2 := RTEdge from: elements second to: elements first.
e2 + (RTDirectedLine new color: Color black; attachPoint: RTShorterDistanceAttachPoint new) + (RTArrow new color: Color black; attachPoint: RTShorterDistanceAttachPoint new) @ (RTLabelled new text: '21'; view: view).
view add: e2.
view open.


2014-04-25 9:49 GMT-03:00 Johan Fabry <jfabry@dcc.uchile.cl>:

Thanks Alex. But how about the RTDirectedLine that Ricardo mentioned ?? Will he be able to fix my mockup code with that?

On Apr 25, 2014, at 9:42 AM, Alexandre Bergel <alexandre.bergel@me.com> wrote:

> Hi Johan,
>
>> First question: how can I make the arrows go to the border of the ellipse, instead of the center?
>
> Attachpoint is your friend.
>
> -=-=-=-=-=-=-=-=-=
> | v e1 e2 l shape |
> v := RTView new.
>
> e1 := ((RTEllipse new size: 20) + RTLabel) elementOn: 'one'.
> e2 := ((RTEllipse new size: 20) + RTLabel) elementOn: 'two'.
>
> e1 @ RTDraggable.
> e2 @ RTDraggable.
>
> e2 translateTo: 60 @ 40.
>
> shape := RTLine new color: Color red.
> shape attachPoint: (RTShorterDistanceAttachPoint new).
> l := shape edgeFrom: e1 to: e2.
>
> v add: e1; add: e2; add: l.
> -=-=-=-=-=-=-=-=-=
> <Screen Shot 2014-04-25 at 9.39.53 AM.png>
>
>> Second question: as a human I would draw each of the two arrows with a curve: one curving up and one curving down so that they (and their labels) do not overlap. Can I do something like this in Roassal? Because now readability is far from optimal.
>
> We have no solution for now.
> Probably we need a new shape, something like RTDistinctLine that gives a variation when necessary.
> We can work on this, but not right now… You can also give a try if you wish.
>
> Alexandre
>
>
>>
>>
>> ---> Save our in-boxes! http://emailcharter.org <---
>>
>> Johan Fabry   -   http://pleiad.cl/~jfabry
>> PLEIAD lab  -  Computer Science Department (DCC)  -  University of Chile
>>
>> _______________________________________________
>> Moose-dev mailing list
>> Moose-dev@iam.unibe.ch
>> https://www.iam.unibe.ch/mailman/listinfo/moose-dev
>
> --
> _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
> Alexandre Bergel  http://www.bergel.eu
> ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
>
>
>
> _______________________________________________
> Moose-dev mailing list
> Moose-dev@iam.unibe.ch
> https://www.iam.unibe.ch/mailman/listinfo/moose-dev



---> Save our in-boxes! http://emailcharter.org <---

Johan Fabry   -   http://pleiad.cl/~jfabry
PLEIAD lab  -  Computer Science Department (DCC)  -  University of Chile


_______________________________________________
Moose-dev mailing list
Moose-dev@iam.unibe.ch
https://www.iam.unibe.ch/mailman/listinfo/moose-dev



--
lets reign all together
_______________________________________________
Moose-dev mailing list
Moose-dev@iam.unibe.ch
https://www.iam.unibe.ch/mailman/listinfo/moose-dev