Skip to content

Commit

Permalink
docs(demo): remove canvas from demo
Browse files Browse the repository at this point in the history
  • Loading branch information
mattlewis92 committed Aug 30, 2021
1 parent d9c4add commit 42df972
Showing 1 changed file with 2 additions and 27 deletions.
29 changes: 2 additions & 27 deletions projects/demo/app/demo.component.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { AfterViewInit, Component, ElementRef, ViewChild } from '@angular/core';
import { Component } from '@angular/core';
import { ResizeEvent } from 'angular-resizable-element';

@Component({
Expand All @@ -20,11 +20,6 @@ import { ResizeEvent } from 'angular-resizable-element';
box-sizing: border-box; // required for the enableGhostResize option to work
}
canvas {
width: 150px;
height: 100px;
}
.resize-handle-top,
.resize-handle-bottom {
position: absolute;
Expand Down Expand Up @@ -70,8 +65,6 @@ import { ResizeEvent } from 'angular-resizable-element';
[resizeSnapGrid]="{ left: 50, right: 50 }"
(resizeEnd)="onResizeEnd($event)"
>
<div>HTML text example</div>
<canvas #canvas></canvas>
<div
class="resize-handle-top"
mwlResizeHandle
Expand All @@ -96,10 +89,7 @@ import { ResizeEvent } from 'angular-resizable-element';
</div>
`,
})
export class DemoComponent implements AfterViewInit {
@ViewChild('canvas')
public canvas: ElementRef<HTMLCanvasElement>;

export class DemoComponent {
public style: object = {};

validate(event: ResizeEvent): boolean {
Expand All @@ -124,19 +114,4 @@ export class DemoComponent implements AfterViewInit {
height: `${event.rectangle.height}px`,
};
}

drawCanvas(): void {
const ctx = this.canvas.nativeElement.getContext('2d');
if (ctx) {
ctx.font = '28px serif';
ctx.fillText('Canvas text example', 50, 50);
ctx.strokeStyle = 'green';
ctx.lineWidth = 5;
ctx.strokeRect(30, 10, 260, 60);
}
}

ngAfterViewInit(): void {
this.drawCanvas();
}
}

0 comments on commit 42df972

Please sign in to comment.