Sha256: 2b564fd81160af94d660e567dafd778c7d3d5c2c0d18eee6563a3dd825d3d6e6
Contents?: true
Size: 1.66 KB
Versions: 26
Compression:
Stored size: 1.66 KB
Contents
"use strict"; const DOMRectReadOnly = require("../generated/DOMRectReadOnly"); class DOMRectReadOnlyImpl { constructor(globalObject, [x = 0, y = 0, width = 0, height = 0]) { this._globalObject = globalObject; this._x = x; this._y = y; this._width = width; this._height = height; } static fromRect(globalObject, other) { return DOMRectReadOnly.createImpl(globalObject, [other.x, other.y, other.width, other.height]); } get x() { return this._x; } get y() { return this._y; } get width() { return this._width; } get height() { return this._height; } get top() { const { height, y } = this; // We use Math.min's built-in NaN handling: https://github.com/w3c/fxtf-drafts/issues/222 return Math.min(y, y + height); } get right() { const { width, x } = this; // We use Math.max's built-in NaN handling: https://github.com/w3c/fxtf-drafts/issues/222 return Math.max(x, x + width); } get bottom() { const { height, y } = this; // We use Math.max's built-in NaN handling: https://github.com/w3c/fxtf-drafts/issues/222 return Math.max(y, y + height); } get left() { const { width, x } = this; // We use Math.min's built-in NaN handling: https://github.com/w3c/fxtf-drafts/issues/222 return Math.min(x, x + width); } // Could be removed after https://github.com/jsdom/webidl2js/issues/185 gets fixed. toJSON() { return { x: this.x, y: this.y, width: this.width, height: this.height, top: this.top, right: this.right, bottom: this.bottom, left: this.left }; } } exports.implementation = DOMRectReadOnlyImpl;
Version data entries
26 entries across 26 versions & 1 rubygems