Skip to content

Commit

Permalink
Merge pull request #1 from VoidVolker/master
Browse files Browse the repository at this point in the history
[=] Fix CPU overload
  • Loading branch information
garg committed Sep 14, 2015
2 parents 041f963 + 62304ae commit ae53739
Showing 1 changed file with 16 additions and 15 deletions.
31 changes: 16 additions & 15 deletions example.html
Original file line number Diff line number Diff line change
Expand Up @@ -90,32 +90,33 @@
} //var pressure = (Math.sin(pressureInd * 0.4) + 2.0) * 0.33;
}*/

drawArea.onmousemove = function(e) {
if (currentEvent !== null) {
// drawArea.onmousemove = function(e) { // Ussless code
// if (currentEvent !== null) {
//thisevent = currentEvent;
if (window.PointerEvent){
drawArea.addEventListener("pointermove", function(e){
//p.innerHTML= e.pressure;
var coords = getRelativeCoords(e, drawArea);
picture.pictureTransform.inverseTransform(coords);
currentEvent.pushCoordTriplet(coords.x, coords.y, e.pressure);
picture.setCurrentEvent(currentEvent);
picture.display();
if (window.PointerEvent){
drawArea.addEventListener('pointermove', function(e){
if( currentEvent === null ){ return } // When mouse or cursor move - this is null, but event is triggering
//p.innerHTML= e.pressure;
var coords = getRelativeCoords(e, drawArea);
picture.pictureTransform.inverseTransform(coords);
currentEvent.pushCoordTriplet(coords.x, coords.y, e.pressure);
picture.setCurrentEvent(currentEvent);
picture.display();

});
}
});
}
/*
var coords = getRelativeCoords(e, drawArea);
picture.pictureTransform.inverseTransform(coords);
currentEvent.pushCoordTriplet(coords.x, coords.y, 0.5);
picture.setCurrentEvent(currentEvent);
picture.display();
*/
}
// }


};
// };

var createButton = function(value, onclick) {
var btn = document.createElement('input');
btn.type = 'button';
Expand Down

0 comments on commit ae53739

Please sign in to comment.