@n3rdw1z4rd/core 0.19.0 → 0.19.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.
@@ -1,3 +1,4 @@
1
+ import { XY } from "./types.js";
1
2
  //#region src/canvas-renderer.d.ts
2
3
  /**
3
4
  * Anything a 2D context accepts as a fill or stroke style: a CSS color string, a gradient or a pattern.
@@ -110,6 +111,8 @@ export declare class CanvasRenderer {
110
111
  get width(): number;
111
112
  /** canvas height in pixels */
112
113
  get height(): number;
114
+ /** canvas center in pixels */
115
+ get center(): XY;
113
116
  /**
114
117
  * @param canvas defaults to a new canvas element, not attached to the page (append {@link CanvasRenderer.canvas} yourself)
115
118
  */
@@ -73,6 +73,13 @@ var CanvasRenderer = class {
73
73
  get height() {
74
74
  return this.canvas.height;
75
75
  }
76
+ /** canvas center in pixels */
77
+ get center() {
78
+ return {
79
+ x: Math.floor(this.width / 2),
80
+ y: Math.floor(this.height / 2)
81
+ };
82
+ }
76
83
  /**
77
84
  * @param canvas defaults to a new canvas element, not attached to the page (append {@link CanvasRenderer.canvas} yourself)
78
85
  */
package/dist/index.cjs CHANGED
@@ -190,6 +190,13 @@ var CanvasRenderer = class {
190
190
  get height() {
191
191
  return this.canvas.height;
192
192
  }
193
+ /** canvas center in pixels */
194
+ get center() {
195
+ return {
196
+ x: Math.floor(this.width / 2),
197
+ y: Math.floor(this.height / 2)
198
+ };
199
+ }
193
200
  /**
194
201
  * @param canvas defaults to a new canvas element, not attached to the page (append {@link CanvasRenderer.canvas} yourself)
195
202
  */
package/dist/index.d.cts CHANGED
@@ -154,6 +154,8 @@ export declare class CanvasRenderer {
154
154
  get width(): number;
155
155
  /** canvas height in pixels */
156
156
  get height(): number;
157
+ /** canvas center in pixels */
158
+ get center(): XY;
157
159
  /**
158
160
  * @param canvas defaults to a new canvas element, not attached to the page (append {@link CanvasRenderer.canvas} yourself)
159
161
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@n3rdw1z4rd/core",
3
- "version": "0.19.0",
3
+ "version": "0.19.1",
4
4
  "description": "core library",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.js",