UNPKG

@core-graphics/rect

Version:
204 lines (155 loc) 8.13 kB
'use strict'; Object.defineProperty(exports, '__esModule', { value: true }); var lite_dist_coreGraphicsRectLite = require('./lite-96ccef1c.cjs.prod.js'); var align_dist_coreGraphicsRectAlign = require('../align/dist/core-graphics-rect-align.cjs.prod.js'); var contains_dist_coreGraphicsRectContains = require('../contains/dist/core-graphics-rect-contains.cjs.prod.js'); var distance_dist_coreGraphicsRectDistance = require('../distance/dist/core-graphics-rect-distance.cjs.prod.js'); var intersection_dist_coreGraphicsRectIntersection = require('../intersection/dist/core-graphics-rect-intersection.cjs.prod.js'); var operations_dist_coreGraphicsRectOperations = require('../operations/dist/core-graphics-rect-operations.cjs.prod.js'); var fromWindow = require('./from-window-b608682e.cjs.prod.js'); var fromPoints = require('./from-points-ed59078a.cjs.prod.js'); require('@core-graphics/point'); require('@core-graphics/size'); require('./createForOfIteratorHelper-569e18e2.cjs.prod.js'); require('./unsupportedIterableToArray-cb273b94.cjs.prod.js'); function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } function _possibleConstructorReturn(self, call) { if (call && (typeof call === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } /** * A structure that contains the location and dimensions of a rectangle. */ var Rect = /*#__PURE__*/function (_RectLite) { _inherits(Rect, _RectLite); var _super = _createSuper(Rect); function Rect() { var _this; lite_dist_coreGraphicsRectLite._classCallCheck(this, Rect); for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } _this = _super.call.apply(_super, [this].concat(args)); lite_dist_coreGraphicsRectLite._defineProperty(_assertThisInitialized(_this), "egdeInset", function (inset) { return _this.set(operations_dist_coreGraphicsRectOperations.egdeInset(_assertThisInitialized(_this), inset)); }); lite_dist_coreGraphicsRectLite._defineProperty(_assertThisInitialized(_this), "inset", function (value) { return _this.set(operations_dist_coreGraphicsRectOperations.inset(_assertThisInitialized(_this), value)); }); lite_dist_coreGraphicsRectLite._defineProperty(_assertThisInitialized(_this), "shift", function (offset) { return _this.set(operations_dist_coreGraphicsRectOperations.shift(_assertThisInitialized(_this), offset)); }); lite_dist_coreGraphicsRectLite._defineProperty(_assertThisInitialized(_this), "containsPoint", function (point) { return contains_dist_coreGraphicsRectContains.containsPoint(_assertThisInitialized(_this), point); }); lite_dist_coreGraphicsRectLite._defineProperty(_assertThisInitialized(_this), "containsRect", function (rectOrValue) { return contains_dist_coreGraphicsRectContains.containsRect(_assertThisInitialized(_this), rectOrValue); }); lite_dist_coreGraphicsRectLite._defineProperty(_assertThisInitialized(_this), "contains", function (pointOrRect) { return contains_dist_coreGraphicsRectContains.contains(_assertThisInitialized(_this), pointOrRect); }); lite_dist_coreGraphicsRectLite._defineProperty(_assertThisInitialized(_this), "intersection", function (rect) { return _this.set(intersection_dist_coreGraphicsRectIntersection.intersection(_assertThisInitialized(_this), rect)); }); lite_dist_coreGraphicsRectLite._defineProperty(_assertThisInitialized(_this), "intersects", function (rect) { return intersection_dist_coreGraphicsRectIntersection.intersects(_assertThisInitialized(_this), rect); }); lite_dist_coreGraphicsRectLite._defineProperty(_assertThisInitialized(_this), "distanceFromPoint", function (point) { return distance_dist_coreGraphicsRectDistance.distanceFromPoint(_assertThisInitialized(_this), point); }); lite_dist_coreGraphicsRectLite._defineProperty(_assertThisInitialized(_this), "distanceFromRect", function (rectOrValue) { return distance_dist_coreGraphicsRectDistance.distanceFromRect(_assertThisInitialized(_this), rectOrValue); }); lite_dist_coreGraphicsRectLite._defineProperty(_assertThisInitialized(_this), "horizontalAlignTo", function (rect, align) { return _this.set(align_dist_coreGraphicsRectAlign.alignHorizontal(_assertThisInitialized(_this), rect, align)); }); lite_dist_coreGraphicsRectLite._defineProperty(_assertThisInitialized(_this), "verticalAlignTo", function (rect, align) { return _this.set(align_dist_coreGraphicsRectAlign.alignVertical(_assertThisInitialized(_this), rect, align)); }); lite_dist_coreGraphicsRectLite._defineProperty(_assertThisInitialized(_this), "alignTo", function (rect, opts) { return _this.set(align_dist_coreGraphicsRectAlign.align(_assertThisInitialized(_this), rect, opts)); }); return _this; } return Rect; }(lite_dist_coreGraphicsRectLite.Rect); lite_dist_coreGraphicsRectLite._defineProperty(Rect, "fromPoints", function () { return new Rect(fromPoints.fromPoints.apply(void 0, arguments)); }); lite_dist_coreGraphicsRectLite._defineProperty(Rect, "create", function (rect) { return new Rect(rect); }); lite_dist_coreGraphicsRectLite._defineProperty(Rect, "fromElement", function (el) { var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; return new Rect(fromWindow.fromElement(el, opts)); }); lite_dist_coreGraphicsRectLite._defineProperty(Rect, "fromWindow", function (win) { var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; return new Rect(fromWindow.fromWindow(win, opts)); }); lite_dist_coreGraphicsRectLite._defineProperty(Rect, "fromRange", function (range) { return new Rect(fromWindow.fromRange(range)); }); lite_dist_coreGraphicsRectLite._defineProperty(Rect, "intersection", intersection_dist_coreGraphicsRectIntersection.intersection); lite_dist_coreGraphicsRectLite._defineProperty(Rect, "collisions", intersection_dist_coreGraphicsRectIntersection.collisions); lite_dist_coreGraphicsRectLite._defineProperty(Rect, "union", fromWindow.union); lite_dist_coreGraphicsRectLite._defineProperty(Rect, "intersects", intersection_dist_coreGraphicsRectIntersection.intersects); exports.Rect = Rect;