kurokida / jspsych-psychophysics

A jsPsych plugin for psychophysics
https://kurokida.github.io/jspsych-psychophysics/
MIT License
51 stars 13 forks source link

canvas height and jspsych-content mismatch #39

Closed franfrutos closed 2 years ago

franfrutos commented 2 years ago

Hello @kurokida.

I have a problem with the size of the canvas. Apparently, the canvas size is consistently 8 pixels smaller in height than jspsych-content and jspsych-content-wraper. This results in a white strip at the bottom of the screen when doing the experiment in fullscreen, and the scroll bar being activated when not.

I have checked that it has nothing to do with any kind of margin or padding, and when I manually modify the canvas size, that 8 pixels difference is maintained. Any idea what can happen and how to fix it?

I attach an image of the problem

Problem

Thanks and sorry for the inconvenient.

kurokida commented 2 years ago

Thank you for using my plugin.

You can change the canvas_offsetY property of which default size is 8 pixels. See https://jspsychophysics.hes.kyushu-u.ac.jp/pluginParams/#parameters-related-to-canvas

However, if you set this value to 0, for example, another problem may arise. The problem is the display of the vertical scrollbar. I implemented the canvas_offsetY property not to display the vertical scroll bar.

I have a very simple idea not to present a white stripe at the bottom of the screen. You can set the background-color CSS like this.

        body {
            background-color: #808080;
        }

The background color of my suggestion is gray, it is probably green in your case.

franfrutos commented 2 years ago

Thank you very much! @kurokida

That was my initial solution, so I guess if the size of the canvas doesn't require the whole screen it's better to give it a reduced size and change the colour of the body.

Thank you very much and best regards, Fran