2 $svg = null #jquery object for svg element
10 if selected.length > 0
11 last = selected[selected.length - 1]
12 obj = document.createElementNS("http://www.w3.org/2000/svg", "path")
13 obj.setAttributeNS(null, "d", "M #{last[0]} #{last[1]} L #{x} #{y}")
14 $svg[0].appendChild(obj)
18 # called automatically on domcontentloaded
20 $container = $ '.crayon_mockup'
21 $stop_button = $ '<div class="button">[end current polyline]</div>'
22 $tools = $ '<div class="toolbar"></div>'
23 $tools.append $stop_button
24 $stop_button.click stop_drawing
25 $container.append $tools
26 $svg = $ '<svg height="500" width="500" viewBox="0 0 500 500" style="border: 1px dotted #aaa" xmlns="http://www.w3.org/2000/svg"></svg>'
27 #$test_path = $ '<line id="line" x1="5" y1="50" x2="105" y2="150" style="stroke: rgb(0,127,127); stroke-width: 5;"></line>'
28 #$svg.append $test_path
29 $container.append $svg
33 offset = $svg.offset()
34 click e.pageX - offset.left, e.pageY - offset.top