Skip to content

information on reference page about displayWidth seems not correct #1230

Open
@Qiguang

Description

@Qiguang

Topic

Hi all,
I'm not sure if it's an appropriate topic here.
I‘m just trying to improve the document on p5.js site.
But I didn't find a proper place, it's not a bug of code base, not a behavior issue of the site, not a new feature, not a translation error.

on the page, it says:

System variable that stores the width of the screen display according to The default pixelDensity. This is used to run a full-screen program on any display size. To return actual screen size, multiply this by pixelDensity.

After test, I found that I cannot use displayWidth directly to create a full-screen canvas, when the page was zoomed.
Instead, if I want the canvas size full-screen, I should do this

createCanvas(displayWidth/displayDensity(), displayHeight/displayDensity());

And second, to return actual screen size, I don't need multiply displayWidth by pixelDensity.
Even I zooming the page, displayWidth is always the actual width.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions