Skip to content

windowWidth and windowHeight not being mapped correctly to counterparts #6396

@bensgilbert

Description

@bensgilbert

Most appropriate sub-area of p5.js?

  • Accessibility
  • Color
  • Core/Environment/Rendering
  • Data
  • DOM
  • Events
  • Image
  • IO
  • Math
  • Typography
  • Utilities
  • WebGL
  • Build Process
  • Unit Testing
  • Internalization
  • Friendly Errors
  • Other (specify if possible)

p5.js version

1.7.0

Web browser and version

Microsoft Edge 116.0.1938.69; Chromium version 116.0.5845.141

Operating System

Windows 11 Version 22H2 (Build 22621.2134)

Steps to reproduce this

Steps:

  1. Create a new tab in your browser
  2. Enter the url and navigate to a site with a p5js sketch
  3. Check the console for the output of the code below

Snippet:

function setup() {
    console.log(windowWidth, windowHeight);
    console.log(innerWidth, innerHeight);
}

This behaviour occurs on MS edge (running chromium). Discord user: davepagurek (138146691151822848) tested this issue in a chrome browser which resulted in the same bug, they also tested this in a firefox browser which did not result in this oddity happening which suggests that it is an issue with chromium.

I found that after refreshing the tab, the values are the same so this bug occurs only in new tabs.

2023-09-05.23-12-36.mp4

Possible Fix:

Set the values of windowWidth and windowHeight manually before calling the setup() function.

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