webfactorymk/ng2-canvas-whiteboard

I can't unregister the shape from the service.

Closed this issue · 0 comments

Hi!
I am trying to unregister FreeHandShape, LineShape, SmileyShape, StarShape in the service:

draw.component.ts

import { Component, OnInit } from '@angular/core';
import { 
  CanvasWhiteboardComponent, CanvasWhiteboardOptions, 
  CanvasWhiteboardService, CanvasWhiteboardShapeService, 
  CircleShape, FreeHandShape, LineShape, RectangleShape, SmileyShape, StarShape
} from 'ng2-canvas-whiteboard';

@Component({ ... })
export class DrawComponent implements OnInit {

  private canvasOptions: CanvasWhiteboardOptions;

  constructor(private _canvasWhiteboardService: CanvasWhiteboardService, private _canvasWhiteboardShapeService: CanvasWhiteboardShapeService) { 
    _canvasWhiteboardShapeService.unregisterShapes([CircleShape, FreeHandShape, LineShape, RectangleShape, SmileyShape, StarShape]);
  }

  ngOnInit() {
    this.canvasOptions = { ... };
  }

CircleShape and RectangleShape unregistered successfully.
For the rest I get an error:

"export 'FreeHandShape' was not found in 'ng2-canvas-whiteboard'
"export 'LineShape' was not found in 'ng2-canvas-whiteboard'
"export 'SmileyShape' was not found in 'ng2-canvas-whiteboard'
"export 'StarShape' was not found in 'ng2-canvas-whiteboard'

There is no export of these shapes in the ng2-canvas-whiteboard.ts. Maybe this is the reason?

Here is my repository: https://github.com/oduvanka/test-draw/tree/unregister-error