Question about mouseX and mouseY

hello guys

Working on a project with p5js and getting a curious result with mouseX and mouseY

So I have this code:

 if(tx > 0 && tx < 500 && ty > 0 && ty < 500 && myp5.mouseIsPressed && (pty != ty || ptx != tx)){
            socket.emit('message',{x : tx, y : ty, pen: 1});
            pendown = true;
            console.log(myp5.mouseX + "---" + myp5.mouseY);
    
    }else{
           if(pendown){
               pendown = false;
               socket.emit('message',{x : tx, y : ty, pen: 0});
               console.log(tx + "---" + ty + "---up" );
            }
    }

and returns me this :

402.578125—436.5—up
java.js:14 392.578125—442.5
java.js:14 386.578125—445.5
java.js:20 386.578125—445.5—up
java.js:14 380.578125—447.5
java.js:14 373.578125—448.5
java.js:20 373.578125—448.5—up
java.js:14 365.578125—450.5
java.js:20 365.578125—450.5—up
java.js:14 358.578125—452.5
java.js:20 358.578125—452.5—up
java.js:14 352.578125—452.5
java.js:20 352.578125—452.5—up
java.js:14 347.578125—452.5
java.js:20 347.578125—452.5—up

why is the X with much more resolution and Y ? is this normal ?

thanks

Is your canvas square or rectangular?

Hello

thanks for taking the time to reply this

it’s square, 500x500 on a retina display ( don’t know if this matters )

Do you have more code? Difficult to say otherwise.

Yeah we might need more code (maybe where ty or y is modified). This just prints it, the issue you are asking about probably happens before this code runs.

It looks like the decimal place of both x and y are the same for every value; each value only changes in whole-number amounts, with the unchanging decimal amount added on (x’s being .578125 and y’s being .5). Because of this I honestly don’t think it’s an issue, but if it is giving you problems, then yes, please post more code.