I'm not sure what code you're using to get the mouse offset, but once you have it you can calculate the correct position by dividing the canvas real size by its visible size.
// Assuming we already have a reference to canvas and the mouse's position
// relative to it is in visibleX and visibleY
var horizontalRatio = canvas.width / canvas.offsetWidth;
var verticalRatio = canvas.height / canvas.offserHeight;
var realX = horizontalRatio * visibleX;
var realY = verticalRatio * visibleY;
// Do something with realX and realY