@thi.ng/hiccup-canvas 3.0.0 → 3.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Change Log
2
2
 
3
- - **Last updated**: 2024-05-08T18:24:32Z
3
+ - **Last updated**: 2024-05-09T14:25:15Z
4
4
  - **Generator**: [thi.ng/monopub](https://thi.ng/monopub)
5
5
 
6
6
  All notable changes to this project will be documented in this file.
@@ -9,6 +9,12 @@ See [Conventional Commits](https://conventionalcommits.org/) for commit guidelin
9
9
  **Note:** Unlisted _patch_ versions only involve non-code or otherwise excluded changes
10
10
  and/or version bumps of transitive dependencies.
11
11
 
12
+ ### [3.0.1](https://github.com/thi-ng/umbrella/tree/@thi.ng/hiccup-canvas@3.0.1) (2024-05-09)
13
+
14
+ #### ♻️ Refactoring
15
+
16
+ - minor update `draw()` arc handling ([e82077e](https://github.com/thi-ng/umbrella/commit/e82077e))
17
+
12
18
  # [3.0.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/hiccup-canvas@3.0.0) (2024-05-08)
13
19
 
14
20
  #### 🛑 Breaking changes
package/README.md CHANGED
@@ -25,8 +25,7 @@
25
25
  - [Supported shape types](#supported-shape-types)
26
26
  - [Group](#group)
27
27
  - [Definition group](#definition-group)
28
- - [Circle](#circle)
29
- - [Circular arc](#circular-arc)
28
+ - [Circle / circular arc](#circle--circular-arc)
30
29
  - [Ellipse / elliptic arc](#ellipse--elliptic-arc)
31
30
  - [Rect](#rect)
32
31
  - [Line](#line)
@@ -106,7 +105,7 @@ For Node.js REPL:
106
105
  const hc = await import("@thi.ng/hiccup-canvas");
107
106
  ```
108
107
 
109
- Package sizes (brotli'd, pre-treeshake): ESM: 2.55 KB
108
+ Package sizes (brotli'd, pre-treeshake): ESM: 2.54 KB
110
109
 
111
110
  ## Dependencies
112
111
 
@@ -134,7 +133,7 @@ directory are using this package:
134
133
  | <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/hdom-canvas-draw.jpg" width="240"/> | Interactive pattern drawing demo using transducers | [Demo](https://demo.thi.ng/umbrella/hdom-canvas-draw/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/hdom-canvas-draw) |
135
134
  | <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/hdom-canvas-particles.jpg" width="240"/> | 2D Bezier curve-guided particle system | [Demo](https://demo.thi.ng/umbrella/hdom-canvas-particles/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/hdom-canvas-particles) |
136
135
  | <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/hdom-canvas/hdom-canvas-shapes-results.png" width="240"/> | Various hdom-canvas shape drawing examples & SVG conversion / export | [Demo](https://demo.thi.ng/umbrella/hdom-canvas-shapes/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/hdom-canvas-shapes) |
137
- | <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/hiccup-canvas-arcs.png" width="240"/> | Animated arcs & drawing using hiccup-canvas | [Demo](https://demo.thi.ng/umbrella/hiccup-canvas-arcs/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/hiccup-canvas-arcs) |
136
+ | <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/hiccup-canvas-arcs.jpg" width="240"/> | Animated arcs & drawing using hiccup-canvas | [Demo](https://demo.thi.ng/umbrella/hiccup-canvas-arcs/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/hiccup-canvas-arcs) |
138
137
  | <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/hiccup-canvas-basics.png" width="240"/> | Basic hiccup-based canvas drawing | [Demo](https://demo.thi.ng/umbrella/hiccup-canvas-basics/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/hiccup-canvas-basics) |
139
138
  | <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/poly-subdiv.jpg" width="240"/> | Animated, iterative polygon subdivisions & visualization | [Demo](https://demo.thi.ng/umbrella/poly-subdiv/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/poly-subdiv) |
140
139
 
@@ -205,27 +204,21 @@ Attributes defined at group level are inherited by child elements.
205
204
  Special group / container for [gradient definitions](#gradients). If
206
205
  used, should always come first in a scene tree.
207
206
 
208
- ### Circle
207
+ ### Circle / circular arc
209
208
 
210
209
  ```ts
211
- ["circle", attribs, [x, y], radius]
210
+ ["circle", attribs, [x, y], radius, startTheta?, endTheta?, ccw?]
212
211
  ```
213
212
 
214
- ### Circular arc
215
-
216
- ```ts
217
- ["arc", attribs, [x, y], radius, startAngle, endAngle, anticlockwise?]
218
- ```
219
-
220
- Please see [note about SVG support](#svg-paths-with-arc-segments).
213
+ Angles in radians. Please see [note about SVG support](#svg-paths-with-arc-segments).
221
214
 
222
215
  ### Ellipse / elliptic arc
223
216
 
224
217
  ```ts
225
- ["ellipse", attribs, [x, y], [rx, ry], axisTheta?, start?, end?, ccw?]
218
+ ["ellipse", attribs, [x, y], [rx, ry], axisTheta?, startTheta?, endTheta?, ccw?]
226
219
  ```
227
220
 
228
- Please see [note about SVG support](#svg-paths-with-arc-segments).
221
+ Angles in radians. Please see [note about SVG support](#svg-paths-with-arc-segments).
229
222
 
230
223
  ### Rect
231
224
 
@@ -312,7 +305,14 @@ however only the latter segment type is compatible with SVG (circular arcs are
312
305
  only supported by the HTML Canvas API). We recommended to use one of the
313
306
  available path constructor functions in
314
307
  [@thi.ng/geom](https://github.com/thi-ng/umbrella/tree/develop/packages/geom) to
315
- create paths which ensure SVG compatibility:
308
+ create individual arcs or paths which ensure SVG compatibility:
309
+
310
+ Arcs:
311
+
312
+ - [`arc()`](https://docs.thi.ng/umbrella/geom/functions/arc-1.html)
313
+ - [`arcFrom2Points()`](https://docs.thi.ng/umbrella/geom/functions/arcFrom2Points.html)
314
+
315
+ Paths:
316
316
 
317
317
  - [`pathFromSvg()`](https://docs.thi.ng/umbrella/geom/functions/pathFromSvg.html)
318
318
  - [`pathBuilder()`](https://docs.thi.ng/umbrella/geom/functions/pathBuilder-1.html)
package/draw.js CHANGED
@@ -96,29 +96,27 @@ const draw = (ctx, shape, pstate = { attribs: {}, edits: [] }) => {
96
96
  );
97
97
  break;
98
98
  case "circle":
99
- circularArc(ctx, attribs, shape[2], shape[3]);
100
- break;
101
- case "ellipse":
102
- ellipticArc(
99
+ case "arc":
100
+ circularArc(
103
101
  ctx,
104
102
  attribs,
105
103
  shape[2],
106
104
  shape[3],
107
105
  shape[4],
108
106
  shape[5],
109
- shape[6],
110
- shape[7]
107
+ shape[6]
111
108
  );
112
109
  break;
113
- case "arc":
114
- circularArc(
110
+ case "ellipse":
111
+ ellipticArc(
115
112
  ctx,
116
113
  attribs,
117
114
  shape[2],
118
115
  shape[3],
119
116
  shape[4],
120
117
  shape[5],
121
- shape[6]
118
+ shape[6],
119
+ shape[7]
122
120
  );
123
121
  break;
124
122
  case "text":
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thi.ng/hiccup-canvas",
3
- "version": "3.0.0",
3
+ "version": "3.0.1",
4
4
  "description": "Hiccup shape tree renderer for vanilla Canvas 2D contexts",
5
5
  "type": "module",
6
6
  "module": "./index.js",
@@ -131,5 +131,5 @@
131
131
  ],
132
132
  "year": 2018
133
133
  },
134
- "gitHead": "df34b4a9e650cc7323575356de207d78933bdcf3\n"
134
+ "gitHead": "41bd769068da804eeace622ec7db50e4d48f1dc9\n"
135
135
  }