offsetX
This commit is contained in:
parent
af4477d846
commit
f02885b75f
|
@ -135,17 +135,11 @@ $(function() { sio = (function() {
|
||||||
canvasPaint.width = canvasPaint.width;
|
canvasPaint.width = canvasPaint.width;
|
||||||
|
|
||||||
if (id != undefined) {
|
if (id != undefined) {
|
||||||
|
|
||||||
if (x != undefined && y != undefined) {
|
if (x != undefined && y != undefined) {
|
||||||
|
|
||||||
lasers[id] = {x:x, y:y};
|
lasers[id] = {x:x, y:y};
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
delete lasers[id];
|
delete lasers[id];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (var laserIndex in lasers) {
|
for (var laserIndex in lasers) {
|
||||||
|
@ -168,8 +162,8 @@ $(function() { sio = (function() {
|
||||||
|
|
||||||
sio.onMouseDown = function(event) {
|
sio.onMouseDown = function(event) {
|
||||||
|
|
||||||
var x = (event.x - canvasPdfBounding.left) / canvasPdf.width;
|
var x = event.offsetX / canvasPdf.width;
|
||||||
var y = (event.y - canvasPdfBounding.top) / canvasPdf.height;
|
var y = event.offsetY / canvasPdf.height;
|
||||||
|
|
||||||
socket.emit('pointer', filename, socket.id, x, y);
|
socket.emit('pointer', filename, socket.id, x, y);
|
||||||
|
|
||||||
|
@ -184,8 +178,8 @@ $(function() { sio = (function() {
|
||||||
|
|
||||||
if (pointer) {
|
if (pointer) {
|
||||||
|
|
||||||
var x = (event.x - canvasPdfBounding.left) / canvasPdf.width;
|
var x = event.offsetX / canvasPdf.width;
|
||||||
var y = (event.y - canvasPdfBounding.top) / canvasPdf.height;
|
var y = event.offsetY / canvasPdf.height;
|
||||||
|
|
||||||
if (shouldUpdatePointer) {
|
if (shouldUpdatePointer) {
|
||||||
// Update
|
// Update
|
||||||
|
|
|
@ -120,8 +120,8 @@ $(function() { sio = (function() {
|
||||||
|
|
||||||
sio.onMouseDown = function() {
|
sio.onMouseDown = function() {
|
||||||
|
|
||||||
var x = (event.x - canvasPdfBounding.left) / canvasPdf.width;
|
var x = event.offsetX / canvasPdf.width;
|
||||||
var y = (event.y - canvasPdfBounding.top) / canvasPdf.height;
|
var y = event.offsetY / canvasPdf.height;
|
||||||
|
|
||||||
socket.emit('pointer', filename, socket.id, x, y);
|
socket.emit('pointer', filename, socket.id, x, y);
|
||||||
|
|
||||||
|
@ -136,8 +136,8 @@ $(function() { sio = (function() {
|
||||||
|
|
||||||
if (pointer) {
|
if (pointer) {
|
||||||
|
|
||||||
var x = (event.x - canvasPdfBounding.left) / canvasPdf.width;
|
var x = event.offsetX / canvasPdf.width;
|
||||||
var y = (event.y - canvasPdfBounding.top) / canvasPdf.height;
|
var y = event.offsetY / canvasPdf.height;
|
||||||
|
|
||||||
if (shouldUpdatePointer) {
|
if (shouldUpdatePointer) {
|
||||||
// Update
|
// Update
|
||||||
|
|
Loading…
Reference in New Issue