|
@ -100,9 +100,12 @@ function updateLines(lines){ |
|
|
}; |
|
|
}; |
|
|
svglines_online = new Array(); |
|
|
svglines_online = new Array(); |
|
|
for (var i = lines.length - 1; i >= 0; i--) { |
|
|
for (var i = lines.length - 1; i >= 0; i--) { |
|
|
|
|
|
var id = lines[i].ID; |
|
|
|
|
|
console.log('adding: ' + id); |
|
|
var current = addLine(lines[i], svgscreen); |
|
|
var current = addLine(lines[i], svgscreen); |
|
|
current.addEventListener('click', function () { |
|
|
current.addEventListener('click', function () { |
|
|
console.log('CLICKED'); |
|
|
console.log('removing: ' + id); |
|
|
|
|
|
removeLine(id); |
|
|
}); |
|
|
}); |
|
|
if(lines[i].line_kind == 0){ |
|
|
if(lines[i].line_kind == 0){ |
|
|
current.setAttribute('class', "guitar"); |
|
|
current.setAttribute('class', "guitar"); |
|
@ -113,6 +116,14 @@ function updateLines(lines){ |
|
|
}; |
|
|
}; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function removeLine(id){ |
|
|
|
|
|
var packet = { |
|
|
|
|
|
command: 'remove line', |
|
|
|
|
|
data: id |
|
|
|
|
|
}; |
|
|
|
|
|
websocket.send(JSON.stringify(packet)); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
function drawStart(line){ |
|
|
function drawStart(line){ |
|
|
current_svgline = addLine(line, svgscreen); |
|
|
current_svgline = addLine(line, svgscreen); |
|
|
if(line_kind == 0){ |
|
|
if(line_kind == 0){ |
|
@ -133,6 +144,7 @@ function drawEnd(line){ |
|
|
if(dx*dx + dy*dy < 100) return; |
|
|
if(dx*dx + dy*dy < 100) return; |
|
|
|
|
|
|
|
|
line.line_kind = line_kind; |
|
|
line.line_kind = line_kind; |
|
|
|
|
|
line.ID = 0; |
|
|
var packet = { |
|
|
var packet = { |
|
|
command: 'add line', |
|
|
command: 'add line', |
|
|
data: line |
|
|
data: line |
|
|