UNPKG

devexpress-diagram

Version:

DevExpress Diagram Control

1,313 lines (1,255 loc) 2.02 MB
/*! * DevExpress Diagram (dx-diagram) * Version: 2.2.29 * Build date: Mon Apr 13 2026 * * Copyright (c) 2012 - 2026 Developer Express Inc. ALL RIGHTS RESERVED * Read about DevExpress licensing here: https://www.devexpress.com/Support/EULAs */ (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["DevExpress"] = factory(); else root["DevExpress"] = root["DevExpress"] || {}, root["DevExpress"]["diagram"] = factory(); })(this, () => { return /******/ (() => { // webpackBootstrap /******/ "use strict"; /******/ var __webpack_modules__ = ({ /***/ 8424 (__unused_webpack_module, exports) { Object.defineProperty(exports, "__esModule", ({ value: true })); exports.Browser = exports.addBrowserClassNamesToHtml = void 0; var resolveBrowserClassNames = null; function addBrowserClassNamesToHtml() { if (resolveBrowserClassNames && typeof resolveBrowserClassNames === 'function') resolveBrowserClassNames(); } exports.addBrowserClassNamesToHtml = addBrowserClassNamesToHtml; var Browser = (function () { function Browser() { } Browser.IdentUserAgent = function (userAgent, ignoreDocumentMode) { if (ignoreDocumentMode === void 0) { ignoreDocumentMode = false; } var browserTypesOrderedList = ['Mozilla', 'IE', 'Firefox', 'Netscape', 'Safari', 'Chrome', 'Opera', 'Opera10', 'Edge']; var defaultBrowserType = 'IE'; var defaultPlatform = 'Win'; var defaultVersions = { Safari: 2, Chrome: 0.1, Mozilla: 1.9, Netscape: 8, Firefox: 2, Opera: 9, IE: 6, Edge: 12 }; if (!userAgent || userAgent.length === 0) { Browser.fillUserAgentInfo(browserTypesOrderedList, defaultBrowserType, defaultVersions[defaultBrowserType], defaultPlatform); return; } userAgent = userAgent.toLowerCase(); Browser.indentPlatformMajorVersion(userAgent); try { var platformIdentStrings = { 'Windows': 'Win', 'Macintosh': 'Mac', 'Mac OS': 'Mac', 'Mac_PowerPC': 'Mac', 'cpu os': 'MacMobile', 'cpu iphone os': 'MacMobile', 'Android': 'Android', '!Windows Phone': 'WinPhone', '!WPDesktop': 'WinPhone', '!ZuneWP': 'WinPhone' }; var optSlashOrSpace = '(?:/|\\s*)?'; var versionString = '(\\d+)(?:\\.((?:\\d+?[1-9])|\\d)0*?)?'; var optVersion = '(?:' + versionString + ')?'; var patterns = { Safari: 'applewebkit(?:.*?(?:version/' + versionString + '[\\.\\w\\d]*?(?:\\s+mobile/\\S*)?\\s+safari))?', Chrome: '(?:chrome|crios)(?!frame)' + optSlashOrSpace + optVersion, Mozilla: 'mozilla(?:.*rv:' + optVersion + '.*Gecko)?', Netscape: '(?:netscape|navigator)\\d*/?\\s*' + optVersion, Firefox: 'firefox' + optSlashOrSpace + optVersion, Opera: '(?:opera|\\sopr)' + optSlashOrSpace + optVersion, Opera10: 'opera.*\\s*version' + optSlashOrSpace + optVersion, IE: 'msie\\s*' + optVersion, Edge: 'edge' + optSlashOrSpace + optVersion }; var browserType = null; var version = -1; for (var i = 0; i < browserTypesOrderedList.length; i++) { var browserTypeCandidate = browserTypesOrderedList[i]; var regExp = new RegExp(patterns[browserTypeCandidate], 'i'); var matches = regExp.exec(userAgent); if (matches && matches.index >= 0) { if (browserType === 'IE' && version >= 11 && browserTypeCandidate === 'Safari') continue; browserType = browserTypeCandidate; if (browserType === 'Opera10') browserType = 'Opera'; var tridentPattern = 'trident' + optSlashOrSpace + optVersion; version = Browser.GetBrowserVersion(userAgent, matches, tridentPattern, Browser.getIECompatibleVersionString()); if (browserType === 'Mozilla' && version >= 11) browserType = 'IE'; } } if (!browserType) browserType = defaultBrowserType; var browserVersionDetected = version !== -1; if (!browserVersionDetected) version = defaultVersions[browserType]; var platform = null; var minOccurenceIndex = Number.MAX_VALUE; for (var identStr in platformIdentStrings) { if (!Object.prototype.hasOwnProperty.call(platformIdentStrings, identStr)) continue; var importantIdent = identStr.substr(0, 1) === '!'; var occurenceIndex = userAgent.indexOf((importantIdent ? identStr.substr(1) : identStr).toLowerCase()); if (occurenceIndex >= 0 && (occurenceIndex < minOccurenceIndex || importantIdent)) { minOccurenceIndex = importantIdent ? 0 : occurenceIndex; platform = platformIdentStrings[identStr]; } } var samsungPattern = 'SM-[A-Z]'; var m = userAgent.toUpperCase().match(samsungPattern); var isSamsungAndroidDevice = m && m.length > 0; if (platform === 'WinPhone' && version < 9) version = Math.floor(Browser.getVersionFromTrident(userAgent, 'trident' + optSlashOrSpace + optVersion)); if (!ignoreDocumentMode && browserType === 'IE' && version > 7 && document.documentMode < version) version = document.documentMode; if (platform === 'WinPhone') version = Math.max(9, version); if (!platform) platform = defaultPlatform; if (platform === platformIdentStrings['cpu os'] && !browserVersionDetected) version = 4; Browser.fillUserAgentInfo(browserTypesOrderedList, browserType, version, platform, isSamsungAndroidDevice); } catch (e) { Browser.fillUserAgentInfo(browserTypesOrderedList, defaultBrowserType, defaultVersions[defaultBrowserType], defaultPlatform); } }; Browser.GetBrowserVersion = function (userAgent, matches, tridentPattern, ieCompatibleVersionString) { var version = Browser.getVersionFromMatches(matches); if (ieCompatibleVersionString) { var versionFromTrident = Browser.getVersionFromTrident(userAgent, tridentPattern); if (ieCompatibleVersionString === 'edge' || parseInt(ieCompatibleVersionString) === versionFromTrident) return versionFromTrident; } return version; }; Browser.getIECompatibleVersionString = function () { if (document.compatible) { for (var i = 0; i < document.compatible.length; i++) { if (document.compatible[i].userAgent === 'IE' && document.compatible[i].version) return document.compatible[i].version.toLowerCase(); } } return ''; }; Browser.isTouchEnabled = function () { return Browser.hasTouchStart() || Browser.hasMaxTouchPoints() || Browser.hasMsMaxTouchPoints(); }; Browser.hasTouchStart = function () { return ('ontouchstart' in window); }; Browser.hasMaxTouchPoints = function () { return navigator['maxTouchPoints'] > 0; }; Browser.hasMsMaxTouchPoints = function () { return navigator['msMaxTouchPoints'] > 0; }; Browser.hasNavigator = function () { return typeof navigator !== 'undefined'; }; Browser.fillUserAgentInfo = function (browserTypesOrderedList, browserType, version, platform, isSamsungAndroidDevice) { if (isSamsungAndroidDevice === void 0) { isSamsungAndroidDevice = false; } for (var i = 0; i < browserTypesOrderedList.length; i++) { var type = browserTypesOrderedList[i]; Browser[type] = type === browserType; } Browser.Version = Math.floor(10.0 * version) / 10.0; Browser.MajorVersion = Math.floor(Browser.Version); Browser.WindowsPlatform = platform === 'Win' || platform === 'WinPhone'; Browser.MacOSMobilePlatform = platform === 'MacMobile' || (platform === 'Mac' && Browser.isTouchEnabled()); Browser.MacOSPlatform = platform === 'Mac' && !Browser.MacOSMobilePlatform; Browser.AndroidMobilePlatform = platform === 'Android'; Browser.WindowsPhonePlatform = platform === 'WinPhone'; Browser.WebKitFamily = Browser.Safari || Browser.Chrome || Browser.Opera && Browser.MajorVersion >= 15; Browser.NetscapeFamily = Browser.Netscape || Browser.Mozilla || Browser.Firefox; Browser.WebKitTouchUI = Browser.MacOSMobilePlatform || Browser.AndroidMobilePlatform; var isIETouchUI = Browser.IE && Browser.MajorVersion > 9 && Browser.WindowsPlatform && Browser.UserAgent.toLowerCase().indexOf('touch') >= 0; Browser.MSTouchUI = isIETouchUI || (Browser.Edge && !!window.navigator.maxTouchPoints); Browser.TouchUI = Browser.WebKitTouchUI || Browser.MSTouchUI; Browser.MobileUI = Browser.WebKitTouchUI || Browser.WindowsPhonePlatform; Browser.AndroidDefaultBrowser = Browser.AndroidMobilePlatform && !Browser.Chrome; Browser.AndroidChromeBrowser = Browser.AndroidMobilePlatform && Browser.Chrome; if (isSamsungAndroidDevice) Browser.SamsungAndroidDevice = isSamsungAndroidDevice; if (Browser.MSTouchUI) { var isARMArchitecture = Browser.UserAgent.toLowerCase().indexOf('arm;') > -1; Browser.VirtualKeyboardSupported = isARMArchitecture || Browser.WindowsPhonePlatform; } else Browser.VirtualKeyboardSupported = Browser.WebKitTouchUI; Browser.fillDocumentElementBrowserTypeClassNames(browserTypesOrderedList); }; Browser.indentPlatformMajorVersion = function (userAgent) { var regex = /(?:(?:windows nt|macintosh|mac os|cpu os|cpu iphone os|android|windows phone|linux) )(\d+)(?:[-0-9_.])*/; var matches = regex.exec(userAgent); if (matches) Browser.PlaformMajorVersion = matches[1]; }; Browser.getVersionFromMatches = function (matches) { var result = -1; var versionStr = ''; if (matches) { if (matches[1]) { versionStr += matches[1]; if (matches[2]) versionStr += '.' + matches[2]; } if (versionStr !== '') { result = parseFloat(versionStr); if (isNaN(result)) result = -1; } } return result; }; Browser.getVersionFromTrident = function (userAgent, tridentPattern) { var tridentDiffFromVersion = 4; var matches = new RegExp(tridentPattern, 'i').exec(userAgent); return Browser.getVersionFromMatches(matches) + tridentDiffFromVersion; }; Browser.fillDocumentElementBrowserTypeClassNames = function (browserTypesOrderedList) { var documentElementClassName = ''; var browserTypeslist = browserTypesOrderedList.concat(['WindowsPlatform', 'MacOSPlatform', 'MacOSMobilePlatform', 'AndroidMobilePlatform', 'WindowsPhonePlatform', 'WebKitFamily', 'WebKitTouchUI', 'MSTouchUI', 'TouchUI', 'AndroidDefaultBrowser']); for (var i = 0; i < browserTypeslist.length; i++) { var type = browserTypeslist[i]; if (Browser[type]) documentElementClassName += 'dx' + type + ' '; } documentElementClassName += 'dxBrowserVersion-' + Browser.MajorVersion; if (typeof document !== 'undefined' && document && document.documentElement) { if (document.documentElement.className !== '') documentElementClassName = ' ' + documentElementClassName; Browser.Info = documentElementClassName; Browser.applyClassNamesOnDemand(document.documentElement, documentElementClassName); } }; Browser.applyClassNamesOnDemand = function (documentElement, documentElementClassName) { return new Promise(function (resolve) { resolveBrowserClassNames = resolve; }).then(function () { documentElement.className += documentElementClassName; }); }; Browser.getUserAgent = function () { return Browser.hasNavigator() && navigator.userAgent ? navigator.userAgent.toLowerCase() : ''; }; Browser.UserAgent = Browser.getUserAgent(); Browser._foo = Browser.IdentUserAgent(Browser.UserAgent); return Browser; }()); exports.Browser = Browser; /***/ }, /***/ 815 (__unused_webpack_module, exports) { Object.defineProperty(exports, "__esModule", ({ value: true })); exports.EmptyBatchUpdatableObject = exports.BatchUpdatableObject = void 0; var BatchUpdatableObject = (function () { function BatchUpdatableObject() { this.suspendUpdateCount = 0; this.occurredEvents = 0; } BatchUpdatableObject.prototype.beginUpdate = function () { if (this.suspendUpdateCount === 0) this.onUpdateLocked(); if (this.suspendUpdateCount < 0) this.suspendUpdateCount--; else this.suspendUpdateCount++; }; BatchUpdatableObject.prototype.endUpdate = function () { if (this.suspendUpdateCount < 0) this.suspendUpdateCount++; else if (this.suspendUpdateCount > 0) this.suspendUpdateCount--; if (!this.isUpdateLocked()) { var occurredEvents = this.occurredEvents; this.occurredEvents = 0; this.onUpdateUnlocked(occurredEvents); } }; BatchUpdatableObject.prototype.suspendUpdate = function () { if (this.suspendUpdateCount > 0) { this.suspendUpdateCount *= -1; var occurredEvents = this.occurredEvents; this.occurredEvents = 0; this.onUpdateUnlocked(occurredEvents); } }; BatchUpdatableObject.prototype.continueUpdate = function () { if (this.suspendUpdateCount < 0) this.suspendUpdateCount *= -1; }; BatchUpdatableObject.prototype.isUpdateLocked = function () { return this.suspendUpdateCount > 0; }; BatchUpdatableObject.prototype.onUpdateLocked = function () { }; BatchUpdatableObject.prototype.registerOccurredEvent = function (eventMask) { this.occurredEvents |= eventMask; }; BatchUpdatableObject.prototype.resetOccurredEvents = function () { this.occurredEvents = 0; }; BatchUpdatableObject.prototype.isLocked = function () { return this.suspendUpdateCount !== 0; }; return BatchUpdatableObject; }()); exports.BatchUpdatableObject = BatchUpdatableObject; var EmptyBatchUpdatableObject = (function () { function EmptyBatchUpdatableObject() { } EmptyBatchUpdatableObject.prototype.beginUpdate = function () { }; EmptyBatchUpdatableObject.prototype.endUpdate = function () { }; return EmptyBatchUpdatableObject; }()); exports.EmptyBatchUpdatableObject = EmptyBatchUpdatableObject; /***/ }, /***/ 3393 (__unused_webpack_module, exports) { Object.defineProperty(exports, "__esModule", ({ value: true })); exports.Flag = void 0; var Flag = (function () { function Flag(initValue) { if (initValue === void 0) { initValue = 0; } this.value = initValue; } Flag.prototype.get = function (enumVal) { return (this.value & enumVal) === enumVal; }; Flag.prototype.set = function (enumVal, newValue) { var currVal = (this.value & enumVal) === enumVal; if (currVal !== newValue) { if (newValue) this.value |= enumVal; else this.value ^= enumVal; } return this; }; Flag.prototype.add = function (value) { this.value |= value; }; Flag.prototype.anyOf = function () { var flags = []; for (var _i = 0; _i < arguments.length; _i++) { flags[_i] = arguments[_i]; } for (var _a = 0, flags_1 = flags; _a < flags_1.length; _a++) { var flag = flags_1[_a]; if ((this.value & flag) === flag) return true; } return false; }; Flag.prototype.getValue = function () { return this.value; }; Flag.prototype.clone = function () { return new Flag(this.value); }; return Flag; }()); exports.Flag = Flag; /***/ }, /***/ 3196 (__unused_webpack_module, exports, __webpack_require__) { Object.defineProperty(exports, "__esModule", ({ value: true })); exports.ExtendedMinMax = exports.ExtendedMax = exports.ExtendedMin = exports.MinMaxNumber = exports.MinMax = void 0; var tslib_1 = __webpack_require__(5215); var MinMax = (function () { function MinMax(minElement, maxElement) { this.minElement = minElement; this.maxElement = maxElement; } return MinMax; }()); exports.MinMax = MinMax; var MinMaxNumber = (function (_super) { tslib_1.__extends(MinMaxNumber, _super); function MinMaxNumber() { return _super !== null && _super.apply(this, arguments) || this; } Object.defineProperty(MinMaxNumber.prototype, "length", { get: function () { return this.maxElement - this.minElement; }, enumerable: false, configurable: true }); return MinMaxNumber; }(MinMax)); exports.MinMaxNumber = MinMaxNumber; var ExtendedMin = (function () { function ExtendedMin(minElement, minValue) { this.minElement = minElement; this.minValue = minValue; } return ExtendedMin; }()); exports.ExtendedMin = ExtendedMin; var ExtendedMax = (function () { function ExtendedMax(maxElement, maxValue) { this.maxElement = maxElement; this.maxValue = maxValue; } return ExtendedMax; }()); exports.ExtendedMax = ExtendedMax; var ExtendedMinMax = (function (_super) { tslib_1.__extends(ExtendedMinMax, _super); function ExtendedMinMax(minElement, minValue, maxElement, maxValue) { var _this = _super.call(this, minElement, maxElement) || this; _this.minValue = minValue; _this.maxValue = maxValue; return _this; } return ExtendedMinMax; }(MinMax)); exports.ExtendedMinMax = ExtendedMinMax; /***/ }, /***/ 9500 (__unused_webpack_module, exports) { Object.defineProperty(exports, "__esModule", ({ value: true })); exports.UnitConverter = void 0; var UnitConverter = (function () { function UnitConverter() { } UnitConverter.hundredthsOfMillimeterToTwipsRound = function (value) { return Math.round(1440 * value / 2540.0); }; UnitConverter.documentsToTwips = function (value) { return 24 * value / 5; }; UnitConverter.pixelsToTwips = function (value) { return Math.round(UnitConverter.pixelsToTwipsF(value)); }; UnitConverter.pixelsToTwipsCustomDpi = function (value, dpi) { return Math.round(UnitConverter.pixelsToTwipsFCustomDpi(value, dpi)); }; UnitConverter.inchesToTwips = function (value) { return Math.round(UnitConverter.inchesToTwipsF(value)); }; UnitConverter.pointsToTwips = function (value) { return Math.round(UnitConverter.pointsToTwipsF(value)); }; UnitConverter.picasToTwips = function (value) { return Math.round(value * 1440 / UnitConverter.PICAS_PER_INCH); }; UnitConverter.centimetersToTwips = function (value) { return Math.round(UnitConverter.centimetersToTwipsF(value)); }; UnitConverter.pixelsToTwipsF = function (value) { return value * 1440 / UnitConverter.DPI; }; UnitConverter.pixelsToTwipsFCustomDpi = function (value, dpi) { return value * 1440 / dpi; }; UnitConverter.inchesToTwipsF = function (value) { return value * 1440; }; UnitConverter.pointsToTwipsF = function (value) { return value * 20; }; UnitConverter.centimetersToTwipsF = function (value) { return value * 1440 / UnitConverter.CENTIMETERS_PER_INCH; }; UnitConverter.twipsToDegrees = function (value) { return value / 60000; }; UnitConverter.twipsToRadians = function (value) { return value / 60000 * Math.PI / 180; }; UnitConverter.degreesToTwips = function (value) { return value * 60000; }; UnitConverter.radiansToTwips = function (value) { return value * 60000 / Math.PI * 180; }; UnitConverter.radiansToDegrees = function (value) { return value / Math.PI * 180; }; UnitConverter.twipsToFD = function (value) { return Math.round(value * 2048 / 1875); }; UnitConverter.fdToTwips = function (value) { return Math.round(value * 1875 / 2048); }; UnitConverter.emuToTwips = function (val) { return val / 635; }; UnitConverter.twipsToPixels = function (value) { return Math.round(UnitConverter.twipsToPixelsF(value)); }; UnitConverter.inchesToPixels = function (value) { return Math.round(UnitConverter.DPI * value); }; UnitConverter.centimeterToPixel = function (value) { return Math.round(this.centimeterToPixelF(value)); }; UnitConverter.centimeterToPixelF = function (value) { return value * UnitConverter.DPI / UnitConverter.CENTIMETERS_PER_INCH; }; UnitConverter.millimetersToPixel = function (value) { return Math.round(value / (UnitConverter.CENTIMETERS_PER_INCH / UnitConverter.DPI) / 10); }; UnitConverter.pointsToPixels = function (value) { return Math.round(value * UnitConverter.DPI / 72); }; UnitConverter.pointsToPixelsF = function (value) { return value * UnitConverter.DPI / 72; }; UnitConverter.twipsToPixelsF = function (value) { return value * UnitConverter.DPI / 1440; }; UnitConverter.pixelsToPoints = function (value) { return Math.round(value * 72 / UnitConverter.DPI); }; UnitConverter.pixelsToPointsF = function (value) { return value * 72 / UnitConverter.DPI; }; UnitConverter.twipsToPoints = function (value) { return Math.round(this.twipsToPointsF(value)); }; UnitConverter.twipsToPointsF = function (value) { return value / 20; }; UnitConverter.twipsToInches = function (value) { return value / 1440; }; UnitConverter.pixelsToInches = function (value) { return value / UnitConverter.DPI; }; UnitConverter.twipsToCentimeters = function (value) { return value * UnitConverter.CENTIMETERS_PER_INCH / 1440; }; UnitConverter.pixelToCentimeters = function (value) { return value * UnitConverter.CENTIMETERS_PER_INCH / UnitConverter.DPI; }; UnitConverter.twipsToHundredthsOfMillimeter = function (value) { return Math.round(127 * value / 72); }; UnitConverter.pixelsToHundredthsOfMillimeter = function (value) { return Math.round(2540 * value / UnitConverter.DPI); }; UnitConverter.hundredthsOfMillimeterToTwips = function (value) { return 15 * value / 127; }; UnitConverter.twipsToEmu = function (val) { return val * 635; }; UnitConverter.twipsToDegree = function (value) { return value / 60000; }; UnitConverter.DPI = 96; UnitConverter.CENTIMETERS_PER_INCH = 2.54; UnitConverter.PICAS_PER_INCH = 6; return UnitConverter; }()); exports.UnitConverter = UnitConverter; /***/ }, /***/ 4496 (__unused_webpack_module, exports) { Object.defineProperty(exports, "__esModule", ({ value: true })); exports.Metrics = void 0; var Metrics = (function () { function Metrics() { } Metrics.euclideanDistance = function (a, b) { var xDist = a.x - b.x; var yDist = a.y - b.y; return Math.sqrt(xDist * xDist + yDist * yDist); }; Metrics.manhattanDistance = function (a, b) { return Math.abs(a.x - b.x) + Math.abs(a.y - b.y); }; return Metrics; }()); exports.Metrics = Metrics; /***/ }, /***/ 8601 (__unused_webpack_module, exports) { Object.defineProperty(exports, "__esModule", ({ value: true })); exports.Offsets = void 0; var Offsets = (function () { function Offsets(left, right, top, bottom) { this.left = left; this.right = right; this.top = top; this.bottom = bottom; } Offsets.empty = function () { return new Offsets(0, 0, 0, 0); }; Object.defineProperty(Offsets.prototype, "horizontal", { get: function () { return this.left + this.right; }, enumerable: false, configurable: true }); Object.defineProperty(Offsets.prototype, "vertical", { get: function () { return this.top + this.bottom; }, enumerable: false, configurable: true }); Offsets.fromNumber = function (offset) { return new Offsets(offset, offset, offset, offset); }; Offsets.fromOffsets = function (offsets) { return new Offsets(offsets.left, offsets.right, offsets.top, offsets.bottom); }; Offsets.fromSide = function (horizontal, vertical) { return new Offsets(horizontal, horizontal, vertical, vertical); }; Offsets.prototype.normalize = function () { this.left = Math.max(0, this.left); this.right = Math.max(0, this.right); this.top = Math.max(0, this.top); this.bottom = Math.max(0, this.bottom); return this; }; Offsets.prototype.toString = function () { return JSON.stringify(this); }; Offsets.prototype.isEmpty = function () { return this.left === 0 && this.right === 0 && this.top === 0 && this.bottom === 0; }; Offsets.prototype.offset = function (offset) { this.left += offset.left; this.right += offset.right; this.top += offset.top; this.bottom += offset.bottom; return this; }; Offsets.prototype.multiply = function (multLeft, multRight, multTop, multBottom) { switch (arguments.length) { case 1: { this.left *= multLeft; this.right *= multLeft; this.top *= multLeft; this.bottom *= multLeft; return this; } case 2: { this.left *= multLeft; this.right *= multLeft; this.top *= multRight; this.bottom *= multRight; return this; } case 4: { this.left *= multLeft; this.right *= multRight; this.top *= multTop; this.bottom *= multBottom; return this; } } return this; }; Offsets.prototype.clone = function () { return new Offsets(this.left, this.right, this.top, this.bottom); }; Offsets.prototype.copyFrom = function (obj) { this.left = obj.left; this.right = obj.right; this.top = obj.top; this.bottom = obj.bottom; }; Offsets.prototype.equals = function (obj) { return this.top === obj.top && this.bottom === obj.bottom && this.right === obj.right && this.left === obj.left; }; Offsets.prototype.applyConverter = function (converter) { this.left = converter(this.left); this.right = converter(this.right); this.top = converter(this.top); this.bottom = converter(this.bottom); return this; }; return Offsets; }()); exports.Offsets = Offsets; /***/ }, /***/ 5327 (__unused_webpack_module, exports) { Object.defineProperty(exports, "__esModule", ({ value: true })); exports.Point = void 0; var Point = (function () { function Point(x, y) { this.x = x; this.y = y; } Point.zero = function () { return new Point(0, 0); }; Point.fromNumber = function (num) { return new Point(num, num); }; Point.prototype.isZero = function () { return this.x === 0 && this.y === 0; }; Point.prototype.toString = function () { return JSON.stringify(this); }; Point.prototype.copyFrom = function (obj) { this.x = obj.x; this.y = obj.y; }; Point.prototype.clone = function () { return new Point(this.x, this.y); }; Point.prototype.equals = function (obj) { return this.x === obj.x && this.y === obj.y; }; Point.prototype.offset = function (offsetX, offsetY) { this.x += offsetX; this.y += offsetY; return this; }; Point.prototype.offsetByPoint = function (offset) { this.x += offset.x; this.y += offset.y; return this; }; Point.prototype.multiply = function (multiplierX, multiplierY) { this.x *= multiplierX; this.y *= multiplierY; return this; }; Point.prototype.negative = function () { this.x *= -1; this.y *= -1; return this; }; Point.prototype.applyConverter = function (converter) { this.x = converter(this.x); this.y = converter(this.y); return this; }; Point.plus = function (a, b) { return new Point(a.x + b.x, a.y + b.y); }; Point.minus = function (a, b) { return new Point(a.x - b.x, a.y - b.y); }; Point.xComparer = function (a, b) { return a.x - b.x; }; Point.yComparer = function (a, b) { return a.y - b.y; }; Point.equals = function (a, b) { return a.x === b.x && a.y === b.y; }; return Point; }()); exports.Point = Point; /***/ }, /***/ 4412 (__unused_webpack_module, exports, __webpack_require__) { Object.defineProperty(exports, "__esModule", ({ value: true })); exports.RectangleDeviation = exports.HitTestDeviation = exports.Rectangle = void 0; var flag_1 = __webpack_require__(3393); var algorithms_1 = __webpack_require__(2095); var fixed_1 = __webpack_require__(2871); var point_1 = __webpack_require__(5327); var size_1 = __webpack_require__(3844); var Rectangle = (function () { function Rectangle(x, y, width, height) { this.x = x; this.y = y; this.width = width; this.height = height; } Object.defineProperty(Rectangle.prototype, "right", { get: function () { return this.x + this.width; }, enumerable: false, configurable: true }); Object.defineProperty(Rectangle.prototype, "bottom", { get: function () { return this.y + this.height; }, enumerable: false, configurable: true }); Object.defineProperty(Rectangle.prototype, "center", { get: function () { return Rectangle.center(this); }, enumerable: false, configurable: true }); Rectangle.prototype.createRectangle = function () { return new Rectangle(this.x, this.y, this.width, this.height); }; Rectangle.prototype.createSize = function () { return new size_1.Size(this.width, this.height); }; Rectangle.prototype.createPosition = function () { return new point_1.Point(this.x, this.y); }; Rectangle.prototype.createVerticalInterval = function () { return new fixed_1.FixedInterval(this.y, this.height); }; Rectangle.prototype.createHorizontalInterval = function () { return new fixed_1.FixedInterval(this.x, this.width); }; Rectangle.fromGeometry = function (point, size) { return new Rectangle(point.x, point.y, size.width, size.height); }; Rectangle.fromPoints = function (pointA, pointB) { var x = Math.min(pointA.x, pointB.x); var y = Math.min(pointA.y, pointB.y); var width = Math.abs(pointA.x - pointB.x); var height = Math.abs(pointA.y - pointB.y); return new Rectangle(x, y, width, height); }; Rectangle.fromPositions = function (x1, y1, x2, y2) { var x = Math.min(x1, x2); var y = Math.min(y1, y2); var width = Math.abs(x2 - x1); var height = Math.abs(y2 - y1); return new Rectangle(x, y, width, height); }; Rectangle.fromCenter = function (center, minRadius) { return new Rectangle(center.x - minRadius, center.y - minRadius, minRadius * 2, minRadius * 2); }; Rectangle.prototype.isCollapsed = function () { return this.width === 0 || this.height === 0; }; Rectangle.prototype.isEmpty = function () { return this.x === 0 && this.y === 0 && this.width === 0 && this.height === 0; }; Rectangle.prototype.toString = function () { return JSON.stringify(this); }; Rectangle.prototype.setPosition = function (pos) { this.x = pos.x; this.y = pos.y; return this; }; Rectangle.prototype.setSize = function (size) { this.width = size.width; this.height = size.height; return this; }; Rectangle.prototype.setGeomerty = function (rect) { this.x = rect.x; this.y = rect.y; this.width = rect.width; this.height = rect.height; return this; }; Rectangle.prototype.moveRectangle = function (offsetX, offsetY) { this.x += offsetX; this.y += offsetY; return this; }; Rectangle.prototype.moveRectangleByPoint = function (offset) { this.x += offset.x; this.y += offset.y; return this; }; Rectangle.prototype.resize = function (deltaX, deltaY) { this.width += deltaX; this.height += deltaY; return this; }; Rectangle.prototype.nonNegativeSize = function () { if (this.width < 0) this.width = 0; if (this.height < 0) this.height = 0; return this; }; Rectangle.prototype.multiply = function (multiplierX, multiplierY) { this.x *= multiplierX; this.y *= multiplierY; this.width *= multiplierX; this.height *= multiplierY; return this; }; Rectangle.prototype.equals = function (obj) { return Rectangle.equals(this, obj); }; Rectangle.prototype.clone = function () { var rect = new Rectangle(0, 0, 0, 0); rect.copyFrom(this); return rect; }; Rectangle.prototype.copyFrom = function (obj) { this.x = obj.x; this.y = obj.y; this.width = obj.width; this.height = obj.height; }; Rectangle.prototype.containsPoint = function (point) { return Rectangle.containsPoint(this, point); }; Rectangle.prototype.containsRectangle = function (rectangle) { return this.x <= rectangle.x && this.right >= rectangle.right && this.y <= rectangle.y && this.bottom >= rectangle.bottom; }; Rectangle.prototype.inflate = function (deltaX, deltaY) { if (deltaY === void 0) { deltaY = deltaX; } this.x -= deltaX; this.y -= deltaY; this.width += deltaX * 2; this.height += deltaY * 2; return this; }; Rectangle.prototype.applyOffsetsInside = function (offsets) { this.x += offsets.left; this.y += offsets.top; this.width -= offsets.left + offsets.right; this.height -= offsets.top + offsets.bottom; return this; }; Rectangle.prototype.applyNormalizedOffsetsInside = function (offsets) { var left = Math.max(0, offsets.left); var right = Math.max(0, offsets.right); var horSum = left + right; if (horSum !== 0) { if (horSum <= this.width) { this.x += left; this.width -= horSum; } else { this.x += this.width * (left / horSum); this.width = 0; } } var top = Math.max(0, offsets.top); var bottom = Math.max(0, offsets.bottom); var vertSum = top + bottom; if (vertSum !== 0) { if (vertSum <= this.height) { this.y += top; this.height -= vertSum; } else { this.y += this.height * (top / vertSum); this.height = 0; } } return this; }; Rectangle.prototype.applyOffsetsOutside = function (offsets) { this.x -= offsets.left; this.y -= offsets.top; this.width += offsets.left + offsets.right; this.height += offsets.top + offsets.bottom; return this; }; Rectangle.prototype.applyConverter = function (converter) { this.x = converter(this.x); this.y = converter(this.y); this.width = converter(this.width); this.height = converter(this.height); return this; }; Rectangle.getHorizIntersection = function (objA, objB) { return algorithms_1.IntervalAlgorithms.getIntersection(new fixed_1.FixedInterval(objA.x, objA.width), new fixed_1.FixedInterval(objB.x, objB.width)); }; Rectangle.getVertIntersection = function (objA, objB) { return algorithms_1.IntervalAlgorithms.getIntersection(new fixed_1.FixedInterval(objA.y, objA.height), new fixed_1.FixedInterval(objB.y, objB.height)); }; Rectangle.getIntersection = function (objA, objB) { var horInters = algorithms_1.IntervalAlgorithms.getIntersection(new fixed_1.FixedInterval(objA.x, objA.width), new fixed_1.FixedInterval(objB.x, objB.width)); if (!horInters) return null; var vertInters = algorithms_1.IntervalAlgorithms.getIntersection(new fixed_1.FixedInterval(objA.y, objA.height), new fixed_1.FixedInterval(objB.y, objB.height)); if (!vertInters) return null; return new Rectangle(horInters.start, vertInters.start, horInters.length, vertInters.length); }; Rectangle.getHorNonCollapsedIntersection = function (objA, objB) { var inters = Rectangle.getHorizIntersection(objA, objB); return inters && !inters.isCollapsed() ? inters : null; }; Rectangle.getVertNonCollapsedIntersection = function (objA, objB) { var inters = Rectangle.getVertIntersection(objA, objB); return inters && !inters.isCollapsed() ? inters : null; }; Rectangle.getNonCollapsedIntersection = function (objA, objB) { var inters = Rectangle.getIntersection(objA, objB); return inters && !inters.isCollapsed() ? inters : null; }; Rectangle.areIntersected = function (rectA, rectB) { return !(rectA.x > rectB.x + rectB.width || rectB.x > rectA.x + rectA.width) && !(rectA.y > rectB.y + rectB.height || rectB.y > rectA.y + rectA.height); }; Rectangle.union = function (rectA, rectB) { var right = Math.max(rectA.x + rectA.width, rectB.x + rectB.width); var bottom = Math.max(rectA.y + rectA.height, rectB.y + rectB.height); var x = Math.min(rectA.x, rectB.x); var y = Math.min(rectA.y, rectB.y); return new Rectangle(x, y, right - x, bottom - y); }; Rectangle.equals = function (a, b) { return a.x === b.x && a.y === b.y && a.width === b.width && a.height === b.height; }; Rectangle.center = function (rect) { return new point_1.Point(rect.x + rect.width / 2, rect.y + rect.height / 2); }; Rectangle.containsPoint = function (rect, point) { var right = rect.x + rect.width; var bottom = rect.y + rect.height; return point.y >= rect.y && bottom >= point.y && point.x >= rect.x && right >= point.x; }; return Rectangle; }()); exports.Rectangle = Rectangle; var HitTestDeviation; (function (HitTestDeviation) { HitTestDeviation[HitTestDeviation["None"] = 0] = "None"; HitTestDeviation[HitTestDeviation["Top"] = 1] = "Top"; HitTestDeviation[HitTestDeviation["Bottom"] = 2] = "Bottom"; HitTestDeviation[HitTestDeviation["Left"] = 4] = "Left"; HitTestDeviation[HitTestDeviation["Right"] = 8] = "Right"; })(HitTestDeviation = exports.HitTestDeviation || (exports.HitTestDeviation = {})); var RectangleDeviation = (function () { function RectangleDeviation(initRectangle, initPoint) { this.initRectangle = initRectangle; this.initPoint = initPoint; this.deviation = new flag_1.Flag(HitTestDeviation.None); } RectangleDeviation.prototype.calcDeviation = function () { if (this.initPoint.x < this.initRectangle.x) this.deviation.set(HitTestDeviation.Left, true); else if (this.initPoint.x > this.initRectangle.right) this.deviation.set(HitTestDeviation.Right, true); if (this.initPoint.y < this.initRectangle.y) this.deviation.set(HitTestDeviation.Top, true); else if (this.initPoint.y > this.initRectangle.bottom) this.deviation.set(HitTestDeviation.Bottom, true); return this; }; RectangleDeviation.prototype.calcAdditionalParams = function () { this.insidePoint = this.initPoint.clone(); this.offsetToInside = new point_1.Point(0, 0); if (this.deviation.get(HitTestDeviation.Left)) { this.insidePoint.x = this.initRectangle.x; this.offsetToInside.x = this.insidePoint.x - this.initPoint.x; } else if (this.deviation.get(HitTestDeviation.Right)) { this.insidePoint.x = this.initRectangle.right; this.offsetToInside.x = this.initPoint.x - this.insidePoint.x; } if (this.deviation.get(HitTestDeviation.Top)) { this.insidePoint.y = this.initRectangle.y; this.offsetToInside.y = this.insidePoint.y - this.initPoint.y; } else if (this.deviation.get(HitTestDeviation.Bottom)) { this.insidePoint.y = this.initRectangle.bottom; this.offsetToInside.y = this.initPoint.y - this.insidePoint.y; } return this; }; return RectangleDeviation; }()); exports.RectangleDeviation = RectangleDeviation; /***/ }, /***/ 476 (__unused_webpack_module, exports, __webpack_require__) { Object.defineProperty(exports, "__esModule", ({ value: true })); exports.Segment = void 0; var math_1 = __webpack_require__(594); var metrics_1 = __webpack_require__(4496); var point_1 = __webpack_require__(5327); var rectangle_1 = __webpack_require__(4412); var Segment = (function () { function Segment(startPoint, endPoint) { this.startPoint = startPoint; this.endPoint = endPoint; } Object.defineProperty(Segment.prototype, "length", { get: function () { return metrics_1.Metrics.euclideanDistance(this.startPoint, this.endPoint); }, enumerable: false, configurable: true }); Object.defineProperty(Segment.prototype, "xLength", { get: function () { return Math.abs(this.endPoint.x - this.startPoint.x); }, enumerable: false, configurable: true }); Object.defineProperty(Segment.prototype, "yLength", { get: function () { return Math.abs(this.endPoint.y - this.startPoint.y); }, enumerable: false, configurable: true }); Object.defineProperty(Segment.prototype, "center", { get: function () { return new point_1.Point(this.startPoint.x + (this.endPoint.x - this.startPoint.x) / 2, this.startPoint.y + (this.endPoint.y - this.startPoint.y) / 2); }, enumerable: false, configurable: true }); Segment.prototype.isIntersected = function (segment) { return this.startPoint.equals(segment.startPoint) || this.endPoint.equals(segment.startPoint) || this.startPoint.equals(segment.endPoint) || this.endPoint.equals(segment.endPoint) || (this.intersectCore(segment) && segment.intersectCore(this)); }; Segment.prototype.containsPoint = function (point, accuracy) { if (accuracy === void 0) { accuracy = 0.0000001; } return this.startPoint.equals(point) || this.endPoint.equals(point) || math_1.MathUtils.numberCloseTo(this.length, metrics_1.Metrics.euclideanDistance(this.startPoint, point) + metrics_1.Metrics.euclideanDistance(this.endPoint, point), accuracy); }; Segment.prototype.isIntersectedByRect = function (rect) { if (rectangle_1.Rectangle.containsPoint(rect, this.startPoint) || rectangle_1.Rectangle.containsPoint(rect, this.endPoint)) return true; var left = rect.x; var right = rect.x + rect.width; var top = rect.y; var bottom = rect.y + rect.height; return this.isIntersected(new Segment(new point_1.Point(left, top), new point_1.Point(left, bottom))) || this.isIntersected(new Segment(new point_1.Point(right, top), new point_1.Point(right, bottom))) || this.isIntersected(new Segment(new point_1.Point(left, top), new point_1.Point(right, top))) || this.isIntersected(new Segment(new point_1.Point(left, bottom), new point_1.Point(right, bottom))); }; Segment.prototype.intersectCore = function (segment) { if (this.startPoint.x === this.endPoint.x) { if (this.startPoint.x - segment.endPoint.x !== 0) return (this.startPoint.x - segment.startPoint.x) / (this.startPoint.x - segment.endPoint.x) <= 0; if (segment.endPoint.y - this.endPoint.y !== 0) return (segment.endPoint.y - this.startPoint.y) / (segment.endPoint.y - this.endPoint.y) <= 0; } if (this.startPoint.y === this.endPoint.y) { if (this.startPoint.y - segment.endPoint.y !== 0) return (this.startPoint.y - segment.startPoint.y) / (this.startPoint.y - segment.endPoint.y) <= 0; if (segment.endPoint.x - this.endPoint.x !== 0) return (segment.endPoint.x - this.startPoint.x) / (segment.endPoint.x - this.endPoint.x) <= 0; } var tg = (this.endPoint.y - this.startPoint.y) / (this.endPoint.x - this.startPoint.x); var y1 = this.startPoint.y + (segment.startPoint.x - this.startPoint.x) * tg; var y2 = this.startPoint.y + (segment.endPoint.x - this.startPoint.x) * tg; var dy1 = segment.startPoint.y - y1; var dy2 = segment.endPoint.y - y2; if (dy1 === 0 && dy2 === 0) { return (this.startPoint.y - y1) / (this.endPoint.y - y1) <= 0 || (this.startPoint.y - y2) / (this.endPoint.y - y2) <= 0; } return dy1 === 0 || dy2 === 0 || dy1 / dy2 < 0; }; return Segment; }()); exports.Segment = Segment; /***/ }, /***/ 3844 (__unused_webpack_module, exports) { Object.defineProperty(exports, "__esModule", ({ value: true })); exports.Size = void 0; var Size = (function () { function Size(width, height) { this.width = width; this.height = height; } Size.empty = function () { return new Size(0, 0); }; Size.fromNumber = function (num) { return new Size(num, num); }; Size.initByCommonAction = function (action) { var widthAdp = function (s) { return s.width; }; var heightAdp = function (s) { return s.height; }; return new Size(action(widthAdp, heightAdp), action(heightAdp, widthAdp)); }; Size.prototype.isEmpty = function () { return this.width === 0 && this.height === 0; }; Size.prototype.toString = function () { return JSON.stringify(this); }; Size.prototype.nonNegativeSize = function () { if (this.width < 0) this.width = 0; if (this.height < 0) this.height = 0; return this; }; Size.prototype.offset = function (offsetWidth, offsetHeight) { this.width = this.width + offsetWidth; this.height = this.height + offsetHeight; return this; }; Size.prototype.multiply = function (multiplierW, multiplierH) { this.width *= multiplierW; this.height *= multiplierH; return this; }; Size.prototype.equals = function (obj) { return this.width === obj.width && this.height === obj.height; }; Size.prototype.clone = function () { return new Size(this.width, this.height); }; Size.prototype.copyFrom = function (obj) { this.width = obj.width; this.height = obj.height; }; Size.prototype.applyConverter = function (conv) { this.width = conv(this.width); this.height = conv(this.height); return this; }; Size.equals = function (a, b) { return a.width === b.width && a.height === b.height; }; return Size; }()); exports.Size = Size; /***/ }, /***/ 4166 (__unused_webpack_module, exports) { Object.defineProperty(exports, "__esModule", ({ value: true })); exports.Vector = void 0; var Vector = (function () { function Vector(x, y) { if (x === void 0) { x = 0; } if (y === void 0) { y = 0; } this.x = x; this.y = y; } Object.defineProperty(Vector.prototype, "length", { get: function () { return Math.sqrt(this.x * this.x + this.y * this.y); }, enumerable: false, configurable: true }); Vector.fromPoints = function (begin, end) { return new Vector(end.x - begin.x, end.y