Skip to content

mouseX and mouseY not updated when canvas changes until mouse moves #8139

@eyaler

Description

@eyaler

Most appropriate sub-area of p5.js?

  • Accessibility
  • Color
  • Core/Environment/Rendering
  • Data
  • DOM
  • Events
  • Image
  • IO
  • Math
  • Typography
  • Utilities
  • p5.strands
  • WebGL
  • DevOps, Build process, Unit testing
  • Internationalization (i18n)
  • Friendly Errors
  • Other (specify if possible)

p5.js version

1.11.10

Web browser and version

Firefox 143, Chrome 141

Operating system

windows 11

Steps to reproduce this

Steps:

  1. create a large canvas, and print mouseX and mouseY each frame
  2. with mouse in canvas open/close dev tools with f12 (make sure that mouse lands on canvas also after change) -> note that coords dont update until mouse is moved (in both browsers)
  3. with mouse in canvas toggle fullscreen on/off with f11 (make sure that mouse lands on canvas also after change) -> note that coords dont update until mouse is moved in firefox (works in chrome)
  4. bonus: if mouse is out of canvas after chang, maybe also consider to fix the coordinates

Snippet:

function setup() {
  createCanvas(800, 800);
}

function draw() {
  background(220);
  text(mouseX, 100, 100)
  text(mouseY, 100, 200)
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions