Skip to content
Snippets Groups Projects
Commit cc1e1935 authored by Jake Read's avatar Jake Read
Browse files

svg fix

parent 4a7a7120
Branches
No related tags found
No related merge requests found
......@@ -149,25 +149,30 @@ function startBezier(x, y, clk){
}
}
var svgns = "http://www.w3.org/2000/svg";
var svgns = 'http://www.w3.org/2000/svg'
var svg = {}
// 651
// 1554
function newBezier(x1, y1, x2, y2) {
var bz = document.createElementNS(svgns, 'path')
bz.style.stroke = '#000'
bz.style.stroke = '#1a1a1a'
bz.style.fill = 'none'
bz.style.strokeWidth = '2px'
bz.style.strokeWidth = '7px'
var bl = Math.sqrt(Math.pow((x1 - x2), 2) + Math.pow((y1 - y2), 2)) * 0.4
var ps = 'M ' + x1 + ' ' + y1 + ' C ' + (x1 + bl) + ' ' + y1
var pe = ' ' + (x2 - bl) + ' ' + y2 + ' ' + x2 + ' ' + y2
bz.setAttribute('d', ps + pe)
svg.appendChild(bz)
console.log(bz)
return bz
}
function modifyBezier(bz, x1, y1, x2, y2) {
var bl = Math.sqrt(Math.pow((x1 - x2), 2) + Math.pow((y1 - y2), 2)) * 0.4
var bl = Math.sqrt(Math.pow((x1 - x2), 2) + Math.pow((y1 - y2), 2)) * 0.6
var ps = 'M ' + x1 + ' ' + y1 + ' C ' + (x1 + bl) + ' ' + y1
var pe = ' ' + (x2 - bl) + ' ' + y2 + ' ' + x2 + ' ' + y2
bz.setAttribute('d', ps + pe)
......@@ -288,7 +293,15 @@ function newState(rep) {
// init & hookup
window.onload = function() {
svg = document.createElementNS(svgns, 'svg')
svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg')
svg.style.position = 'absolute'
svg.style.left = 0
svg.style.top = 0
svg.style.zIndex = 0
svg.style.overflow = 'visible'
svg.setAttribute('width', 2)
svg.setAttribute('height', 2)
svg.setAttribute('id', 'svg')
svg.setAttribute('width', '100%')
svg.setAttribute('height', '100%')
document.body.appendChild(svg)
......@@ -297,10 +310,6 @@ window.onload = function() {
wrapper.id = 'wrapper'
document.body.append(wrapper)
crv = newBezier(10, 10, 100, 100)
const socket = new WebSocket('ws://localhost:8081')
socket.onopen = function(evt) {
......
......@@ -88,7 +88,7 @@ function addModule(path) {
var mod = new src()
modules.push(mod)
mod.id = modules.length - 1
console.log('adding module', modules[modules.length - 1])
console.log('adding module', mod.description.name, 'id', mod.id)
// mod.inputs.lineIn.fn('log')
// now roll and return representable object
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment