Replies: 2 comments
-
Solution 1: Estimate User Screen SizeAccording to this article, a computer screen is typically 24 - 30 inches large. |
Beta Was this translation helpful? Give feedback.
0 replies
-
Solution 2: Ask User to Adjust Viewing DistanceIf
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi everyone,
I recently encountered an issue when using the virtual-chinrest plugin: after the plugin scaled my window, my document object would be too large for my screen, causing my computer to add horizontal and vertical scrollbars that I did not want. After thinking about the issue, I came up with a few solutions. I would like to share these solutions here, both for my own reference and in case anyone has experienced the same problem.
Disclaimer: I am still a novice programmer, so I apologize if this discussion thread seems obvious or unnecessary to those of you with more experience. Please feel free to share your own insights on this topic if you want to 🙂
How does the virtual-chinrest plugin work?
After analyzing the code for the virtual-chinrest plugin, I came to the following understanding of how the plugin works (again, remember I am still new to programming, so I may be wrong):
The virtual-chinrest plugin aims to resize items on the user's screen so that they always have the same absolute size (i.e., cm, in, deg) regardless of the pixel density of the user's screen. It does so by finding the screen's pixel density and dividing it by a ratio of pixels to absolute units to obtain a scaling factor. Then, it applies the scaling factor to the document body using the CSS property
transform: scale()
.getScaledItemWidth()
, find the new width of the credit card image in px on the user's screen,item_width_px
convertPixelsToMM()
andaccurateRound()
, convert the width from px to mm to obtainpx2mm
px2mm
, to cm/in/deg,px2unit_scr
scale_factor = px2unit_scr / trial.pixels_per_unit
scale_factor
to the jspsych-content div usingtransform:scale()
Now, an item of x pixels on the user's screen will always display as y cm/in/deg.
Potential problem:
We do not know the dimensions and pixel density of the user's screen, so we don't know if the screen is large enough to accommodate the scaled window. For example, what if the user does not have y cm/in/deg available on their screen? In this case, items of x pixels will overflow the screen, creating scrollbars.
Unfortunately, due to the nature of
transform:scale()
, we cannot stop the screen elements from overflowing their containers. According to this thread,transform:scale()
does not respond tomin-
ormax-
properties.Therefore, what can we do to stop screen overflow when using the virtual-chinrest plugin?
Beta Was this translation helpful? Give feedback.
All reactions