2018-12-21 01:39:20 +00:00
|
|
|
import { IMediaData } from "file/media";
|
2018-03-24 19:06:10 +00:00
|
|
|
import { XmlAttributeComponent, XmlComponent } from "file/xml-components";
|
2018-12-21 01:39:20 +00:00
|
|
|
|
2018-03-24 19:06:10 +00:00
|
|
|
import { GraphicData } from "./graphic-data";
|
|
|
|
|
|
|
|
interface IGraphicProperties {
|
2018-11-02 02:51:57 +00:00
|
|
|
readonly a: string;
|
2018-03-24 19:06:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
class GraphicAttributes extends XmlAttributeComponent<IGraphicProperties> {
|
2018-11-02 02:51:57 +00:00
|
|
|
protected readonly xmlKeys = {
|
2018-03-24 19:06:10 +00:00
|
|
|
a: "xmlns:a",
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
export class Graphic extends XmlComponent {
|
2018-08-07 01:38:15 +01:00
|
|
|
private readonly data: GraphicData;
|
2018-03-24 19:06:10 +00:00
|
|
|
|
2018-12-21 01:39:20 +00:00
|
|
|
constructor(mediaData: IMediaData, x: number, y: number) {
|
2018-03-24 19:06:10 +00:00
|
|
|
super("a:graphic");
|
|
|
|
this.root.push(
|
|
|
|
new GraphicAttributes({
|
|
|
|
a: "http://schemas.openxmlformats.org/drawingml/2006/main",
|
|
|
|
}),
|
|
|
|
);
|
|
|
|
|
2018-12-21 01:39:20 +00:00
|
|
|
this.data = new GraphicData(mediaData, x, y);
|
2018-03-24 19:06:10 +00:00
|
|
|
|
|
|
|
this.root.push(this.data);
|
|
|
|
}
|
|
|
|
|
|
|
|
public setXY(x: number, y: number): void {
|
|
|
|
this.data.setXY(x, y);
|
|
|
|
}
|
|
|
|
}
|