ObjectProfile / Roassal3

The Roassal Visualization Engine
MIT License
95 stars 52 forks source link

#markerMid: on RSLine not working #609

Closed NicolasAnquetil closed 8 months ago

NicolasAnquetil commented 8 months ago

script example:

    | c b1 b2 e1 |
    c := RSCanvas new.

    b1 := RSBox new size: 10 ; color: Color red.
    b1 position: 20@20.

    b2 := RSBox new size: 10; color: Color green.
    b2 position: 50@0.

    b1 draggable.
    b2 draggable.

    e1 := RSLine new from: b1; to: b2.
    e1 markerMid: (RSCircle new size: 5 ; color: Color yellow).

    c addAll: { b1. b2. e1 }.

    c @ RSCanvasController new noLegend.

    ^ c

No yellow circle in the middle of the line :-(

akevalion commented 8 months ago

Hi Nicolas,

Marker mid only works for lines with more than 2 control points. RSLine only has 2 control points then you should use a RSPolyline

    | c b1 b2 e1 |
    c := RSCanvas new.

    b1 := RSBox new size: 10 ; color: Color red.
    b1 position: 20@20.

    b2 := RSBox new size: 10; color: Color green.
    b2 position: 50@0.

    b1 draggable.
    b2 draggable.

    e1 := RSPolyline  new 
        from: b1; to: b2.
    e1 controlPointsController: (RSBlockCPController new block: [:edge | | a b |
        a := edge from position.
        b := edge to position.
        {a.
        a + b / 2.
        b }. ]).
    e1 markerMid: (RSCircle new size: 5 ; color: Color yellow).

    c addAll: { b1. b2. e1 }.

    c @ RSCanvasController new noLegend.

    ^ c
NicolasAnquetil commented 8 months ago

ha, ok thanks for letting me know. But:

thanks