Source: model/ModelRectangle.js

/**
 * @author    Wolfgang Kowarschick <kowa@hs-augsburg.de>
 * @copyright 2017 - 2018
 * @license   CC-BY-NC-SA-4.0
 */

/**
 * @class
 * @property {number} x      - the x position of the rectangle
 * @property {number} y      - the y position of the rectangle
 *
 * @property {number} width  - the width of the rectangle
 * @property {number} height - the height of the rectangle
 */
class ModelRectangle
{ /**
   * @param {Object} [p_config]
   * @param {number} [p_config.x      = 0]
   * @param {number} [p_config.y      = 0]
   * @param {number} [p_config.width  = 0]
   * @param {number} [p_config.height = 0]
   */
  constructor({     x: p_x     = 0,      y: p_y      = 0,
                width: p_width = 0, height: p_height = 0
              } = {}
             )
  { this.xConfig     = p_x;     this.yConfig      = p_y;
    this.widthConfig = p_width; this.heightConfig = p_height;
  
    this.reset();
  }
  
  /** Resets the model to its config values. */
  reset()
  { this.x     = this.xConfig;     this.y      = this.yConfig;
    this.width = this.widthConfig; this.height = this.heightConfig;
  }
}

export {ModelRectangle};