UNPKG

@adobe/uxp-optimized

Version:

Library of react components optimized for Adobe's Unified Extensibility Platform

21 lines (20 loc) 735 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); class Rectangle { constructor(x, y, width, height) { this.x = x; this.y = y; this.width = width; this.height = height; } add(margin) { return new Rectangle(this.x - margin.left, this.y - margin.top, this.width + margin.left + margin.right, this.height + margin.top + margin.bottom); } subtract(margin) { return new Rectangle(this.x + margin.left, this.y + margin.top, this.width - margin.left - margin.right, this.height - margin.top - margin.bottom); } toString() { return `Rectangle(${this.x},${this.y},${this.width},${this.height})`; } } exports.default = Rectangle;