Zoom Lock On Pavlovia

Hi all,

question: Is there anyway that we can lock the screen zoom on Pavlovia throughout the experiments?

Hey,
I found a way to set the zoom when the experiment starts. I’m unsure if this is what you were trying to achieve, but I wouldn’t touch the zoom anyways.
Anywhere I searched online suggested not to modify this setting (even though it’s mostly about responsive design). So make sure you know what you are doing.

So, to set the zoom of your experiment, try the following:

// Begin Experiment:
document.body.style.zoom = "500%" 

It acts pretty weird. I also tried settings the canvas, but it doesn’t work.
Did you try anything?

Another thing to think about is that the zoom setting works differently in pretty much any browser so I would be careful with those settings.

Hey @Chen ,

Thanks for the response!

I will try to do that, what I am trying to do is to just lock the zoom at %100 if that is possible.

It is possible to retrieve current zoom percentage by:

browserZoom = window.outerWidth*100 / window.innerWidth;

I haven’t try to tinker with these to lock it though.

I couldn’t find a way to make it work, but it’s possible you need to access the canvas and not the actual window.
In case you experiment with it, you can access the canvas this way:

document.querySelector('canvas')

Chen

Hi @Chen,

It has been a while.

I’ve tried the following code that you sent.

document.body.style.zoom = "100%" 

It prevented zoom on Opera browser, however, the resolution decreases as I zoom in. Though the pixel sizes remain the same, which is somewhat of a success!

Thanks.