Skip to content

Commit 0fbfa53

Browse files
authored
Merge branch 'dev-2.0' into eslint-fixes
2 parents f933495 + 9438029 commit 0fbfa53

File tree

7 files changed

+585
-11
lines changed

7 files changed

+585
-11
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: Close Linked Issues on PR Merge
2+
3+
on:
4+
pull_request:
5+
types: [closed]
6+
branches:
7+
- dev-2.0
8+
9+
jobs:
10+
close_issues:
11+
if: github.event.pull_request.merged == true
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Close linked issues on non-default branches
15+
uses: processing/branch-pr-close-issue@v1
16+
with:
17+
token: ${{ secrets.GITHUB_TOKEN }}
18+
branch: dev-2.0

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
"test/**/*.js": "eslint",
1919
"utils/**/*.{js,mjs}": "eslint"
2020
},
21-
"version": "2.0.5-rc.0",
21+
"version": "2.0.5",
2222
"dependencies": {
2323
"@davepagurek/bezier-path": "^0.0.2",
2424
"@japont/unicode-range": "^1.0.0",

src/shape/custom_shapes.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1941,7 +1941,7 @@ function customShapes(p5, fn) {
19411941
*
19421942
*
19431943
* ```js
1944-
* splineProperty('ends', INCLUDE);
1944+
* splineProperty('ends', EXCLUDE);
19451945
* spline(25, 46, 93, 44, 93, 81, 35, 85);
19461946
*
19471947
* point(25, 46);
@@ -1971,7 +1971,7 @@ function customShapes(p5, fn) {
19711971
* strokeWeight(2);
19721972
* spline(25, 46, 93, 44, 93, 81, 35, 85);
19731973
* ```
1974-
*
1974+
* <img src="assets/roundBulge.png"></img>
19751975
* Here's the example showing positive value of tightness,
19761976
* which makes the curve tighter and more angular:
19771977
*
@@ -1981,7 +1981,8 @@ function customShapes(p5, fn) {
19811981
* strokeWeight(2);
19821982
* spline(25, 46, 93, 44, 93, 81, 35, 85);
19831983
* ```
1984-
*
1984+
* <img src="assets/anglurBulge.png"></img>
1985+
*
19851986
* In all cases, the splines in p5.js are <a href = "https://en.wikipedia.org/wiki/Cubic_Hermite_spline#Cardinal_spline">cardinal splines</a>.
19861987
* When tightness is 0, these splines are often known as
19871988
* <a href="https://en.wikipedia.org/wiki/Cubic_Hermite_spline#Catmull%E2%80%93Rom_spline">Catmull-Rom splines</a>

src/type/textCore.js

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -755,6 +755,9 @@ function textCore(p5, fn) {
755755
*
756756
* For example, if the text contains multiple lines due to wrapping or explicit line breaks, textWidth()
757757
* will return the width of the longest line.
758+
*
759+
* **Note:** In p5.js 2.0+, leading and trailing spaces are ignored.
760+
* `textWidth(" Hello ")` returns the same width as `textWidth("Hello")`.
758761
*
759762
* @method textWidth
760763
* @for p5
@@ -821,6 +824,48 @@ function textCore(p5, fn) {
821824
* <div>
822825
* <code>
823826
* function setup() {
827+
* createCanvas(200, 160);
828+
* background(235);
829+
* noLoop();
830+
*
831+
* textSize(18);
832+
* textAlign(LEFT, TOP);
833+
*
834+
* const x = 12, h = 24;
835+
* const s1 = 'Hello';
836+
* const s2 = 'Hello '; // 2 trailing spaces
837+
* const s3 = 'Hello '; // many trailing spaces
838+
*
839+
* // draw text
840+
* fill(0);
841+
* text(s1, x, 12);
842+
* text(s2, x, 56);
843+
* text(s3, x, 100);
844+
*
845+
* // measure and draw tight boxes (all same width)
846+
* noFill(); stroke(255, 0, 0);
847+
* const w1 = textWidth(s1);
848+
* const w2 = textWidth(s2);
849+
* const w3 = textWidth(s3);
850+
* rect(x, 10, w1, h);
851+
* rect(x, 54, w2, h);
852+
* rect(x, 98, w3, h);
853+
*
854+
* // small captions show the actual strings (spaces as ·)
855+
* textSize(10); noStroke(); fill(30);
856+
* text('"' + s1.replace(/ /g, '·') + '" w=' + w1.toFixed(1), x, 10 + h + 2);
857+
* text('"' + s2.replace(/ /g, '·') + '" w=' + w2.toFixed(1), x, 54 + h + 2);
858+
* text('"' + s3.replace(/ /g, '·') + '" w=' + w3.toFixed(1), x, 98 + h + 2);
859+
*
860+
* describe('Three lines: Hello with 0, 2, and many trailing spaces. Red boxes use textWidth and are identical. Captions show spaces as dots.');
861+
* }
862+
* </code>
863+
* </div>
864+
*
865+
* @example
866+
* <div>
867+
* <code>
868+
* function setup() {
824869
* createCanvas(100, 100);
825870
*
826871
* background(200);

0 commit comments

Comments
 (0)