Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Negative y-values cause crash #7535

Closed
1 of 17 tasks
1v4r0 opened this issue Feb 11, 2025 · 9 comments
Closed
1 of 17 tasks

Negative y-values cause crash #7535

1v4r0 opened this issue Feb 11, 2025 · 9 comments

Comments

@1v4r0
Copy link

1v4r0 commented Feb 11, 2025

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
  • Internationalization
  • Friendly errors
  • Other (specify if possible)

p5.js version

1.11.1

Web browser and version

Version 1.74.48 Chromium: 132.0.6834.83 (Official Build) (64-bit)

Operating system

Pop-OS(Ubuntu) 22.04

Steps to reproduce this

Just do a

"line(-1, -1, 401, -1)"

in draw somewhere. Apparently it can't handle purely negative y-values, which is something that often happens in code, where you "clip the edges" before "deletion". The weird thing is that negative x-values seem to be fine, not sure why y-values have this weird bug.

This is extremely annoying and I've gotten this bug numerous times, e.g. when doing translations in a coordinate system grid, where one of the grid-lines pops out of frame before being "undrawn". It is also surprisingly annoying to fix, which I've probably used hours on at this point.

EDIT: The bug only seems to show up when logged in.

@1v4r0 1v4r0 added the Bug label Feb 11, 2025
Copy link

welcome bot commented Feb 11, 2025

Welcome! 👋 Thanks for opening your first issue here! And to ensure the community is able to respond to your issue, please make sure to fill out the inputs in the issue forms. Thank you!

@ksen0
Copy link
Member

ksen0 commented Feb 12, 2025

Hi @1v4r0 !

I tried this out here: https://editor.p5js.org/ksen0/sketches/4B3ot2kbJ and I didn't get an error on line(-1, -1, 401, -1)

Could you share a code snippet/sketch and the error you get, please?

@1v4r0
Copy link
Author

1v4r0 commented Feb 12, 2025

I get the same error on your program as in mine

https://editor.p5js.org/1v4r0/sketches/Civ7h1KSi

which is:

TypeError: Cannot read properties of undefined (reading 'length')

🌸 p5.js says:
[p5.js, line 53353] Cannot read property of undefined. Check the line number in error and make sure the variable which is being operated is not undefined.

  • More info: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Errors/Cant_access_property#what_went_wrong
    ┌[https://cdnjs.cloudflare.com/ajax/libs/p5.js/1.11.1/p5.js:53353:127]
    Error at line 53353 in _gridMap()
    └[https://cdnjs.cloudflare.com/ajax/libs/p5.js/1.11.1/p5.js:53318:26]
    Called from line 53318 in _main.default._updateGridOutput()
    └[https://cdnjs.cloudflare.com/ajax/libs/p5.js/1.11.1/p5.js:53870:20]
    Called from line 53870 in _main.default._updateAccsOutput()
    └[https://cdnjs.cloudflare.com/ajax/libs/p5.js/1.11.1/p5.js:79142:22]
    Called from line 79142 in _main.default.redraw()
    └[https://cdnjs.cloudflare.com/ajax/libs/p5.js/1.11.1/p5.js:66335:23]
    Called from line 66335 in _draw()

@Sahil-Gupta584
Copy link

Hi @1v4r0 !

I am not facing any error in https://editor.p5js.org/1v4r0/sketches/Civ7h1KSi (you shared). everything is working well on my side

@1v4r0
Copy link
Author

1v4r0 commented Feb 13, 2025

Weird, I just tested it on chrome, and it's working. I guess it's some weird browser based error.
Edit. Now it's working on my browser too. I wonder if someone did a fix? Because it was reliably causing an error before.
Edit2. It only bugs out when I'm logged in, it works fine when I'm logged out.

@awelles
Copy link
Contributor

awelles commented Feb 13, 2025

@1v4r0

I get no error in https://editor.p5js.org/1v4r0/sketches/Civ7h1KSi whether I'm logged in or not in both Chrome and Firefox.

macOS Big Sur, 11.7.10
Chrome Version 133.0.6943.99 (Official Build) (x86_64)
Firefox 136.0b5 (64-bit)

@1v4r0
Copy link
Author

1v4r0 commented Feb 13, 2025

I made a short video showing the error. I start with a logged out version of p5, where I test the line and it works. I log in and the exact same code breaks.
https://github.com/user-attachments/assets/9488cf43-5f19-4522-9856-b44993a1735f

@awelles
Copy link
Contributor

awelles commented Feb 13, 2025

Yup. That sure is crashy.
I just redid what you did exactly in Firefox with no issues.

@davepagurek
Copy link
Contributor

This happens when you have table text accessible outputs turned on in the editor:

Image

I'm going to close this in favour of #7259 which also tracks this issue. If anyone is interested in implementing the suggested fix in there, feel free to leave a comment on that issue!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants