Skip to content
This repository has been archived by the owner on Oct 28, 2024. It is now read-only.

Commit

Permalink
Merge branch 'ng-legacy'
Browse files Browse the repository at this point in the history
* ng-legacy:
  Add method for requesting full drawing history

# Conflicts:
#	dist/canvas-whiteboard.component.js
#	dist/canvas-whiteboard.component.metadata.json
#	package-lock.json
#	package.json
#	src/canvas-whiteboard.component.ts
  • Loading branch information
Peshou committed Sep 23, 2018
2 parents 484fa9f + 84c26c9 commit d0527e9
Show file tree
Hide file tree
Showing 16 changed files with 91 additions and 21 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -370,6 +370,8 @@ export class AppComponent {
}
}
```
### Requesting the full update history so far
Can be called via the method `getDrawingHistory(): CanvasWhiteboardUpdate[]`. The items will be deep cloned for consistency using lodash.
## Saving drawn canvas as an image
In order to save drawn images you can either click the Save button in the canvas,
Expand Down
2 changes: 2 additions & 0 deletions dist/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -370,6 +370,8 @@ export class AppComponent {
}
}
```
### Requesting the full update history so far
Can be called via the method `getDrawingHistory(): CanvasWhiteboardUpdate[]`. The items will be deep cloned for consistency using lodash.
## Saving drawn canvas as an image
In order to save drawn images you can either click the Save button in the canvas,
Expand Down
18 changes: 13 additions & 5 deletions dist/bundles/ng2-canvas-whiteboard.umd.js

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

4 changes: 2 additions & 2 deletions dist/bundles/ng2-canvas-whiteboard.umd.min.js

Large diffs are not rendered by default.

11 changes: 10 additions & 1 deletion dist/modules/ng2-canvas-whiteboard.es5.js

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

11 changes: 10 additions & 1 deletion dist/modules/ng2-canvas-whiteboard.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/ng2-canvas-whiteboard.metadata.json

Large diffs are not rendered by default.

7 changes: 5 additions & 2 deletions dist/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ng2-canvas-whiteboard",
"version": "3.0.2",
"version": "3.0.3",
"description": "A Canvas component for Angular which supports free drawing.",
"main": "./bundles/ng2-canvas-whiteboard.umd.js",
"module": "./modules/ng2-canvas-whiteboard.es5.js",
Expand Down Expand Up @@ -40,7 +40,9 @@
"peerDependencies": {
"rxjs": "^6.0.0"
},
"dependencies": {},
"dependencies": {
"lodash": "4.17.11"
},
"devDependencies": {
"@angular/animations": "^6.0.0",
"@angular/common": "^6.0.0",
Expand All @@ -50,6 +52,7 @@
"@angular/platform-browser": "^6.0.0",
"@angular/platform-browser-dynamic": "^6.0.0",
"@angular/platform-server": "^6.0.0",
"@types/lodash": "4.14.116",
"@types/node": "7.0.10",
"chalk": "1.1.3",
"core-js": "2.4.1",
Expand Down
5 changes: 5 additions & 0 deletions dist/src/canvas-whiteboard.component.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,11 @@ export declare class CanvasWhiteboardComponent implements OnInit, AfterViewInit,
*/
toggleShapeSelector(value: boolean): void;
selectShape(newShapeBlueprint: INewCanvasWhiteboardShape<CanvasWhiteboardShape>): void;
/**
* Returns a deep copy of the current drawing history for the canvas.
* The deep copy is returned because we don't want anyone to mutate the current history
*/
getDrawingHistory(): CanvasWhiteboardUpdate[];
/**
* Unsubscribe from a given subscription if it is active
* @param subscription
Expand Down
11 changes: 8 additions & 3 deletions package-lock.json

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

7 changes: 5 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ng2-canvas-whiteboard",
"version": "3.0.2",
"version": "3.0.3",
"description": "A Canvas component for Angular which supports free drawing.",
"main": "./bundles/ng2-canvas-whiteboard.umd.js",
"module": "./modules/ng2-canvas-whiteboard.es5.js",
Expand Down Expand Up @@ -40,7 +40,9 @@
"peerDependencies": {
"rxjs": "^6.0.0"
},
"dependencies": {},
"dependencies": {
"lodash": "4.17.11"
},
"devDependencies": {
"@angular/animations": "^6.0.0",
"@angular/common": "^6.0.0",
Expand All @@ -50,6 +52,7 @@
"@angular/platform-browser": "^6.0.0",
"@angular/platform-browser-dynamic": "^6.0.0",
"@angular/platform-server": "^6.0.0",
"@types/lodash": "4.14.116",
"@types/node": "7.0.10",
"chalk": "1.1.3",
"core-js": "2.4.1",
Expand Down
2 changes: 1 addition & 1 deletion public_api.js

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

10 changes: 9 additions & 1 deletion src/canvas-whiteboard.component.js

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

11 changes: 10 additions & 1 deletion src/canvas-whiteboard.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import {CanvasWhiteboardShapeService, INewCanvasWhiteboardShape} from "./shapes/
import {CanvasWhiteboardShapeOptions} from "./shapes/canvas-whiteboard-shape-options";
import {fromEvent, Subscription} from "rxjs/index";
import {debounceTime, distinctUntilChanged} from "rxjs/operators";
import {cloneDeep} from "lodash";

@Component({
selector: 'canvas-whiteboard',
Expand Down Expand Up @@ -820,7 +821,7 @@ export class CanvasWhiteboardComponent implements OnInit, AfterViewInit, OnChang
* @return Emits an Array of Updates when the batch.
*/
private _prepareUpdateForBatchDispatch(update: CanvasWhiteboardUpdate): void {
this._batchUpdates.push(update);
this._batchUpdates.push(cloneDeep(update));
if (!this._updateTimeout) {
this._updateTimeout = setTimeout(() => {
this.onBatchUpdate.emit(this._batchUpdates);
Expand Down Expand Up @@ -1074,6 +1075,14 @@ export class CanvasWhiteboardComponent implements OnInit, AfterViewInit, OnChang
this.selectedShapeConstructor = newShapeBlueprint;
}

/**
* Returns a deep copy of the current drawing history for the canvas.
* The deep copy is returned because we don't want anyone to mutate the current history
*/
getDrawingHistory(): CanvasWhiteboardUpdate[] {
return cloneDeep(this._updateHistory);
}

/**
* Unsubscribe from a given subscription if it is active
* @param subscription
Expand Down
6 changes: 6 additions & 0 deletions src/ng2-canvas-whiteboard.js

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

3 changes: 2 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
"target": "es5",
"skipLibCheck": true,
"types": [
"node"
"node",
"lodash"
]
},
"exclude": [
Expand Down

0 comments on commit d0527e9

Please sign in to comment.