#markerMid: on RSLine not working
NicolasAnquetil opened this issue · 2 comments
NicolasAnquetil commented
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
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
ha, ok
thanks for letting me know.
But:
- if it only works for RSPolyline, it should not be available for RSLine
- why does one have to specify all the
... controlPointsController: (RSBlockCPController ...
black magic?
It should be hidden in the RSPolyline and/or #markerMid behavior
thanks