Skip to content

[p5.js 2.0 Bug Report]: New vertex functions missing in p5.Graphics objects #7755

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

Closed
1 of 17 tasks
bojidar-bg opened this issue Apr 18, 2025 · 2 comments
Closed
1 of 17 tasks

Comments

@bojidar-bg
Copy link

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

2.0.0

Web browser and version

Firefox 137.0.2 / archlinux

Operating system

Arch Linux 2024-04-18

Steps to reproduce this

Steps:

  1. Create a p5.Graphics object
  2. Try using one of the new vertex functions, e.g. splineVertex on it.
  3. Get an error about that function missing.
  4. (workaround) Call that function anyway using ._renderer.splineVertex

Snippet:

Reproduction project

function setup() {
  createCanvas(100, 100)
  let g = createGraphics(width, height)
  g.beginShape()
  g.splineVertex(10, 10)
  g.splineVertex(20, 10)
  g.splineVertex(20, 20)
  g.endShape()
  image(g, 0, 0) // #7579
}
@VANSH3104
Copy link
Contributor

Hey @ksen0, I’ve added p5.Graphics.prototype.splineVertex in my PR to address the missing method error — it now proxies to this._renderer.splineVertex(...). After adding it, the test passes successfully (AssertionError: expected undefined to be truthy is gone).
However, I’m unsure if the placement of this extension is ideal. Currently, I’ve placed it src/core/p5.Graphics.js, but it might make more sense to move it somewhere more appropriate in the codebase.
Would love your guidance on where this kind of prototype patch is best placed structurally. Or my pr need Changes

@ksen0 ksen0 added this to the 2.x Anytime milestone Apr 25, 2025
@ksen0
Copy link
Member

ksen0 commented Apr 25, 2025

Hi @VANSH3104 thanks for your fix on this (test and all!), closing as complete, and the fix looks good.

@ksen0 ksen0 closed this as completed Apr 25, 2025
@github-project-automation github-project-automation bot moved this from Ready for Work to Completed in p5.js 2.x 🌱🌳 Apr 25, 2025
@ksen0 ksen0 modified the milestones: 2.x Anytime, 2.0 Jun 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Completed
Development

No branches or pull requests

3 participants