Skip to content

Commit

Permalink
Merge branch '2.0-fes' into dev-2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
limzykenneth committed Dec 28, 2024
2 parents abe5de9 + e4eb7c4 commit 27ec2fa
Show file tree
Hide file tree
Showing 40 changed files with 1,229 additions and 1,189 deletions.
2 changes: 1 addition & 1 deletion docs/parameterData.json
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,7 @@
[
"Number?",
"Number?",
"P2D|WEBGL?",
"String?",
"HTMLCanvasElement?"
],
[
Expand Down
4 changes: 2 additions & 2 deletions src/accessibility/describe.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ function describe(p5, fn){
*/

fn.describe = function(text, display) {
p5._validateParameters('describe', arguments);
// p5._validateParameters('describe', arguments);
if (typeof text !== 'string') {
return;
}
Expand Down Expand Up @@ -244,7 +244,7 @@ function describe(p5, fn){
*/

fn.describeElement = function(name, text, display) {
p5._validateParameters('describeElement', arguments);
// p5._validateParameters('describeElement', arguments);
if (typeof text !== 'string' || typeof name !== 'string') {
return;
}
Expand Down
4 changes: 2 additions & 2 deletions src/accessibility/outputs.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ function outputs(p5, fn){
*/

fn.textOutput = function(display) {
p5._validateParameters('textOutput', arguments);
// p5._validateParameters('textOutput', arguments);
//if textOutput is already true
if (this._accessibleOutputs.text) {
return;
Expand Down Expand Up @@ -257,7 +257,7 @@ function outputs(p5, fn){
*/

fn.gridOutput = function(display) {
p5._validateParameters('gridOutput', arguments);
// p5._validateParameters('gridOutput', arguments);
//if gridOutput is already true
if (this._accessibleOutputs.grid) {
return;
Expand Down
14 changes: 8 additions & 6 deletions src/app.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
// core
import p5 from './core/main';
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/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 shape from './shape';
shape(p5);

Expand Down Expand Up @@ -61,6 +61,8 @@ webgl(p5);
import type from './type'
type(p5);

import './core/init';
import { waitForDocumentReady, waitingForTranslator, _globalInit } from './core/init';
Promise.all([waitForDocumentReady(), waitingForTranslator]).then(_globalInit);

export default p5;

20 changes: 10 additions & 10 deletions src/color/creating_reading.js
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ function creatingReading(p5, fn){
* @return {p5.Color}
*/
fn.color = function(...args) {
p5._validateParameters('color', args);
// p5._validateParameters('color', args);
if (args[0] instanceof Color) {
// TODO: perhaps change color mode to match instance mode?
return args[0]; // Do nothing if argument is already a color object.
Expand Down Expand Up @@ -495,7 +495,7 @@ function creatingReading(p5, fn){
* </div>
*/
fn.red = function(c) {
p5._validateParameters('red', arguments);
// p5._validateParameters('red', arguments);
// Get current red max
return this.color(c)._getRed();
};
Expand Down Expand Up @@ -632,7 +632,7 @@ function creatingReading(p5, fn){
* </div>
*/
fn.green = function(c) {
p5._validateParameters('green', arguments);
// p5._validateParameters('green', arguments);
// Get current green max
return this.color(c)._getGreen();
};
Expand Down Expand Up @@ -769,7 +769,7 @@ function creatingReading(p5, fn){
* </div>
*/
fn.blue = function(c) {
p5._validateParameters('blue', arguments);
// p5._validateParameters('blue', arguments);
// Get current blue max
return this.color(c)._getBlue();
};
Expand Down Expand Up @@ -871,7 +871,7 @@ function creatingReading(p5, fn){
* </div>
*/
fn.alpha = function(c) {
p5._validateParameters('alpha', arguments);
// p5._validateParameters('alpha', arguments);
// Get current alpha max
return this.color(c)._getAlpha();
};
Expand Down Expand Up @@ -993,7 +993,7 @@ function creatingReading(p5, fn){
* </div>
*/
fn.hue = function(c) {
p5._validateParameters('hue', arguments);
// p5._validateParameters('hue', arguments);
return this.color(c)._getHue();
};

Expand Down Expand Up @@ -1170,7 +1170,7 @@ function creatingReading(p5, fn){
* </div>
*/
fn.saturation = function(c) {
p5._validateParameters('saturation', arguments);
// p5._validateParameters('saturation', arguments);
return this.color(c)._getSaturation();
};

Expand Down Expand Up @@ -1315,7 +1315,7 @@ function creatingReading(p5, fn){
* </div>
*/
fn.brightness = function(c) {
p5._validateParameters('brightness', arguments);
// p5._validateParameters('brightness', arguments);
return this.color(c)._getBrightness();
};

Expand Down Expand Up @@ -1460,7 +1460,7 @@ function creatingReading(p5, fn){
* </div>
*/
fn.lightness = function(c) {
p5._validateParameters('lightness', arguments);
// p5._validateParameters('lightness', arguments);
return this.color(c)._getLightness();
};

Expand Down Expand Up @@ -1524,7 +1524,7 @@ function creatingReading(p5, fn){
* </div>
*/
fn.lerpColor = function(c1, c2, amt) {
p5._validateParameters('lerpColor', arguments);
// p5._validateParameters('lerpColor', arguments);
return c1.lerp(c2, amt, this._renderer.states.colorMode);
};
}
Expand Down
4 changes: 3 additions & 1 deletion src/color/p5.Color.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ class Color {
this._color = to(this._color, this._color.spaceId);
}catch(err){
// TODO: Invalid color string
console.error('Invalid color string');
throw new Error('Invalid color string');
}

}else{
Expand All @@ -107,6 +107,8 @@ class Color {
}else if(vals.length === 1){
mappedVals = Color.mapColorRange([vals[0], vals[0], vals[0]], this.mode, colorMaxes);
mappedVals.push(1);
}else{
throw new Error('Invalid color');
}
}else{
mappedVals = vals;
Expand Down
4 changes: 2 additions & 2 deletions src/color/setting.js
Original file line number Diff line number Diff line change
Expand Up @@ -949,7 +949,7 @@ function setting(p5, fn){
* @return {String} The current color mode.
*/
fn.colorMode = function(mode, max1, max2, max3, maxA) {
p5._validateParameters('colorMode', arguments);
// p5._validateParameters('colorMode', arguments);
if (
[
RGB,
Expand Down Expand Up @@ -2184,7 +2184,7 @@ function setting(p5, fn){
* </div>
*/
fn.blendMode = function (mode) {
p5._validateParameters('blendMode', arguments);
// p5._validateParameters('blendMode', arguments);
if (mode === constants.NORMAL) {
// Warning added 3/26/19, can be deleted in future (1.0 release?)
console.warn(
Expand Down
6 changes: 3 additions & 3 deletions src/core/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export const VERSION = 'VERSION_WILL_BE_REPLACED_BY_BUILD';
* @property {P2D} P2D
* @final
*/
export const P2D = Symbol('p2d');
export const P2D = 'p2d';

export const P2DHDR = 'p2d-hdr';

Expand All @@ -45,7 +45,7 @@ export const P2DHDR = 'p2d-hdr';
* @property {WEBGL} WEBGL
* @final
*/
export const WEBGL = Symbol('webgl');
export const WEBGL = 'webgl';
/**
* One of the two possible values of a WebGL canvas (either WEBGL or WEBGL2),
* which can be used to determine what capabilities the rendering environment
Expand All @@ -54,7 +54,7 @@ export const WEBGL = Symbol('webgl');
* @property {WEBGL2} WEBGL2
* @final
*/
export const WEBGL2 = Symbol('webgl2');
export const WEBGL2 = 'webgl2';

// ENVIRONMENT
/**
Expand Down
6 changes: 3 additions & 3 deletions src/core/environment.js
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,7 @@ function environment(p5, fn){
* @return {Number} current frame rate.
*/
fn.frameRate = function(fps) {
p5._validateParameters('frameRate', arguments);
// p5._validateParameters('frameRate', arguments);
if (typeof fps !== 'number' || fps < 0) {
return this._frameRate;
} else {
Expand Down Expand Up @@ -992,7 +992,7 @@ function environment(p5, fn){
* </div>
*/
fn.fullscreen = function(val) {
p5._validateParameters('fullscreen', arguments);
// p5._validateParameters('fullscreen', arguments);
// no arguments, return fullscreen or not
if (typeof val === 'undefined') {
return (
Expand Down Expand Up @@ -1070,7 +1070,7 @@ function environment(p5, fn){
* @returns {Number} current pixel density of the sketch.
*/
fn.pixelDensity = function(val) {
p5._validateParameters('pixelDensity', arguments);
// p5._validateParameters('pixelDensity', arguments);
let returnValue;
if (typeof val === 'number') {
if (val !== this._renderer._pixelDensity) {
Expand Down
Loading

0 comments on commit 27ec2fa

Please sign in to comment.