What are you trying to achieve?:
Translate mouse coordinates from height to pixel.
Description of the problem
I set the size of an image in pixel (550x550).
image_in = new visual.ImageStim({
win : psychoJS.window,
name : ‘image_in’, units : ‘pix’,
image : ‘EmojiGrid_inside.jpg’, mask : undefined,
ori : 0.0, pos : [0, 0], size : [550, 550],
color : new util.Color([1, 1, 1]), opacity : undefined,
flipHoriz : false, flipVert : false,
texRes : 128.0, interpolate : true, depth : -2.0
});
Participant have to click on the image, and I analyse mouse coordinates.
Mouse coordinates are calculate in heights.
What did you try to make it work?:
I want to calculate the coordinates in relation to the image, thus I want to translate height to pixel coordinates.
I have the screen resolution of each participant, then to convert the height to pixel,
I do :
height.x * (winSize.x/2) and height.y * (winSize.y/2)
Or should I calculate also the ratio (that maybe could differ between screens, eg. 16/10 vs 16/9) or add some other information?
What specifically went wrong when you tried that?:
Sometimes happens that the coordinates are outside the image (eg. +288, when being the image 550x550, its coordinates should be from +250 - 250),
but the output says that participant actually click that image.
How is it possible? Is there a solution for my issue?
Thank you in advance.
Ps. Unfortunately I realised later that I should have set image size differently.