Add scalable image feature

This commit is contained in:
Dolan
2018-03-24 19:06:10 +00:00
parent a954c69458
commit 05816abc12
15 changed files with 179 additions and 55 deletions

View File

@ -9,7 +9,10 @@ import { GraphicFrameProperties } from "./graphic-frame/graphic-frame-properties
import { InlineAttributes } from "./inline-attributes";
export class Inline extends XmlComponent {
constructor(referenceId: number, dimensions: IMediaDataDimensions) {
private extent: Extent;
private graphic: Graphic;
constructor(referenceId: number, private dimensions: IMediaDataDimensions) {
super("wp:inline");
this.root.push(
@ -21,10 +24,21 @@ export class Inline extends XmlComponent {
}),
);
this.root.push(new Extent(dimensions.emus.x, dimensions.emus.y));
this.extent = new Extent(dimensions.emus.x, dimensions.emus.y);
this.graphic = new Graphic(referenceId, dimensions.emus.x, dimensions.emus.y);
this.root.push(this.extent);
this.root.push(new EffectExtent());
this.root.push(new DocProperties());
this.root.push(new GraphicFrameProperties());
this.root.push(new Graphic(referenceId, dimensions.emus.x, dimensions.emus.y));
this.root.push(this.graphic);
}
public scale(factorX: number, factorY: number): void {
const newX = this.dimensions.emus.x * factorX;
const newY = this.dimensions.emus.y * factorY;
this.extent.setXY(newX, newY);
this.graphic.setXY(newX, newY);
}
}