diff --git a/static/js/speaker.js b/static/js/speaker.js index 057b109..841ea50 100644 --- a/static/js/speaker.js +++ b/static/js/speaker.js @@ -135,17 +135,11 @@ $(function() { sio = (function() { canvasPaint.width = canvasPaint.width; if (id != undefined) { - if (x != undefined && y != undefined) { - lasers[id] = {x:x, y:y}; - } else { - delete lasers[id]; - } - } for (var laserIndex in lasers) { @@ -168,8 +162,8 @@ $(function() { sio = (function() { sio.onMouseDown = function(event) { - var x = (event.x - canvasPdfBounding.left) / canvasPdf.width; - var y = (event.y - canvasPdfBounding.top) / canvasPdf.height; + var x = event.offsetX / canvasPdf.width; + var y = event.offsetY / canvasPdf.height; socket.emit('pointer', filename, socket.id, x, y); @@ -184,8 +178,8 @@ $(function() { sio = (function() { if (pointer) { - var x = (event.x - canvasPdfBounding.left) / canvasPdf.width; - var y = (event.y - canvasPdfBounding.top) / canvasPdf.height; + var x = event.offsetX / canvasPdf.width; + var y = event.offsetY / canvasPdf.height; if (shouldUpdatePointer) { // Update diff --git a/static/js/viewer.js b/static/js/viewer.js index 63aedbd..d21d068 100644 --- a/static/js/viewer.js +++ b/static/js/viewer.js @@ -120,8 +120,8 @@ $(function() { sio = (function() { sio.onMouseDown = function() { - var x = (event.x - canvasPdfBounding.left) / canvasPdf.width; - var y = (event.y - canvasPdfBounding.top) / canvasPdf.height; + var x = event.offsetX / canvasPdf.width; + var y = event.offsetY / canvasPdf.height; socket.emit('pointer', filename, socket.id, x, y); @@ -136,8 +136,8 @@ $(function() { sio = (function() { if (pointer) { - var x = (event.x - canvasPdfBounding.left) / canvasPdf.width; - var y = (event.y - canvasPdfBounding.top) / canvasPdf.height; + var x = event.offsetX / canvasPdf.width; + var y = event.offsetY / canvasPdf.height; if (shouldUpdatePointer) { // Update