offsetX
This commit is contained in:
parent
af4477d846
commit
f02885b75f
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue