Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 17 additions & 3 deletions src/core/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,28 @@ export const VERSION = 'VERSION_WILL_BE_REPLACED_BY_BUILD';

// GRAPHICS RENDERER
/**
* The default, two-dimensional renderer.
* @typedef {unique symbol} P2D
* The default, two-dimensional renderer in p5.js.
*
* Use this when calling {@link p5.createCanvas|createCanvas} (for example,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure that we support @link yet, this is the result of npm run docs:
image

It looks like we don't use this syntax elsewhere in the codebase currently, could we keep using the old <a href="#/p5/createCanvas"> for consistency?

* `createCanvas(400, 400, P2D)`) to specify a 2D context.
*
* @typedef {'p2d'} P2D
* @property {P2D} P2D
* @final
*/
export const P2D = 'p2d';

export const P2DHDR = 'p2d-hdr';
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you'll need to add this line back after your comment block to fix the tests -- looks like the error is that this constant is no longer defined.

/**
* A high-dynamic-range (HDR) variant of the default, two-dimensional renderer.
*
* When available, this mode can allow for extended color ranges and more
* dynamic color representation. Use it similarly to {@link p5.P2D}:
* `createCanvas(400, 400, P2DHDR)`.
*
* @typedef {'p2d-hdr'} P2DHDR
* @property {P2DHDR} P2DHDR
* @final
*/

/**
* One of the two render modes in p5.js, used for computationally intensive tasks like 3D rendering and shaders.
Expand Down
1 change: 1 addition & 0 deletions src/core/environment.js
Original file line number Diff line number Diff line change
Expand Up @@ -514,6 +514,7 @@ function environment(p5, fn){
* - `WEBGL2` whose value is `'webgl2'`,
* - `WEBGL` whose value is `'webgl'`, or
* - `P2D` whose value is `'p2d'`. This is the default for 2D sketches.
* - `P2DHDR` whose value is `'p2d-hdr'` (used for HDR 2D sketches, if available).
*
* See <a href="#/p5/setAttributes">setAttributes()</a> for ways to set the
* WebGL version.
Expand Down
Loading