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

Commit 2701d31

Browse files
committed
Fix bug with production build minifying name of constructors on shapes
1 parent d0527e9 commit 2701d31

26 files changed

+963
-782
lines changed

README.md

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22

33

44
## Canvas version changes
5+
#### v3.0.4 Fixes a bug with production build and recognition of shape names by adding an abstract method in the base Shape class.
6+
7+
58
#### v3.0.0 Removes the `rxjs-compat` library and adds `rxjs^6`. This means that older versions will not be supported if they upgrade to `ng2-canvas-whiteboard^3.0.0`.
69
#### *This version also changes the way of how this library is built and made ready for publish.*
710

@@ -129,7 +132,8 @@ emitted by the **onBatchUpdate** emitter. If received, the user can then manipul
129132
The time in milliseconds that a batch update should be sent after drawing.
130133
131134
##### `imageUrl: string` (optional)
132-
The path to the image. If not specified, the drawings will be placed on the background color of the canvas
135+
The path to the image. If not specified, the drawings will be placed on the background color of the canvas.
136+
This path can either be a base64 string or an actual path to a resource
133137
134138
##### `aspectRatio: number` (optional)
135139
If specified, the canvas will be resized according to this ratio
@@ -277,6 +281,7 @@ Each shape is made of a starting position point of type ```CanvasWhiteboardPoint
277281
which may be different for each shape, and it's of type ```CanvasWhiteboardShapeOptions```.
278282
279283
Each predefined shape must know how to:
284+
- Return the name of the shape (should be the same as the name of the class)
280285
- Draw itself given a canvas context
281286
- Draw it's preview given a canvas context
282287
- Update itself given a ```CanvasWhiteboardUpdate```
@@ -297,6 +302,19 @@ class AppComponent {
297302
}
298303
299304
export class RandomShape extends CanvasWhiteboardShape {
305+
linePositions: Array<number>;
306+
307+
constructor(positionPoint?: CanvasWhiteboardPoint, options?: CanvasWhiteboardShapeOptions) {
308+
// Optional constructor if you need some additional setup
309+
super(positionPoint, options);
310+
this.linePositions = [];
311+
}
312+
313+
getShapeName(): string {
314+
// Abstract method which should return a string with the shape name
315+
// Should be the same as the class name
316+
return 'RandomShape';
317+
}
300318
301319
draw(context: CanvasRenderingContext2D): any {
302320
// Tell the canvas how to draw your shape here

dist/README.md

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22

33

44
## Canvas version changes
5+
#### v3.0.4 Fixes a bug with production build and recognition of shape names by adding an abstract method in the base Shape class.
6+
7+
58
#### v3.0.0 Removes the `rxjs-compat` library and adds `rxjs^6`. This means that older versions will not be supported if they upgrade to `ng2-canvas-whiteboard^3.0.0`.
69
#### *This version also changes the way of how this library is built and made ready for publish.*
710

@@ -129,7 +132,8 @@ emitted by the **onBatchUpdate** emitter. If received, the user can then manipul
129132
The time in milliseconds that a batch update should be sent after drawing.
130133
131134
##### `imageUrl: string` (optional)
132-
The path to the image. If not specified, the drawings will be placed on the background color of the canvas
135+
The path to the image. If not specified, the drawings will be placed on the background color of the canvas.
136+
This path can either be a base64 string or an actual path to a resource
133137
134138
##### `aspectRatio: number` (optional)
135139
If specified, the canvas will be resized according to this ratio
@@ -277,6 +281,7 @@ Each shape is made of a starting position point of type ```CanvasWhiteboardPoint
277281
which may be different for each shape, and it's of type ```CanvasWhiteboardShapeOptions```.
278282
279283
Each predefined shape must know how to:
284+
- Return the name of the shape (should be the same as the name of the class)
280285
- Draw itself given a canvas context
281286
- Draw it's preview given a canvas context
282287
- Update itself given a ```CanvasWhiteboardUpdate```
@@ -297,6 +302,19 @@ class AppComponent {
297302
}
298303
299304
export class RandomShape extends CanvasWhiteboardShape {
305+
linePositions: Array<number>;
306+
307+
constructor(positionPoint?: CanvasWhiteboardPoint, options?: CanvasWhiteboardShapeOptions) {
308+
// Optional constructor if you need some additional setup
309+
super(positionPoint, options);
310+
this.linePositions = [];
311+
}
312+
313+
getShapeName(): string {
314+
// Abstract method which should return a string with the shape name
315+
// Should be the same as the class name
316+
return 'RandomShape';
317+
}
300318
301319
draw(context: CanvasRenderingContext2D): any {
302320
// Tell the canvas how to draw your shape here

dist/bundles/ng2-canvas-whiteboard.umd.js

Lines changed: 41 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/bundles/ng2-canvas-whiteboard.umd.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/modules/ng2-canvas-whiteboard.es5.js

Lines changed: 41 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)