Skip to content

Commit

Permalink
Add ability to set canvas state
Browse files Browse the repository at this point in the history
  • Loading branch information
tshaddix committed Nov 17, 2023
1 parent 060a550 commit 78415db
Show file tree
Hide file tree
Showing 12 changed files with 40 additions and 12 deletions.
13 changes: 10 additions & 3 deletions dist/index.es.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/index.es.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/index.umd.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/index.umd.js.map

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions example/build/example.es.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion example/build/example.es.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion example/build/example.umd.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion example/build/example.umd.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "paintbricks",
"version": "1.0.4",
"version": "1.0.5",
"description": "An extendable drawing system built for the web.",
"exports": {
".": {
Expand Down
5 changes: 5 additions & 0 deletions src/Manager.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,11 @@ export declare class Manager {
* @returns ImageData | null
*/
getCanvasState(): ImageData | null;
/**
* Set the current canvas state
* @param data
*/
setCanvasState(data: ImageData | null): void;
/**
* Add listener for state changes
* @param handler
Expand Down
9 changes: 9 additions & 0 deletions src/Manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,15 @@ export class Manager {
return this.canvasState;
}

/**
* Set the current canvas state
* @param data
*/
public setCanvasState(data: ImageData | null): void {
this.canvasState = data;
this.shouldDraw = true;
}

/**
* Add listener for state changes
* @param handler
Expand Down

0 comments on commit 78415db

Please sign in to comment.