Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 | 1x 1x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 1x 4x 4x 1x 1x 4x 4x 4x 4x 4x 4x 4x 1x 4x 4x 1x | import { removeUndefinedFromObj } from "./utils"; export type Position = "topLeft" | "topRight" | "bottomLeft" | "bottomRight"; export type Watermark = TextWatermark | ImageWatermark; export interface TextWatermarkOptions { fontSize?: number; fontColor?: string; opacity?: number; position?: Position; } export interface ImageWatermarkOptions { url?: string; uploaded_image_name?: string; width?: number; height?: number; opacity?: number; position?: Position; } export class ImageWatermark implements ImageWatermarkOptions { path?: string; image_name?: string; width?: number; height?: number; opacity?: number; position: Position; constructor(Iopts: ImageWatermarkOptions = {}) { this.position = opts.position || "bottomRight"; Eif (opts.height) { this.height = opts.height; } Eif (opts.width) { this.width = opts.width; } Eif (opts.url) { this.path = opts.url; } Iif (opts.uploaded_image_name) { this.image_name = opts.uploaded_image_name; } Eif (opts.url) { this.path = opts.url; } Iif (opts.opacity === 0) { this.opacity = 0; } else { this.opacity = opts.opacity || 0.9; } } toJSON() { const ret = { width: this.width, height: this.height, imageName: this.image_name, imageUrl: this.path, opacity: `${this.opacity}`, position: this.position, }; return removeUndefinedFromObj(ret); } } export class TextWatermark implements TextWatermarkOptions { text: string; fontSize?: number; fontColor?: string; opacity?: number; position: Position; constructor(text: string, Iopts: TextWatermarkOptions = {}) { this.text = text; this.fontSize = opts.fontSize || 12; this.fontColor = opts.fontColor || "white"; this.position = opts.position || "bottomRight"; Iif (opts.opacity === 0) { this.opacity = 0; } else { this.opacity = opts.opacity || 0.9; } } toJSON() { const ret = { fontSize: `${this.fontSize}`, text: this.text, fontColor: this.fontColor, opacity: `${this.opacity}`, position: this.position, }; return removeUndefinedFromObj(ret); } } |