This is the code that is working on google chrome
var pointer = canvas.getPointer(event.e);
var posiX = pointer.x;
var posiY = pointer.y;
posiX=Math.round( posiX );
posiY=Math.round( posiY );
On mozzila i am getting "TypeError: event is undefined" and it is pointing at
var pointer = canvas.getPointer(event.e);
解决方案
Dime,
Please use mouse events like this:
canvas.on('mouse:down', function(event){
var pointer = canvas.getPointer(event.e);
var posiX = pointer.x;
var posiY = pointer.y;
posiX=Math.round( posiX );
posiY=Math.round( posiY );
});
'event' has to be defined as part of the function parameter. Please make sure you have the same logic.