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

[p5.js 2.0] State machines and renderer refactoring #7270

Draft
wants to merge 22 commits into
base: dev-2.0
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
6ef1afc
Concentrate DOM creation of renderer in the createCanvas method
limzykenneth Sep 20, 2024
2f7f824
Indentation
limzykenneth Sep 20, 2024
9c47a4c
Fix p5.Graphics creation
limzykenneth Sep 21, 2024
c39cfa6
p5.Graphics acts as wrapper of p5.Renderer
limzykenneth Sep 21, 2024
263ae57
Fix p5.Graphics.remove and simplify it
limzykenneth Sep 21, 2024
8427978
Fix webgl canvas creation
limzykenneth Sep 21, 2024
5c68e24
Minor adjustment to p5.Renderer and p5.Graphics remove
limzykenneth Sep 21, 2024
e3c3683
Make resizeCanvas() independent of DOM
limzykenneth Sep 22, 2024
f1d8735
Remove renderer createCanvas() method as it is redundant with constru…
limzykenneth Sep 22, 2024
7a91e53
Global width/height read directly from renderer
limzykenneth Sep 22, 2024
b07b438
Move ownership of pixel density to renderer
limzykenneth Sep 22, 2024
55c45ed
Fix a few tests
limzykenneth Sep 22, 2024
beb432f
Fix a few more tests
limzykenneth Sep 22, 2024
8a60cf3
Include p5 instance methods on p5.Graphics
limzykenneth Sep 23, 2024
40b621d
Refactor some WebGL sections to try to fix tests
limzykenneth Sep 23, 2024
418251b
Visual test use constants from direct import
limzykenneth Sep 23, 2024
eff9ac4
Refactor shape out into its own module
limzykenneth Sep 25, 2024
db6e599
Use new module API to attach methods to p5.Graphics
limzykenneth Sep 26, 2024
7cd3fb3
Attach more functions to p5.Graphics
limzykenneth Sep 27, 2024
104bd32
Move blendMode() to color/setting module
limzykenneth Sep 28, 2024
5c70636
Merge branch 'dev-2.0' into 2.0-modules
limzykenneth Oct 8, 2024
27326fe
Convert renderers to use new syntax modules
limzykenneth Oct 11, 2024
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
8 changes: 4 additions & 4 deletions src/accessibility/outputs.js
Original file line number Diff line number Diff line change
Expand Up @@ -547,8 +547,8 @@ function outputs(p5, fn){
this.drawingContext.getTransform();
const { x: transformedX, y: transformedY } = untransformedPosition
.matrixTransform(currentTransform);
const canvasWidth = this.width * this._pixelDensity;
const canvasHeight = this.height * this._pixelDensity;
const canvasWidth = this.width * this._renderer._pixelDensity;
const canvasHeight = this.height * this._renderer._pixelDensity;
if (transformedX < 0.4 * canvasWidth) {
if (transformedY < 0.4 * canvasHeight) {
return 'top left';
Expand Down Expand Up @@ -653,8 +653,8 @@ function outputs(p5, fn){
// (Ax( By − Cy) + Bx(Cy − Ay) + Cx(Ay − By ))/2
}
// Store the positions of the canvas corners
const canvasWidth = this.width * this._pixelDensity;
const canvasHeight = this.height * this._pixelDensity;
const canvasWidth = this.width * this._renderer._pixelDensity;
const canvasHeight = this.height * this._renderer._pixelDensity;
const canvasCorners = [
new DOMPoint(0, 0),
new DOMPoint(canvasWidth, 0),
Expand Down
19 changes: 2 additions & 17 deletions src/app.js
Original file line number Diff line number Diff line change
@@ -1,26 +1,15 @@
// core
import p5 from './core/main';
import './core/constants';
import './core/environment';
import './core/friendly_errors/stacktrace';
import './core/friendly_errors/validate_params';
import './core/friendly_errors/file_errors';
import './core/friendly_errors/fes_core';
import './core/friendly_errors/sketch_reader';
import './core/helpers';
import './core/legacy';
// import './core/preload';
import './core/p5.Element';
import './core/p5.Graphics';
// import './core/p5.Renderer';
import './core/p5.Renderer2D';
import './core/rendering';
import './core/structure';
import './core/transform';
import './core/shape/2d_primitives';
import './core/shape/attributes';
import './core/shape/curves';
import './core/shape/vertex';
import shape from './shape';
shape(p5);

//accessibility
import accessibility from './accessibility';
Expand Down Expand Up @@ -70,10 +59,6 @@ utilities(p5);
// webgl
import webgl from './webgl';
webgl(p5);
import './webgl/p5.RendererGL.Immediate';
import './webgl/p5.RendererGL';
import './webgl/p5.RendererGL.Retained';
import './webgl/p5.Texture';

import './core/init';

Expand Down
Loading
Loading