diff options
| author | s-ol <s-ol@users.noreply.github.com> | 2019-11-13 12:02:35 +0000 |
|---|---|---|
| committer | s-ol <s-ol@users.noreply.github.com> | 2019-11-13 12:02:47 +0000 |
| commit | b651f4dbcbec7eccfcb90ea2b23e28d988e36026 (patch) | |
| tree | aea6d2ef5f3420bde3fc7fe5c0727d6bd85fb8b3 /examples/place_on_line.lua | |
| parent | add input.slider (diff) | |
| download | watch-cad-b651f4dbcbec7eccfcb90ea2b23e28d988e36026.tar.gz watch-cad-b651f4dbcbec7eccfcb90ea2b23e28d988e36026.zip | |
add line, arrow; hover events
Diffstat (limited to 'examples/place_on_line.lua')
| -rw-r--r-- | examples/place_on_line.lua | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/examples/place_on_line.lua b/examples/place_on_line.lua new file mode 100644 index 0000000..d58f713 --- /dev/null +++ b/examples/place_on_line.lua @@ -0,0 +1,17 @@ +-- return function (state) +function place_in_rect(S) + input.selection(S.objs, '^led-') + input.line(S.dest) + + local dest = S.dest() + local start = dest.frm + local step = (dest.to - dest.frm) / #S.objs() + start = start - step/2 + + for i, obj in ipairs(S.objs()) do + local pos = start + step * i + op.move(obj, pos) + end +end + +return place_in_rect |
