Files
rough/bin/canvas-async.js
2018-06-18 13:08:58 -07:00

67 lines
2.0 KiB
JavaScript

import { RoughCanvas } from './canvas';
import { RoughGeneratorAsync } from './generator-async';
export class RoughCanvasAsync extends RoughCanvas {
constructor(canvas, config) {
super(canvas, config);
this.genAsync = new RoughGeneratorAsync(config || null, this.canvas);
}
// @ts-ignore
get generator() {
return this.genAsync;
}
// @ts-ignore
async line(x1, y1, x2, y2, options) {
const d = await this.genAsync.line(x1, y1, x2, y2, options);
this.draw(d);
return d;
}
// @ts-ignore
async rectangle(x, y, width, height, options) {
const d = await this.genAsync.rectangle(x, y, width, height, options);
this.draw(d);
return d;
}
// @ts-ignore
async ellipse(x, y, width, height, options) {
const d = await this.genAsync.ellipse(x, y, width, height, options);
this.draw(d);
return d;
}
// @ts-ignore
async circle(x, y, diameter, options) {
const d = await this.genAsync.circle(x, y, diameter, options);
this.draw(d);
return d;
}
// @ts-ignore
async linearPath(points, options) {
const d = await this.genAsync.linearPath(points, options);
this.draw(d);
return d;
}
// @ts-ignore
async polygon(points, options) {
const d = await this.genAsync.polygon(points, options);
this.draw(d);
return d;
}
// @ts-ignore
async arc(x, y, width, height, start, stop, closed = false, options) {
const d = await this.genAsync.arc(x, y, width, height, start, stop, closed, options);
this.draw(d);
return d;
}
// @ts-ignore
async curve(points, options) {
const d = await this.genAsync.curve(points, options);
this.draw(d);
return d;
}
// @ts-ignore
async path(d, options) {
const drawing = await this.genAsync.path(d, options);
this.draw(drawing);
return drawing;
}
}