Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

parsegraph-rect

Package Overview
Dependencies
Maintainers
2
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

parsegraph-rect - npm Package Compare versions

Comparing version 1.5.1-dev to 1.5.1

79

parsegraph-rect/dist/src/index.js

@@ -1,78 +0,1 @@

/*
* ATTENTION: An "eval-source-map" devtool has been used.
* This devtool is neither made for production nor for readable output files.
* It uses "eval()" calls to create a separate source file with attached SourceMaps in the browser devtools.
* If you are trying to read the output file, select a different devtool (https://webpack.js.org/configuration/devtool/)
* or disable the default devtool with "devtool: false".
* If you are looking for production-ready output files, see mode: "production" (https://webpack.js.org/configuration/mode/).
*/
(function webpackUniversalModuleDefinition(root, factory) {
if(typeof exports === 'object' && typeof module === 'object')
module.exports = factory();
else if(typeof define === 'function' && define.amd)
define([], factory);
else if(typeof exports === 'object')
exports["parsegraph_rect"] = factory();
else
root["parsegraph_rect"] = factory();
})(this, function() {
return /******/ (() => { // webpackBootstrap
/******/ "use strict";
/******/ var __webpack_modules__ = ({
/***/ "./src/index.ts":
/*!**********************!*\
!*** ./src/index.ts ***!
\**********************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* eslint-disable require-jsdoc */\nvar Rect =\n/** @class */\nfunction () {\n function Rect(x, y, width, height) {\n this._x = x;\n this._y = y;\n this._width = width;\n this._height = height;\n }\n\n Rect.prototype.isNaN = function () {\n return isNaN(this._x) || isNaN(this._y) || isNaN(this._width) || isNaN(this._height);\n };\n\n Rect.prototype.toNaN = function () {\n this._x = NaN;\n this._y = NaN;\n this._width = NaN;\n this._height = NaN;\n };\n\n Rect.prototype.clear = function () {\n this.toNaN();\n };\n\n Rect.prototype.reset = function () {\n this.toNaN();\n };\n\n Rect.prototype.x = function () {\n return this._x;\n };\n\n Rect.prototype.setX = function (x) {\n this._x = x;\n };\n\n Rect.prototype.y = function () {\n return this._y;\n };\n\n Rect.prototype.setY = function (y) {\n this._y = y;\n };\n\n Rect.prototype.clone = function (target) {\n if (target) {\n this.copy(target);\n return target;\n }\n\n return new Rect(this.x(), this.y(), this.width(), this.height());\n };\n\n Rect.prototype.copy = function (dest) {\n if (!dest) {\n return this.clone();\n }\n\n dest.setX(this.x());\n dest.setY(this.y());\n dest.setWidth(this.width());\n dest.setHeight(this.height());\n return dest;\n };\n\n Rect.prototype.translate = function (x, y) {\n this.setX(this.x() + x);\n this.setY(this.y() + y);\n };\n\n Rect.prototype.scale = function (sx, sy) {\n if (arguments.length < 2) {\n sy = sx;\n }\n\n this.setX(this.x() * sx);\n this.setY(this.y() * sy);\n this.setWidth(this.width() * sx);\n this.setHeight(this.height() * sy);\n };\n\n Rect.prototype.height = function () {\n return this._height;\n };\n\n Rect.prototype.setHeight = function (height) {\n this._height = height;\n };\n\n Rect.prototype.width = function () {\n return this._width;\n };\n\n Rect.prototype.w = function () {\n return this.width();\n };\n\n Rect.prototype.h = function () {\n return this.height();\n };\n\n Rect.prototype.setWidth = function (width) {\n this._width = width;\n };\n\n Rect.prototype.toString = function () {\n return \"[Rect x=\" + this.x() + \", y=\" + this.y() + \", w=\" + this.width() + \", h=\" + this.height() + \"]\";\n };\n\n Rect.prototype.vMin = function () {\n return this.y() - this.height() / 2;\n };\n\n Rect.prototype.vMax = function () {\n return this.y() + this.height() / 2;\n };\n\n Rect.prototype.hMin = function () {\n return this.x() - this.width() / 2;\n };\n\n Rect.prototype.hMax = function () {\n return this.x() + this.width() / 2;\n };\n\n Rect.prototype.include = function (bx, by, bwidth, bheight) {\n if (this.isNaN()) {\n this._x = bx;\n this._y = by;\n this._width = bwidth;\n this._height = bheight;\n return;\n }\n\n var ax = this._x;\n var ay = this._y;\n var awidth = this._width;\n var aheight = this._height;\n var leftEdge = Math.min(ax - awidth / 2, bx - bwidth / 2);\n var rightEdge = Math.max(ax + awidth / 2, bx + bwidth / 2);\n var topEdge = Math.min(ay - aheight / 2, by - bheight / 2);\n var bottomEdge = Math.max(ay + aheight / 2, by + bheight / 2);\n var w = rightEdge - leftEdge;\n var h = bottomEdge - topEdge;\n var x = leftEdge + w / 2;\n var y = topEdge + h / 2;\n this._x = x;\n this._y = y;\n this._width = w;\n this._height = h;\n };\n\n return Rect;\n}();\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (Rect);//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiLi9zcmMvaW5kZXgudHMuanMiLCJtYXBwaW5ncyI6Ijs7OztBQUFBO0FBQ0EsSUFBSUEsSUFBSTtBQUFHO0FBQWUsWUFBWTtBQUNsQyxXQUFTQSxJQUFULENBQWNDLENBQWQsRUFBaUJDLENBQWpCLEVBQW9CQyxLQUFwQixFQUEyQkMsTUFBM0IsRUFBbUM7QUFDL0IsU0FBS0MsRUFBTCxHQUFVSixDQUFWO0FBQ0EsU0FBS0ssRUFBTCxHQUFVSixDQUFWO0FBQ0EsU0FBS0ssTUFBTCxHQUFjSixLQUFkO0FBQ0EsU0FBS0ssT0FBTCxHQUFlSixNQUFmO0FBQ0g7O0FBQ0RKLEVBQUFBLElBQUksQ0FBQ1MsU0FBTCxDQUFlQyxLQUFmLEdBQXVCLFlBQVk7QUFDL0IsV0FBUUEsS0FBSyxDQUFDLEtBQUtMLEVBQU4sQ0FBTCxJQUNKSyxLQUFLLENBQUMsS0FBS0osRUFBTixDQURELElBRUpJLEtBQUssQ0FBQyxLQUFLSCxNQUFOLENBRkQsSUFHSkcsS0FBSyxDQUFDLEtBQUtGLE9BQU4sQ0FIVDtBQUlILEdBTEQ7O0FBTUFSLEVBQUFBLElBQUksQ0FBQ1MsU0FBTCxDQUFlRSxLQUFmLEdBQXVC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Y3Rpb24gKCkge1xuICAgICAgICByZXR1cm4gdGhpcy5fd2lkdGg7XG4gICAgfTtcbiAgICBSZWN0LnByb3RvdHlwZS53ID0gZnVuY3Rpb24gKCkge1xuICAgICAgICByZXR1cm4gdGhpcy53aWR0aCgpO1xuICAgIH07XG4gICAgUmVjdC5wcm90b3R5cGUuaCA9IGZ1bmN0aW9uICgpIHtcbiAgICAgICAgcmV0dXJuIHRoaXMuaGVpZ2h0KCk7XG4gICAgfTtcbiAgICBSZWN0LnByb3RvdHlwZS5zZXRXaWR0aCA9IGZ1bmN0aW9uICh3aWR0aCkge1xuICAgICAgICB0aGlzLl93aWR0aCA9IHdpZHRoO1xuICAgIH07XG4gICAgUmVjdC5wcm90b3R5cGUudG9TdHJpbmcgPSBmdW5jdGlvbiAoKSB7XG4gICAgICAgIHJldHVybiAoXCJbUmVjdCB4PVwiICtcbiAgICAgICAgICAgIHRoaXMueCgpICtcbiAgICAgICAgICAgIFwiLCB5PVwiICtcbiAgICAgICAgICAgIHRoaXMueSgpICtcbiAgICAgICAgICAgIFwiLCB3PVwiICtcbiAgICAgICAgICAgIHRoaXMud2lkdGgoKSArXG4gICAgICAgICAgICBcIiwgaD1cIiArXG4gICAgICAgICAgICB0aGlzLmhlaWdodCgpICtcbiAgICAgICAgICAgIFwiXVwiKTtcbiAgICB9O1xuICAgIFJlY3QucHJvdG90eXBlLnZNaW4gPSBmdW5jdGlvbiAoKSB7XG4gICAgICAgIHJldHVybiB0aGlzLnkoKSAtIHRoaXMuaGVpZ2h0KCkgLyAyO1xuICAgIH07XG4gICAgUmVjdC5wcm90b3R5cGUudk1heCA9IGZ1bmN0aW9uICgpIHtcbiAgICAgICAgcmV0dXJuIHRoaXMueSgpICsgdGhpcy5oZWlnaHQoKSAvIDI7XG4gICAgfTtcbiAgICBSZWN0LnByb3RvdHlwZS5oTWluID0gZnVuY3Rpb24gKCkge1xuICAgICAgICByZXR1cm4gdGhpcy54KCkgLSB0aGlzLndpZHRoKCkgLyAy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9wRWRnZTtcbiAgICAgICAgdmFyIHggPSBsZWZ0RWRnZSArIHcgLyAyO1xuICAgICAgICB2YXIgeSA9IHRvcEVkZ2UgKyBoIC8gMjtcbiAgICAgICAgdGhpcy5feCA9IHg7XG4gICAgICAgIHRoaXMuX3kgPSB5O1xuICAgICAgICB0aGlzLl93aWR0aCA9IHc7XG4gICAgICAgIHRoaXMuX2hlaWdodCA9IGg7XG4gICAgfTtcbiAgICByZXR1cm4gUmVjdDtcbn0oKSk7XG5leHBvcnQgZGVmYXVsdCBSZWN0O1xuIl0sIm5hbWVzIjpbIlJlY3QiLCJ4IiwieSIsIndpZHRoIiwiaGVpZ2h0IiwiX3giLCJfeSIsIl93aWR0aCIsIl9oZWlnaHQiLCJwcm90b3R5cGUiLCJpc05hTiIsInRvTmFOIiwiTmFOIiwiY2xlYXIiLCJyZXNldCIsInNldFgiLCJzZXRZIiwiY2xvbmUiLCJ0YXJnZXQiLCJjb3B5IiwiZGVzdCIsInNldFdpZHRoIiwic2V0SGVpZ2h0IiwidHJhbnNsYXRlIiwic2NhbGUiLCJzeCIsInN5IiwiYXJndW1lbnRzIiwibGVuZ3RoIiwidyIsImgiLCJ0b1N0cmluZyIsInZNaW4iLCJ2TWF4IiwiaE1pbiIsImhNYXgiLCJpbmNsdWRlIiwiYngiLCJieSIsImJ3aWR0aCIsImJoZWlnaHQiLCJheCIsImF5IiwiYXdpZHRoIiwiYWhlaWdodCIsImxlZnRFZGdlIiwiTWF0aCIsIm1pbiIsInJpZ2h0RWRnZSIsIm1heCIsInRvcEVkZ2UiLCJib3R0b21FZGdlIl0sInNvdXJjZVJvb3QiOiIifQ==\n//# sourceURL=webpack-internal:///./src/index.ts\n");
/***/ })
/******/ });
/************************************************************************/
/******/ // The require scope
/******/ var __webpack_require__ = {};
/******/
/************************************************************************/
/******/ /* webpack/runtime/define property getters */
/******/ (() => {
/******/ // define getter functions for harmony exports
/******/ __webpack_require__.d = (exports, definition) => {
/******/ for(var key in definition) {
/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
/******/ }
/******/ }
/******/ };
/******/ })();
/******/
/******/ /* webpack/runtime/hasOwnProperty shorthand */
/******/ (() => {
/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
/******/ })();
/******/
/******/ /* webpack/runtime/make namespace object */
/******/ (() => {
/******/ // define __esModule on exports
/******/ __webpack_require__.r = (exports) => {
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ }
/******/ Object.defineProperty(exports, '__esModule', { value: true });
/******/ };
/******/ })();
/******/
/************************************************************************/
/******/
/******/ // startup
/******/ // Load entry module and return exports
/******/ // This entry module can't be inlined because the eval-source-map devtool is used.
/******/ var __webpack_exports__ = {};
/******/ __webpack_modules__["./src/index.ts"](0, __webpack_exports__, __webpack_require__);
/******/
/******/ return __webpack_exports__;
/******/ })()
;
});
!function(t,i){"object"==typeof exports&&"object"==typeof module?module.exports=i():"function"==typeof define&&define.amd?define([],i):"object"==typeof exports?exports.parsegraph_rect=i():t.parsegraph_rect=i()}(this,(function(){return(()=>{"use strict";var t={d:(i,e)=>{for(var h in e)t.o(e,h)&&!t.o(i,h)&&Object.defineProperty(i,h,{enumerable:!0,get:e[h]})},o:(t,i)=>Object.prototype.hasOwnProperty.call(t,i),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},i={};t.r(i),t.d(i,{default:()=>h});var e=function(){function t(t,i,e,h){this._x=t,this._y=i,this._width=e,this._height=h}return t.prototype.isNaN=function(){return isNaN(this._x)||isNaN(this._y)||isNaN(this._width)||isNaN(this._height)},t.prototype.toNaN=function(){this._x=NaN,this._y=NaN,this._width=NaN,this._height=NaN},t.prototype.clear=function(){this.toNaN()},t.prototype.reset=function(){this.toNaN()},t.prototype.x=function(){return this._x},t.prototype.setX=function(t){this._x=t},t.prototype.y=function(){return this._y},t.prototype.setY=function(t){this._y=t},t.prototype.clone=function(i){return i?(this.copy(i),i):new t(this.x(),this.y(),this.width(),this.height())},t.prototype.copy=function(t){return t?(t.setX(this.x()),t.setY(this.y()),t.setWidth(this.width()),t.setHeight(this.height()),t):this.clone()},t.prototype.translate=function(t,i){this.setX(this.x()+t),this.setY(this.y()+i)},t.prototype.scale=function(t,i){arguments.length<2&&(i=t),this.setX(this.x()*t),this.setY(this.y()*i),this.setWidth(this.width()*t),this.setHeight(this.height()*i)},t.prototype.height=function(){return this._height},t.prototype.setHeight=function(t){this._height=t},t.prototype.width=function(){return this._width},t.prototype.w=function(){return this.width()},t.prototype.h=function(){return this.height()},t.prototype.setWidth=function(t){this._width=t},t.prototype.toString=function(){return"[Rect x="+this.x()+", y="+this.y()+", w="+this.width()+", h="+this.height()+"]"},t.prototype.vMin=function(){return this.y()-this.height()/2},t.prototype.vMax=function(){return this.y()+this.height()/2},t.prototype.hMin=function(){return this.x()-this.width()/2},t.prototype.hMax=function(){return this.x()+this.width()/2},t.prototype.include=function(t,i,e,h){if(this.isNaN())return this._x=t,this._y=i,this._width=e,void(this._height=h);var o=this._x,s=this._y,n=this._width,r=this._height,p=Math.min(o-n/2,t-e/2),u=Math.max(o+n/2,t+e/2),y=Math.min(s-r/2,i-h/2),c=u-p,f=Math.max(s+r/2,i+h/2)-y,a=p+c/2,d=y+f/2;this._x=a,this._y=d,this._width=c,this._height=f},t}();const h=e;return i})()}));

2

parsegraph-rect/package.json
{
"name": "parsegraph-rect",
"version": "1.5.1-dev",
"version": "1.5.1",
"description": "rectangle class",

@@ -5,0 +5,0 @@ "main": "dist/src/index.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc