Skip to content

Commit

Permalink
Merge branch 'main' into imageLight
Browse files Browse the repository at this point in the history
  • Loading branch information
AryanKoundal committed Oct 14, 2023
2 parents 02d6f00 + e81ff0a commit 9a0c3fc
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
9 changes: 7 additions & 2 deletions src/core/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import './shim';

// Core needs the PVariables object
import * as constants from './constants';

/**
* This is the p5 instance constructor.
*
Expand Down Expand Up @@ -178,6 +177,7 @@ class p5 {
this._preloadCount = 0;
this._isGlobal = false;
this._loop = true;
this._startListener = null;
this._initializeInstanceVariables();
this._defaultCanvasSize = {
width: 100,
Expand Down Expand Up @@ -470,6 +470,10 @@ class p5 {
*
*/
this.remove = () => {
// Remove start listener to prevent orphan canvas being created
if(this._startListener){
window.removeEventListener('load', this._startListener, false);
}
const loadingScreen = document.getElementById(this._loadingScreenId);
if (loadingScreen) {
loadingScreen.parentNode.removeChild(loadingScreen);
Expand Down Expand Up @@ -604,7 +608,8 @@ class p5 {
if (document.readyState === 'complete') {
this._start();
} else {
window.addEventListener('load', this._start.bind(this), false);
this._startListener = this._start.bind(this);
window.addEventListener('load', this._startListener, false);
}
}

Expand Down
4 changes: 3 additions & 1 deletion src/webgl/p5.Camera.js
Original file line number Diff line number Diff line change
Expand Up @@ -1622,7 +1622,8 @@ p5.Camera = class Camera {
'eyeX', 'eyeY', 'eyeZ',
'centerX', 'centerY', 'centerZ',
'upX', 'upY', 'upZ',
'cameraFOV', 'aspectRatio', 'cameraNear', 'cameraFar', 'cameraType'
'cameraFOV', 'aspectRatio', 'cameraNear', 'cameraFar', 'cameraType',
'yScale'
];
for (const keyName of keyNamesOfThePropToCopy) {
this[keyName] = cam[keyName];
Expand Down Expand Up @@ -2019,6 +2020,7 @@ p5.Camera = class Camera {

_cam.cameraMatrix = this.cameraMatrix.copy();
_cam.projMatrix = this.projMatrix.copy();
_cam.yScale = this.yScale;

return _cam;
}
Expand Down

0 comments on commit 9a0c3fc

Please sign in to comment.