'use strict'; const canvassed = require("canvassed"); const createRectangle = require("canvassed-rectangle"); const createText = require("canvassed-text"); module.exports = function createPlaceholderRectangle(options = {}) { let placeholderRectangle = canvassed.createCompositeObject(Object.assign({ type: "placeholderRectangle", objects: { rectangle: createRectangle({ width: options.width, height: options.height, x: 0, y: 0, fillColor: "rgb(205, 205, 205)", strokeColor: "rgb(74, 74, 74)", strokeWidth: 1 }), text: createText({ fontSize: 14, originX: "center", originY: "center", alignment: "center" }) }, drawOrder: ["rectangle", "text"], propertyMap: { fillColor: "rectangle", strokeColor: "rectangle", strokeWidth: "rectangle", textFillColor: "text.fillColor", textStrokeColor: "text.strokeColor", textStrokeWidth: "text.strokeWidth", alignment: "text", fontSize: "text", fontFamily: "text", fontWeight: "text", lineHeight: "text", tags: "text", text: "text", width: function setWidth(width) { return { text: {x: width / 2}, rectangle: {width: width} } }, height: function setHeight(height) { return { text: {y: height / 2}, rectangle: {height: height} } }, } }, options)); return placeholderRectangle; }