Add zIndex property to floating
This commit is contained in:
@ -22,6 +22,7 @@ const image4 = Media.addImage(doc, fs.readFileSync("./demo/images/parrots.bmp"))
|
|||||||
const image5 = Media.addImage(doc, fs.readFileSync("./demo/images/pizza.gif"));
|
const image5 = Media.addImage(doc, fs.readFileSync("./demo/images/pizza.gif"));
|
||||||
const image6 = Media.addImage(doc, fs.readFileSync("./demo/images/pizza.gif"), 200, 200, {
|
const image6 = Media.addImage(doc, fs.readFileSync("./demo/images/pizza.gif"), 200, 200, {
|
||||||
floating: {
|
floating: {
|
||||||
|
zIndex: 10,
|
||||||
horizontalPosition: {
|
horizontalPosition: {
|
||||||
offset: 1014400,
|
offset: 1014400,
|
||||||
},
|
},
|
||||||
@ -33,6 +34,7 @@ const image6 = Media.addImage(doc, fs.readFileSync("./demo/images/pizza.gif"), 2
|
|||||||
|
|
||||||
const image7 = Media.addImage(doc, fs.readFileSync("./demo/images/cat.jpg"), 200, 200, {
|
const image7 = Media.addImage(doc, fs.readFileSync("./demo/images/cat.jpg"), 200, 200, {
|
||||||
floating: {
|
floating: {
|
||||||
|
zIndex: 5,
|
||||||
horizontalPosition: {
|
horizontalPosition: {
|
||||||
relative: HorizontalPositionRelativeFrom.PAGE,
|
relative: HorizontalPositionRelativeFrom.PAGE,
|
||||||
align: HorizontalPositionAlign.RIGHT,
|
align: HorizontalPositionAlign.RIGHT,
|
||||||
|
@ -11,42 +11,38 @@ import { Extent } from "./../extent/extent";
|
|||||||
import { GraphicFrameProperties } from "./../graphic-frame/graphic-frame-properties";
|
import { GraphicFrameProperties } from "./../graphic-frame/graphic-frame-properties";
|
||||||
import { AnchorAttributes } from "./anchor-attributes";
|
import { AnchorAttributes } from "./anchor-attributes";
|
||||||
|
|
||||||
const defaultOptions: IFloating = {
|
|
||||||
allowOverlap: true,
|
|
||||||
behindDocument: false,
|
|
||||||
lockAnchor: false,
|
|
||||||
layoutInCell: true,
|
|
||||||
verticalPosition: {},
|
|
||||||
horizontalPosition: {},
|
|
||||||
};
|
|
||||||
|
|
||||||
export class Anchor extends XmlComponent {
|
export class Anchor extends XmlComponent {
|
||||||
constructor(mediaData: IMediaData, dimensions: IMediaDataDimensions, drawingOptions: IDrawingOptions) {
|
constructor(mediaData: IMediaData, dimensions: IMediaDataDimensions, drawingOptions: IDrawingOptions) {
|
||||||
super("wp:anchor");
|
super("wp:anchor");
|
||||||
|
|
||||||
const floating = {
|
const floating: IFloating = {
|
||||||
margins: {
|
margins: {
|
||||||
top: 0,
|
top: 0,
|
||||||
bottom: 0,
|
bottom: 0,
|
||||||
left: 0,
|
left: 0,
|
||||||
right: 0,
|
right: 0,
|
||||||
},
|
},
|
||||||
...defaultOptions,
|
allowOverlap: true,
|
||||||
|
behindDocument: false,
|
||||||
|
lockAnchor: false,
|
||||||
|
layoutInCell: true,
|
||||||
|
verticalPosition: {},
|
||||||
|
horizontalPosition: {},
|
||||||
...drawingOptions.floating,
|
...drawingOptions.floating,
|
||||||
};
|
};
|
||||||
|
|
||||||
this.root.push(
|
this.root.push(
|
||||||
new AnchorAttributes({
|
new AnchorAttributes({
|
||||||
distT: floating.margins.top || 0,
|
distT: floating.margins ? floating.margins.top || 0 : 0,
|
||||||
distB: floating.margins.bottom || 0,
|
distB: floating.margins ? floating.margins.bottom || 0 : 0,
|
||||||
distL: floating.margins.left || 0,
|
distL: floating.margins ? floating.margins.left || 0 : 0,
|
||||||
distR: floating.margins.right || 0,
|
distR: floating.margins ? floating.margins.right || 0 : 0,
|
||||||
simplePos: "0", // note: word doesn't fully support - so we use 0
|
simplePos: "0", // note: word doesn't fully support - so we use 0
|
||||||
allowOverlap: floating.allowOverlap === true ? "1" : "0",
|
allowOverlap: floating.allowOverlap === true ? "1" : "0",
|
||||||
behindDoc: floating.behindDocument === true ? "1" : "0",
|
behindDoc: floating.behindDocument === true ? "1" : "0",
|
||||||
locked: floating.lockAnchor === true ? "1" : "0",
|
locked: floating.lockAnchor === true ? "1" : "0",
|
||||||
layoutInCell: floating.layoutInCell === true ? "1" : "0",
|
layoutInCell: floating.layoutInCell === true ? "1" : "0",
|
||||||
relativeHeight: dimensions.emus.y,
|
relativeHeight: floating.zIndex ? floating.zIndex : dimensions.emus.y,
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
// http://officeopenxml.com/drwPicFloating-position.php
|
// http://officeopenxml.com/drwPicFloating-position.php
|
||||||
|
// http://officeopenxml.com/drwPicFloating.php
|
||||||
import { ITextWrapping } from "../text-wrap";
|
import { ITextWrapping } from "../text-wrap";
|
||||||
|
|
||||||
export enum HorizontalPositionRelativeFrom {
|
export enum HorizontalPositionRelativeFrom {
|
||||||
@ -67,4 +68,5 @@ export interface IFloating {
|
|||||||
readonly layoutInCell?: boolean;
|
readonly layoutInCell?: boolean;
|
||||||
readonly margins?: IMargins;
|
readonly margins?: IMargins;
|
||||||
readonly wrap?: ITextWrapping;
|
readonly wrap?: ITextWrapping;
|
||||||
|
readonly zIndex?: number;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user