aboutsummaryrefslogtreecommitdiffstats
path: root/library/place_on_line.lua
blob: f89a8310200c09c74382fc839d2fb2d770cae03b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
function place_on_line(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