Warning: This package is experimental and buggy.
The purpose of this package is to allow the construction of clickable and movable SVG objects inside a WebIO Scope, with the position of each object accesssible through observables in Julia.Install WebIO and JSExpr. Then run
Pkg.clone("https://github.com/lancebeet/CanvasWebIO.jl")
in the REPL.
To create a canvas:
canvas = Canvas()
Adding movable objects using a template node:
box = dom"svg:rect[id=box, height=50, width=50, x=100, y=100]"()
addmovable!(canvas, box)
Serving with Mux, (canvas() returns the canvas' Scope)
using Mux
webio_serve(page("/", req -> canvas()))
Accessing position of movable object:
a = canvas["box"][] #access
canvas["box"] = [500,250] #assignment
Note: Despite the name, the Canvas struct has nothing to do with an HTML canvas, but generates an SVG object.