Skip to content

Commit 6f10af2

Browse files
committed
Use new SHOW/HIDE names, INCLUDE/EXCLUDE
1 parent 00f414a commit 6f10af2

File tree

4 files changed

+18
-18
lines changed

4 files changed

+18
-18
lines changed

src/core/constants.js

+6-6
Original file line numberDiff line numberDiff line change
@@ -1347,20 +1347,20 @@ export const RGBA = 'rgba';
13471347
/**
13481348
* The `splineEnds` mode where splines curve through
13491349
* their first and last points.
1350-
* @typedef {unique symbol} SHOW
1351-
* @property {SHOW} SHOW
1350+
* @typedef {unique symbol} INCLUDE
1351+
* @property {INCLUDE} INCLUDE
13521352
* @final
13531353
*/
1354-
export const SHOW = Symbol('show');
1354+
export const INCLUDE = Symbol('include');
13551355

13561356
/**
13571357
* The `splineEnds` mode where the first and last points in a spline
13581358
* affect the direction of the curve, but are not rendered.
1359-
* @typedef {unique symbol} HIDE
1360-
* @property {HIDE} HIDE
1359+
* @typedef {unique symbol} EXCLUDE
1360+
* @property {EXCLUDE} EXCLUDE
13611361
* @final
13621362
*/
1363-
export const HIDE = Symbol('hide');
1363+
export const EXCLUDE = Symbol('exclude');
13641364

13651365
/**
13661366
* The `splineEnds` mode where the spline loops back to its first point.

src/core/p5.Renderer.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ class Renderer {
4545
textAlign: constants.LEFT,
4646
textBaseline: constants.BASELINE,
4747
bezierOrder: 3,
48-
splineEnds: constants.SHOW,
48+
splineEnds: constants.INCLUDE,
4949

5050
textWrap: constants.WORD,
5151

src/shape/custom_shapes.js

+9-9
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ to interpolated endpoints (a breaking change)
280280
*/
281281
class SplineSegment extends Segment {
282282
#vertexCapacity = Infinity;
283-
_splineEnds = constants.SHOW;
283+
_splineEnds = constants.INCLUDE;
284284
_splineTightness = 0;
285285

286286
get vertexCapacity() {
@@ -296,15 +296,15 @@ class SplineSegment extends Segment {
296296
}
297297

298298
get canOverrideAnchor() {
299-
return this._splineEnds === constants.HIDE;
299+
return this._splineEnds === constants.EXCLUDE;
300300
}
301301

302302
// assuming for now that the first interpolated vertex is always
303303
// the second vertex passed to splineVertex()
304304
// if this spline segment doesn't follow another segment,
305305
// the first vertex is in an anchor
306306
get _firstInterpolatedVertex() {
307-
if (this._splineEnds === constants.HIDE) {
307+
if (this._splineEnds === constants.EXCLUDE) {
308308
return this._comesAfterSegment ?
309309
this.vertices[1] :
310310
this.vertices[0];
@@ -331,7 +331,7 @@ class SplineSegment extends Segment {
331331
this._splineEnds = shape._splineEnds;
332332
this._splineTightness = shape._splineTightness;
333333

334-
if (this._splineEnds !== constants.HIDE) return added;
334+
if (this._splineEnds !== constants.EXCLUDE) return added;
335335

336336
let verticesPushed = !this._belongsToShape;
337337
let lastPrimitive = shape.at(-1, -1);
@@ -367,9 +367,9 @@ class SplineSegment extends Segment {
367367

368368
// override method on base class
369369
getEndVertex() {
370-
if (this._splineEnds === constants.SHOW) {
370+
if (this._splineEnds === constants.INCLUDE) {
371371
return super.getEndVertex();
372-
} else if (this._splineEnds === constants.HIDE) {
372+
} else if (this._splineEnds === constants.EXCLUDE) {
373373
return this.vertices.at(-2);
374374
} else {
375375
return this.getStartVertex();
@@ -389,7 +389,7 @@ class SplineSegment extends Segment {
389389
}
390390

391391
const prevVertex = this.getStartVertex();
392-
if (this._splineEnds === constants.SHOW) {
392+
if (this._splineEnds === constants.INCLUDE) {
393393
points.unshift(prevVertex);
394394
points.push(this.vertices.at(-1));
395395
} else if (this._splineEnds === constants.JOIN) {
@@ -584,7 +584,7 @@ class Shape {
584584
_splineTightness = 0;
585585
kind = null;
586586
contours = [];
587-
_splineEnds = constants.SHOW;
587+
_splineEnds = constants.INCLUDE;
588588
userVertexProperties = null;
589589

590590
constructor(
@@ -1078,7 +1078,7 @@ class PrimitiveToPath2DConverter extends PrimitiveVisitor {
10781078
const shape = splineSegment._shape;
10791079

10801080
if (
1081-
splineSegment._splineEnds === constants.HIDE &&
1081+
splineSegment._splineEnds === constants.EXCLUDE &&
10821082
!splineSegment._comesAfterSegment
10831083
) {
10841084
let startVertex = splineSegment._firstInterpolatedVertex;

test/unit/visual/cases/shapes.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ visualSuite('Shape drawing', function() {
128128
visualTest('Drawing with curves with hidden ends', function(p5, screenshot) {
129129
setup(p5);
130130
p5.beginShape();
131-
p5.splineEnds(p5.HIDE);
131+
p5.splineEnds(p5.EXCLUDE);
132132
p5.splineVertex(10, 10);
133133
p5.splineVertex(15, 40);
134134
p5.splineVertex(40, 35);
@@ -166,7 +166,7 @@ visualSuite('Shape drawing', function() {
166166
visualTest('Drawing closed curve loops', function(p5, screenshot) {
167167
setup(p5);
168168
p5.beginShape();
169-
p5.splineEnds(p5.HIDE);
169+
p5.splineEnds(p5.EXCLUDE);
170170
p5.splineVertex(10, 10);
171171
p5.splineVertex(15, 40);
172172
p5.splineVertex(40, 35);

0 commit comments

Comments
 (0)