Commit 53c890ca authored by Mathew Parker's avatar Mathew Parker

restructure js dependency

parent 4e1b4f88
......@@ -5,25 +5,30 @@ import { connectable } from 'svg.connectable.js'
export function svg() {
// SVG UI next
var draw = SVG('spatialui').size(600, 300)
var links = draw.group()
var markers = draw.group()
var nodes = draw.group()
//var text = draw.text("{{object.id}}")
var rect_1 = nodes.group().draggy();
var rect_2 = nodes.group().translate(200, 200).draggy();
var rect_3 = nodes.group().translate(100, 200).draggy();
rect_1.rect(50, 50).attr({ fill: '#f06' })
rect_2.rect(50, 50).attr({ fill: '#f08' })
rect_3.rect(50, 50).attr({ fill: '#f12' })
rect_1.connectable({
container: links,
markers: markers
}, rect_2).setLineColor("#000000");
var that = {}
that.render = function() {
var draw = SVG('spatialui').size(600, 300)
var links = draw.group()
var markers = draw.group()
var nodes = draw.group()
//var text = draw.text("{{object.id}}")
var rect_1 = nodes.group().draggy();
var rect_2 = nodes.group().translate(200, 200).draggy();
var rect_3 = nodes.group().translate(100, 200).draggy();
rect_1.rect(50, 50).attr({ fill: '#f06' })
rect_2.rect(50, 50).attr({ fill: '#f08' })
rect_3.rect(50, 50).attr({ fill: '#f12' })
rect_1.connectable({
container: links,
markers: markers
}, rect_2).setLineColor("#000000");
}
return that
}
......@@ -13,6 +13,8 @@ export default {
object: Object
},
mounted: function() {
var c = svg()
c.render()
}
}
</script>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment