Skip to content

Commit 9b34110

Browse files
committed
fixing-minor-suggestions
1 parent bfe2169 commit 9b34110

File tree

4 files changed

+233
-235
lines changed

4 files changed

+233
-235
lines changed

src/core/constants.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,10 @@ export const ARROW = 'default';
6767
*/
6868
export const SIMPLE = 'simple';
6969
/**
70-
* @property {String} FULLY
70+
* @property {String} FULL
7171
* @final
7272
*/
73-
export const FULLY = 'fully';
73+
export const FULL = 'full';
7474

7575
/**
7676
* @typedef {'crosshair'} CROSS

src/webgl/3d_primitives.js

+37-38
Original file line numberDiff line numberDiff line change
@@ -528,81 +528,80 @@ function primitives3D(p5, fn){
528528
*
529529
* - `SIMPLE`: Optimizes for speed by disabling caps, joins, and stroke color features.
530530
* Use this mode for faster line rendering when these visual details are unnecessary.
531-
* - `FULLY`: Enables caps, joins, and stroke color for lines.
531+
* - `FULL`: Enables caps, joins, and stroke color for lines.
532532
* This mode provides enhanced visuals but may reduce performance due to additional processing.
533533
*
534534
* Choose the mode that best suits your application's needs to either improve rendering speed or enhance visual quality.
535535
*
536536
* @method strokeMode
537537
* @param {string} mode - The stroke mode to set. Possible values are:
538538
* - `'SIMPLE'`: Fast rendering without caps, joins, or stroke color.
539-
* - `'FULLY'`: Detailed rendering with caps, joins, and stroke color.
539+
* - `'FULL'`: Detailed rendering with caps, joins, and stroke color.
540540
*
541541
* @example
542542
* <div>
543543
* <code>
544544
* function setup() {
545-
* createCanvas(100, 100, WEBGL);
546-
* strokeWeight(10);
547-
* stroke(0);
545+
* createCanvas(300, 300, WEBGL);
548546
*
549-
* describe('A red, horizontal, rectangular shape with rounded edges (resembling a pill or capsule) in a grey background');
547+
* describe('A sphere with red stroke and a red, wavy line on a gray background.');
550548
* }
551549
*
552550
* function draw() {
553-
* strokeMode(FULLY); // Enables detailed rendering with caps, joins, and stroke color.
554-
* stroke('red');
555-
*
556551
* background(128);
557-
*
558-
* let centerX = 0;
559-
* let centerY = 0;
560-
*
561-
* // Length of the small centered line
562-
* let lineLength = 50;
552+
* strokeMode(FULL); // Enables detailed rendering with caps, joins, and stroke color.
553+
* push();
554+
* strokeWeight(1);
555+
* translate(0, -50, 0);
556+
* sphere(50);
557+
* pop();
563558
*
564-
* beginShape(LINES);
565-
* vertex(centerX - lineLength / 2, centerY, 0);
566-
* vertex(centerX + lineLength / 2, centerY, 0);
559+
* noFill();
560+
* strokeWeight(15);
561+
* beginShape();
562+
* vertex(-150, 100);
563+
* stroke('red');
564+
* bezierVertex(-50, -100, 30, 300, 130, 50);
567565
* endShape();
568566
* }
569567
* </code>
570568
* </div>
571569
*
572570
* <div>
573571
* <code>
574-
* function setup() {
575-
* createCanvas(100, 100, WEBGL);
576-
* strokeWeight(10);
577-
* stroke(0);
572+
* function setup() {
573+
* createCanvas(300, 300, WEBGL);
578574
*
579-
* describe('A black, horizontal, rectangular shape without rounded edges in a grey background');
575+
* describe('A sphere with red stroke and a wavy line without full curve decorations without caps and color on a gray background.');
580576
* }
581577
*
582578
* function draw() {
583-
* strokeMode(SIMPLE); // Enables detailed rendering with caps, joins, and stroke color.
584-
* stroke(`red`);
585579
* background(128);
586-
*
587-
* let centerX = 0;
588-
* let centerY = 0;
589-
*
590-
* // Length of the small centered line
591-
* let lineLength = 50;
580+
* strokeMode(SIMPLE); // Enables simple rendering without caps, joins, and stroke color.
581+
* push();
582+
* strokeWeight(1);
583+
* translate(0, -50, 0);
584+
* sphere(50);
585+
* pop();
592586
*
593-
* beginShape(LINES);
594-
* vertex(centerX - lineLength / 2, centerY, 0);
595-
* vertex(centerX + lineLength / 2, centerY, 0);
587+
* noFill();
588+
* strokeWeight(15);
589+
* beginShape();
590+
* vertex(-150, 100);
591+
* stroke('red');
592+
* bezierVertex(-50, -100, 30, 300, 130, 50);
596593
* endShape();
597594
* }
598595
* </code>
599596
* </div>
600597
*/
601598

602-
fn.strokeMode = function(mode){
603-
if(mode === constants.SIMPLE){
604-
this._renderer._simpleLines = true;
605-
} else if (mode === constants.FULLY) {
599+
fn.strokeMode = function (mode) {
600+
if (mode === undefined) {
601+
return this._renderer._simpleLines ? constants.SIMPLE : constants.FULL;
602+
} else if (mode === constants.SIMPLE) {
603+
this._renderer._simpleLines = true;
604+
} else if (mode === constants.FULL) {
606605
this._renderer._simpleLines = false;
607606
} else {
608607
throw Error('no such parameter');

0 commit comments

Comments
 (0)