I found the same problem and here is my solution. This is due to the pixel ratio of the device. That is, in pc, the ratio between pixels in css and pixels on the screen is 1: 1
However, in some devices this ratio changes to 1: 2.24 or to different values
My solution was:
var winW = screen.width*window.devicePixelRatio; var winH = screen.height*window.devicePixelRatio;
source share