diff --git a/projects/ng2-canvas-whiteboard-example/src/app/app.component.ts b/projects/ng2-canvas-whiteboard-example/src/app/app.component.ts index 87b13c59..139295c6 100644 --- a/projects/ng2-canvas-whiteboard-example/src/app/app.component.ts +++ b/projects/ng2-canvas-whiteboard-example/src/app/app.component.ts @@ -43,7 +43,9 @@ export class AppComponent { const updates: Array = parsedStorageUpdates.map(updateJSON => CanvasWhiteboardUpdate.deserializeJson(updateJSON)); // Draw the updates onto the canvas - this.canvasWhiteboardService.drawCanvas(updates); + if (this.canvasWhiteboardComponent.getDrawingHistory().length != updates.length) { + this.canvasWhiteboardService.drawCanvas(updates); + } } } diff --git a/projects/ng2-canvas-whiteboard/src/lib/canvas-whiteboard-update.model.ts b/projects/ng2-canvas-whiteboard/src/lib/canvas-whiteboard-update.model.ts index 37199620..3df1be41 100644 --- a/projects/ng2-canvas-whiteboard/src/lib/canvas-whiteboard-update.model.ts +++ b/projects/ng2-canvas-whiteboard/src/lib/canvas-whiteboard-update.model.ts @@ -48,8 +48,8 @@ export class CanvasWhiteboardUpdate { stringify(): string { const objectToSerialize = { - x: this.x.toFixed(3), - y: this.y.toFixed(3), + x: Number(this.x).toFixed(3), + y: Number(this.y).toFixed(3), type: this.type, uuid: this.UUID, selectedShape: this.selectedShape