samedi 3 janvier 2015

Javascript "NetworkError: 500 Internal Server Error" on for.. in comparison


Vote count:

0




I have a question on javascript in which the function below will track the mouse movement when the user clicks the mouse, holds and moves it. I have another function that will redraw the canvas in certain interval checking or when the user changes something on the canvas based on ghostCanvasRedraw == true flag. However when I try to check whether the current mouse pointer within the rectangle I drawn, an error below occured:



NetworkError: 500 Internal Server Error



The function to trigger redraw is as below. I expect the if comparison within for.. in loop is the culprit. Please help & your suggestion is appreciated. Thanks.



function addMouseMoveEvent(canvas) {
EventUtil.addHandler(canvas, 'mousemove', function(event) {
event = EventUtil.getEvent(event);
var rect = canvas.getBoundingClientRect();
mouseX = event.clientX - rect.left;
mouseY = event.clientY - rect.top;

if (!isDragging) {
console.log('Mouse move coordinate on Pdf document: ' + mouseX + ', ' + mouseY);
}
else if (isDragging) {
console.log('Mouse drag coordinate on Pdf document: ' + mouseX + ', ' + mouseY);

for (var i in boxes) {

if (mouseX > boxes[i].x && mouseX < boxes[i].x + boxes[i].w && mouseY > boxes[i].y && mouseY < boxes[i].y + boxes[i].h) {
boxes[i].x = mouseX - boxes[i].w / 2;
boxes[i].y = mouseY - boxes[i].h / 2;
ghostCanvasRedraw = true;

console.log('Box in dragging [' + boxes[i].x + ', ' + boxes[i].y + ', ' + boxes[i].w + ', ' + boxes[i].h + ']');
}
}
}
});
}


asked 18 secs ago







Javascript "NetworkError: 500 Internal Server Error" on for.. in comparison

Aucun commentaire:

Enregistrer un commentaire