2017-12-19 23:13:11 +00:00
|
|
|
import { Drawing } from "../../drawing";
|
2017-12-30 21:18:55 +00:00
|
|
|
import { IMediaData } from "../../media/data";
|
2017-03-12 23:31:43 +00:00
|
|
|
import { Run } from "../run";
|
|
|
|
|
|
|
|
export class PictureRun extends Run {
|
2018-03-24 19:06:10 +00:00
|
|
|
private drawing: Drawing;
|
|
|
|
|
2017-12-30 21:18:55 +00:00
|
|
|
constructor(imageData: IMediaData) {
|
2017-03-12 23:31:43 +00:00
|
|
|
super();
|
2017-04-01 12:18:23 +01:00
|
|
|
|
|
|
|
if (imageData === undefined) {
|
|
|
|
throw new Error("imageData cannot be undefined");
|
|
|
|
}
|
|
|
|
|
2018-03-24 19:06:10 +00:00
|
|
|
this.drawing = new Drawing(imageData);
|
|
|
|
|
|
|
|
this.root.push(this.drawing);
|
|
|
|
}
|
|
|
|
|
|
|
|
public scale(factorX: number, factorY?: number): void {
|
|
|
|
if (!factorX) {
|
|
|
|
factorX = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!factorY) {
|
|
|
|
factorY = factorX;
|
|
|
|
}
|
|
|
|
|
|
|
|
this.drawing.scale(factorX, factorY);
|
2017-03-12 23:31:43 +00:00
|
|
|
}
|
|
|
|
}
|