(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["G"] = factory(); else root["G"] = factory(); })(window, function() { return /******/ (function(modules) { // webpackBootstrap /******/ // The module cache /******/ var installedModules = {}; /******/ /******/ // The require function /******/ function __webpack_require__(moduleId) { /******/ /******/ // Check if module is in cache /******/ if(installedModules[moduleId]) { /******/ return installedModules[moduleId].exports; /******/ } /******/ // Create a new module (and put it into the cache) /******/ var module = installedModules[moduleId] = { /******/ i: moduleId, /******/ l: false, /******/ exports: {} /******/ }; /******/ /******/ // Execute the module function /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); /******/ /******/ // Flag the module as loaded /******/ module.l = true; /******/ /******/ // Return the exports of the module /******/ return module.exports; /******/ } /******/ /******/ /******/ // expose the modules object (__webpack_modules__) /******/ __webpack_require__.m = modules; /******/ /******/ // expose the module cache /******/ __webpack_require__.c = installedModules; /******/ /******/ // define getter function for harmony exports /******/ __webpack_require__.d = function(exports, name, getter) { /******/ if(!__webpack_require__.o(exports, name)) { /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); /******/ } /******/ }; /******/ /******/ // define __esModule on exports /******/ __webpack_require__.r = function(exports) { /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); /******/ } /******/ Object.defineProperty(exports, '__esModule', { value: true }); /******/ }; /******/ /******/ // create a fake namespace object /******/ // mode & 1: value is a module id, require it /******/ // mode & 2: merge all properties of value into the ns /******/ // mode & 4: return value when already ns object /******/ // mode & 8|1: behave like require /******/ __webpack_require__.t = function(value, mode) { /******/ if(mode & 1) value = __webpack_require__(value); /******/ if(mode & 8) return value; /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; /******/ var ns = Object.create(null); /******/ __webpack_require__.r(ns); /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); /******/ return ns; /******/ }; /******/ /******/ // getDefaultExport function for compatibility with non-harmony modules /******/ __webpack_require__.n = function(module) { /******/ var getter = module && module.__esModule ? /******/ function getDefault() { return module['default']; } : /******/ function getModuleExports() { return module; }; /******/ __webpack_require__.d(getter, 'a', getter); /******/ return getter; /******/ }; /******/ /******/ // Object.prototype.hasOwnProperty.call /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; /******/ /******/ // __webpack_public_path__ /******/ __webpack_require__.p = ""; /******/ /******/ /******/ // Load entry module and return exports /******/ return __webpack_require__(__webpack_require__.s = "./src/index.ts"); /******/ }) /************************************************************************/ /******/ ({ /***/ "./node_modules/_@antv_event-emitter@0.1.2@@antv/event-emitter/esm/index.js": /*!**********************************************************************************!*\ !*** ./node_modules/_@antv_event-emitter@0.1.2@@antv/event-emitter/esm/index.js ***! \**********************************************************************************/ /*! exports provided: default */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); var WILDCARD = '*'; /* event-emitter */ var EventEmitter = /** @class */ function () { function EventEmitter() { this._events = {}; } /** * 监听一个事件 * @param evt * @param callback * @param once */ EventEmitter.prototype.on = function (evt, callback, once) { if (!this._events[evt]) { this._events[evt] = []; } this._events[evt].push({ callback: callback, once: !!once }); return this; }; /** * 监听一个事件一次 * @param evt * @param callback */ EventEmitter.prototype.once = function (evt, callback) { this.on(evt, callback, true); return this; }; /** * 触发一个事件 * @param evt * @param args */ EventEmitter.prototype.emit = function (evt) { var _this = this; var args = []; for (var _i = 1; _i < arguments.length; _i++) { args[_i - 1] = arguments[_i]; } var events = this._events[evt] || []; var wildcardEvents = this._events[WILDCARD] || []; // 实际的处理 emit 方法 var doEmit = function (es) { var length = es.length; for (var i = 0; i < length; i++) { if (!es[i]) { continue; } var _a = es[i], callback = _a.callback, once = _a.once; if (once) { es.splice(i, 1); if (es.length === 0) { delete _this._events[evt]; } length--; i--; } callback.apply(_this, args); } }; doEmit(events); doEmit(wildcardEvents); }; /** * 取消监听一个事件,或者一个channel * @param evt * @param callback */ EventEmitter.prototype.off = function (evt, callback) { if (!evt) { // evt 为空全部清除 this._events = {}; } else { if (!callback) { // evt 存在,callback 为空,清除事件所有方法 delete this._events[evt]; } else { // evt 存在,callback 存在,清除匹配的 var events = this._events[evt] || []; var length_1 = events.length; for (var i = 0; i < length_1; i++) { if (events[i].callback === callback) { events.splice(i, 1); length_1--; i--; } } if (events.length === 0) { delete this._events[evt]; } } } return this; }; /* 当前所有的事件 */ EventEmitter.prototype.getEvents = function () { return this._events; }; return EventEmitter; }(); /* harmony default export */ __webpack_exports__["default"] = (EventEmitter); /***/ }), /***/ "./node_modules/_@antv_g-base@0.5.0-beta.1@@antv/g-base/esm/abstract/base.js": /*!***********************************************************************************!*\ !*** ./node_modules/_@antv_g-base@0.5.0-beta.1@@antv/g-base/esm/abstract/base.js ***! \***********************************************************************************/ /*! exports provided: default */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "./node_modules/_tslib@1.13.0@tslib/tslib.es6.js"); /* harmony import */ var _antv_event_emitter__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @antv/event-emitter */ "./node_modules/_@antv_event-emitter@0.1.2@@antv/event-emitter/esm/index.js"); /* harmony import */ var _util_util__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../util/util */ "./node_modules/_@antv_g-base@0.5.0-beta.1@@antv/g-base/esm/util/util.js"); var Base = /** @class */ function (_super) { Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(Base, _super); function Base(cfg) { var _this = _super.call(this) || this; /** * 是否被销毁 * @type {boolean} */ _this.destroyed = false; var defaultCfg = _this.getDefaultCfg(); _this.cfg = Object(_util_util__WEBPACK_IMPORTED_MODULE_2__["mix"])(defaultCfg, cfg); return _this; } /** * @protected * 默认的配置项 * @returns {object} 默认的配置项 */ Base.prototype.getDefaultCfg = function () { return {}; }; // 实现接口的方法 Base.prototype.get = function (name) { return this.cfg[name]; }; // 实现接口的方法 Base.prototype.set = function (name, value) { this.cfg[name] = value; }; // 实现接口的方法 Base.prototype.destroy = function () { this.cfg = { destroyed: true }; this.off(); this.destroyed = true; }; return Base; }(_antv_event_emitter__WEBPACK_IMPORTED_MODULE_1__["default"]); /* harmony default export */ __webpack_exports__["default"] = (Base); /***/ }), /***/ "./node_modules/_@antv_g-base@0.5.0-beta.1@@antv/g-base/esm/abstract/canvas.js": /*!*************************************************************************************!*\ !*** ./node_modules/_@antv_g-base@0.5.0-beta.1@@antv/g-base/esm/abstract/canvas.js ***! \*************************************************************************************/ /*! exports provided: default */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "./node_modules/_tslib@1.13.0@tslib/tslib.es6.js"); /* harmony import */ var detect_browser__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! detect-browser */ "./node_modules/_detect-browser@5.1.0@detect-browser/index.js"); /* harmony import */ var detect_browser__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(detect_browser__WEBPACK_IMPORTED_MODULE_1__); /* harmony import */ var _container__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./container */ "./node_modules/_@antv_g-base@0.5.0-beta.1@@antv/g-base/esm/abstract/container.js"); /* harmony import */ var _util_util__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../util/util */ "./node_modules/_@antv_g-base@0.5.0-beta.1@@antv/g-base/esm/util/util.js"); /* harmony import */ var _animate_timeline__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../animate/timeline */ "./node_modules/_@antv_g-base@0.5.0-beta.1@@antv/g-base/esm/animate/timeline.js"); /* harmony import */ var _event_event_contoller__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../event/event-contoller */ "./node_modules/_@antv_g-base@0.5.0-beta.1@@antv/g-base/esm/event/event-contoller.js"); var PX_SUFFIX = 'px'; var browser = Object(detect_browser__WEBPACK_IMPORTED_MODULE_1__["detect"])(); var isFirefox = browser && browser.name === 'firefox'; var Canvas = /** @class */ function (_super) { Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(Canvas, _super); function Canvas(cfg) { var _this = _super.call(this, cfg) || this; _this.initContainer(); _this.initDom(); _this.initEvents(); _this.initTimeline(); return _this; } Canvas.prototype.getDefaultCfg = function () { var cfg = _super.prototype.getDefaultCfg.call(this); // set default cursor style for canvas cfg['cursor'] = 'default'; // CSS transform 目前尚未经过长时间验证,为了避免影响上层业务,默认关闭,上层按需开启 cfg['supportCSSTransform'] = false; return cfg; }; /** * @protected * 初始化容器 */ Canvas.prototype.initContainer = function () { var container = this.get('container'); if (Object(_util_util__WEBPACK_IMPORTED_MODULE_3__["isString"])(container)) { container = document.getElementById(container); this.set('container', container); } }; /** * @protected * 初始化 DOM */ Canvas.prototype.initDom = function () { var el = this.createDom(); this.set('el', el); // 附加到容器 var container = this.get('container'); container.appendChild(el); // 设置初始宽度 this.setDOMSize(this.get('width'), this.get('height')); }; /** * @protected * 初始化绑定的事件 */ Canvas.prototype.initEvents = function () { var eventController = new _event_event_contoller__WEBPACK_IMPORTED_MODULE_5__["default"]({ canvas: this }); eventController.init(); this.set('eventController', eventController); }; /** * @protected * 初始化时间轴 */ Canvas.prototype.initTimeline = function () { var timeline = new _animate_timeline__WEBPACK_IMPORTED_MODULE_4__["default"](this); this.set('timeline', timeline); }; /** * @protected * 修改画布对应的 DOM 的大小 * @param {number} width 宽度 * @param {number} height 高度 */ Canvas.prototype.setDOMSize = function (width, height) { var el = this.get('el'); if (_util_util__WEBPACK_IMPORTED_MODULE_3__["isBrowser"]) { el.style.width = width + PX_SUFFIX; el.style.height = height + PX_SUFFIX; } }; // 实现接口 Canvas.prototype.changeSize = function (width, height) { this.setDOMSize(width, height); this.set('width', width); this.set('height', height); this.onCanvasChange('changeSize'); }; /** * 获取当前的渲染引擎 * @return {Renderer} 返回当前的渲染引擎 */ Canvas.prototype.getRenderer = function () { return this.get('renderer'); }; /** * 获取画布的 cursor 样式 * @return {Cursor} */ Canvas.prototype.getCursor = function () { return this.get('cursor'); }; /** * 设置画布的 cursor 样式 * @param {Cursor} cursor cursor 样式 */ Canvas.prototype.setCursor = function (cursor) { this.set('cursor', cursor); var el = this.get('el'); if (_util_util__WEBPACK_IMPORTED_MODULE_3__["isBrowser"] && el) { // 直接设置样式,不等待鼠标移动时再设置 el.style.cursor = cursor; } }; // 实现接口 Canvas.prototype.getPointByEvent = function (ev) { var supportCSSTransform = this.get('supportCSSTransform'); if (supportCSSTransform) { // For Firefox <= 38 if (isFirefox && !Object(_util_util__WEBPACK_IMPORTED_MODULE_3__["isNil"])(ev.layerX) && ev.layerX !== ev.offsetX) { return { x: ev.layerX, y: ev.layerY }; } if (!Object(_util_util__WEBPACK_IMPORTED_MODULE_3__["isNil"])(ev.offsetX)) { // For IE6+, Firefox >= 39, Chrome, Safari, Opera return { x: ev.offsetX, y: ev.offsetY }; } } // should calculate by self for other cases, like Safari in ios // TODO: support CSS transform var _a = this.getClientByEvent(ev), clientX = _a.x, clientY = _a.y; return this.getPointByClient(clientX, clientY); }; // 获取 touch 事件的 clientX 和 clientY 需要单独处理 Canvas.prototype.getClientByEvent = function (ev) { var clientInfo = ev; if (ev.touches) { if (ev.type === 'touchend') { clientInfo = ev.changedTouches[0]; } else { clientInfo = ev.touches[0]; } } return { x: clientInfo.clientX, y: clientInfo.clientY }; }; // 实现接口 Canvas.prototype.getPointByClient = function (clientX, clientY) { var el = this.get('el'); var bbox = el.getBoundingClientRect(); return { x: clientX - bbox.left, y: clientY - bbox.top }; }; // 实现接口 Canvas.prototype.getClientByPoint = function (x, y) { var el = this.get('el'); var bbox = el.getBoundingClientRect(); return { x: x + bbox.left, y: y + bbox.top }; }; // 实现接口 Canvas.prototype.draw = function () {}; /** * @protected * 销毁 DOM 容器 */ Canvas.prototype.removeDom = function () { var el = this.get('el'); el.parentNode.removeChild(el); }; /** * @protected * 清理所有的事件 */ Canvas.prototype.clearEvents = function () { var eventController = this.get('eventController'); eventController.destroy(); }; Canvas.prototype.isCanvas = function () { return true; }; Canvas.prototype.getParent = function () { return null; }; Canvas.prototype.destroy = function () { var timeline = this.get('timeline'); if (this.get('destroyed')) { return; } this.clear(); // 同初始化时相反顺序调用 if (timeline) { // 画布销毁时自动停止动画 timeline.stop(); } this.clearEvents(); this.removeDom(); _super.prototype.destroy.call(this); }; return Canvas; }(_container__WEBPACK_IMPORTED_MODULE_2__["default"]); /* harmony default export */ __webpack_exports__["default"] = (Canvas); /***/ }), /***/ "./node_modules/_@antv_g-base@0.5.0-beta.1@@antv/g-base/esm/abstract/container.js": /*!****************************************************************************************!*\ !*** ./node_modules/_@antv_g-base@0.5.0-beta.1@@antv/g-base/esm/abstract/container.js ***! \****************************************************************************************/ /*! exports provided: default */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "./node_modules/_tslib@1.13.0@tslib/tslib.es6.js"); /* harmony import */ var _element__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./element */ "./node_modules/_@antv_g-base@0.5.0-beta.1@@antv/g-base/esm/abstract/element.js"); /* harmony import */ var _util_util__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../util/util */ "./node_modules/_@antv_g-base@0.5.0-beta.1@@antv/g-base/esm/util/util.js"); var SHAPE_MAP = {}; var INDEX = '_INDEX'; /** * 设置 canvas * @param {IElement} element 元素 * @param {ICanvas} canvas 画布 */ function setCanvas(element, canvas) { element.set('canvas', canvas); if (element.isGroup()) { var children = element.get('children'); if (children.length) { children.forEach(function (child) { setCanvas(child, canvas); }); } } } /** * 设置 timeline * @param {IElement} element 元素 * @param {Timeline} timeline 时间轴 */ function setTimeline(element, timeline) { element.set('timeline', timeline); if (element.isGroup()) { var children = element.get('children'); if (children.length) { children.forEach(function (child) { setTimeline(child, timeline); }); } } } function contains(container, element) { var children = container.getChildren(); return children.indexOf(element) >= 0; } function removeChild(container, element, destroy) { if (destroy === void 0) { destroy = true; } // 不再调用 element.remove() 方法,会出现循环调用 if (destroy) { element.destroy(); } else { element.set('parent', null); element.set('canvas', null); } Object(_util_util__WEBPACK_IMPORTED_MODULE_2__["removeFromArray"])(container.getChildren(), element); } function getComparer(compare) { return function (left, right) { var result = compare(left, right); return result === 0 ? left[INDEX] - right[INDEX] : result; }; } var Container = /** @class */ function (_super) { Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(Container, _super); function Container() { return _super !== null && _super.apply(this, arguments) || this; } Container.prototype.isCanvas = function () { return false; }; // 根据子节点确定 BBox Container.prototype.getBBox = function () { // 所有的值可能在画布的可视区外 var minX = Infinity; var maxX = -Infinity; var minY = Infinity; var maxY = -Infinity; var xArr = []; var yArr = []; // 将可见元素、图形以及不为空的图形分组筛选出来,用于包围盒合并 var children = this.getChildren().filter(function (child) { return child.get('visible') && (!child.isGroup() || child.isGroup() && child.getChildren().length > 0); }); if (children.length > 0) { Object(_util_util__WEBPACK_IMPORTED_MODULE_2__["each"])(children, function (child) { var box = child.getBBox(); xArr.push(box.minX, box.maxX); yArr.push(box.minY, box.maxY); }); minX = Math.min.apply(null, xArr); maxX = Math.max.apply(null, xArr); minY = Math.min.apply(null, yArr); maxY = Math.max.apply(null, yArr); } else { minX = 0; maxX = 0; minY = 0; maxY = 0; } var box = { x: minX, y: minY, minX: minX, minY: minY, maxX: maxX, maxY: maxY, width: maxX - minX, height: maxY - minY }; return box; }; // 获取画布的包围盒 Container.prototype.getCanvasBBox = function () { var minX = Infinity; var maxX = -Infinity; var minY = Infinity; var maxY = -Infinity; var xArr = []; var yArr = []; // 将可见元素、图形以及不为空的图形分组筛选出来,用于包围盒合并 var children = this.getChildren().filter(function (child) { return child.get('visible') && (!child.isGroup() || child.isGroup() && child.getChildren().length > 0); }); if (children.length > 0) { Object(_util_util__WEBPACK_IMPORTED_MODULE_2__["each"])(children, function (child) { var box = child.getCanvasBBox(); xArr.push(box.minX, box.maxX); yArr.push(box.minY, box.maxY); }); minX = Math.min.apply(null, xArr); maxX = Math.max.apply(null, xArr); minY = Math.min.apply(null, yArr); maxY = Math.max.apply(null, yArr); } else { minX = 0; maxX = 0; minY = 0; maxY = 0; } var box = { x: minX, y: minY, minX: minX, minY: minY, maxX: maxX, maxY: maxY, width: maxX - minX, height: maxY - minY }; return box; }; Container.prototype.getDefaultCfg = function () { var cfg = _super.prototype.getDefaultCfg.call(this); cfg['children'] = []; return cfg; }; Container.prototype.onAttrChange = function (name, value, originValue) { _super.prototype.onAttrChange.call(this, name, value, originValue); if (name === 'matrix') { var totalMatrix = this.getTotalMatrix(); this._applyChildrenMarix(totalMatrix); } }; // 不但应用到自己身上还要应用于子元素 Container.prototype.applyMatrix = function (matrix) { var preTotalMatrix = this.getTotalMatrix(); _super.prototype.applyMatrix.call(this, matrix); var totalMatrix = this.getTotalMatrix(); // totalMatrix 没有发生变化时,这里仅考虑两者都为 null 时 // 不继续向下传递矩阵 if (totalMatrix === preTotalMatrix) { return; } this._applyChildrenMarix(totalMatrix); }; // 在子元素上设置矩阵 Container.prototype._applyChildrenMarix = function (totalMatrix) { var children = this.getChildren(); Object(_util_util__WEBPACK_IMPORTED_MODULE_2__["each"])(children, function (child) { child.applyMatrix(totalMatrix); }); }; // 兼容老版本的接口 Container.prototype.addShape = function () { var args = []; for (var _i = 0; _i < arguments.length; _i++) { args[_i] = arguments[_i]; } var type = args[0]; var cfg = args[1]; if (Object(_util_util__WEBPACK_IMPORTED_MODULE_2__["isObject"])(type)) { cfg = type; } else { cfg['type'] = type; } var shapeType = SHAPE_MAP[cfg.type]; if (!shapeType) { shapeType = Object(_util_util__WEBPACK_IMPORTED_MODULE_2__["upperFirst"])(cfg.type); SHAPE_MAP[cfg.type] = shapeType; } var ShapeBase = this.getShapeBase(); var shape = new ShapeBase[shapeType](cfg); this.add(shape); return shape; }; Container.prototype.addGroup = function () { var args = []; for (var _i = 0; _i < arguments.length; _i++) { args[_i] = arguments[_i]; } var groupClass = args[0], cfg = args[1]; var group; if (Object(_util_util__WEBPACK_IMPORTED_MODULE_2__["isFunction"])(groupClass)) { if (cfg) { group = new groupClass(cfg); } else { group = new groupClass({ // canvas, parent: this }); } } else { var tmpCfg = groupClass || {}; var TmpGroupClass = this.getGroupBase(); group = new TmpGroupClass(tmpCfg); } this.add(group); return group; }; Container.prototype.getCanvas = function () { var canvas; if (this.isCanvas()) { canvas = this; } else { canvas = this.get('canvas'); } return canvas; }; Container.prototype.getShape = function (x, y, ev) { // 如果不支持拾取,则直接返回 if (!Object(_util_util__WEBPACK_IMPORTED_MODULE_2__["isAllowCapture"])(this)) { return null; } var children = this.getChildren(); var shape; // 如果容器是 group if (!this.isCanvas()) { var v = [x, y, 1]; // 将 x, y 转换成对应于 group 的局部坐标 v = this.invertFromMatrix(v); if (!this.isClipped(v[0], v[1])) { shape = this._findShape(children, v[0], v[1], ev); } } else { shape = this._findShape(children, x, y, ev); } return shape; }; Container.prototype._findShape = function (children, x, y, ev) { var shape = null; for (var i = children.length - 1; i >= 0; i--) { var child = children[i]; if (Object(_util_util__WEBPACK_IMPORTED_MODULE_2__["isAllowCapture"])(child)) { if (child.isGroup()) { shape = child.getShape(x, y, ev); } else if (child.isHit(x, y)) { shape = child; } } if (shape) { break; } } return shape; }; Container.prototype.add = function (element) { var canvas = this.getCanvas(); var children = this.getChildren(); var timeline = this.get('timeline'); var preParent = element.getParent(); if (preParent) { removeChild(preParent, element, false); } element.set('parent', this); if (canvas) { setCanvas(element, canvas); } if (timeline) { setTimeline(element, timeline); } children.push(element); element.onCanvasChange('add'); this._applyElementMatrix(element); }; // 将当前容器的矩阵应用到子元素 Container.prototype._applyElementMatrix = function (element) { var totalMatrix = this.getTotalMatrix(); // 添加图形或者分组时,需要把当前图元的矩阵设置进去 if (totalMatrix) { element.applyMatrix(totalMatrix); } }; Container.prototype.getChildren = function () { return this.get('children'); }; Container.prototype.sort = function () { var children = this.getChildren(); // 稳定排序 Object(_util_util__WEBPACK_IMPORTED_MODULE_2__["each"])(children, function (child, index) { child[INDEX] = index; return child; }); children.sort(getComparer(function (obj1, obj2) { return obj1.get('zIndex') - obj2.get('zIndex'); })); this.onCanvasChange('sort'); }; Container.prototype.clear = function () { this.set('clearing', true); if (this.destroyed) { return; } var children = this.getChildren(); for (var i = children.length - 1; i >= 0; i--) { children[i].destroy(); // 销毁子元素 } this.set('children', []); this.onCanvasChange('clear'); this.set('clearing', false); }; Container.prototype.destroy = function () { if (this.get('destroyed')) { return; } this.clear(); _super.prototype.destroy.call(this); }; /** * 获取第一个子元素 * @return {IElement} 第一个元素 */ Container.prototype.getFirst = function () { return this.getChildByIndex(0); }; /** * 获取最后一个子元素 * @return {IElement} 元素 */ Container.prototype.getLast = function () { var children = this.getChildren(); return this.getChildByIndex(children.length - 1); }; /** * 根据索引获取子元素 * @return {IElement} 第一个元素 */ Container.prototype.getChildByIndex = function (index) { var children = this.getChildren(); return children[index]; }; /** * 子元素的数量 * @return {number} 子元素数量 */ Container.prototype.getCount = function () { var children = this.getChildren(); return children.length; }; /** * 是否包含对应元素 * @param {IElement} element 元素 * @return {boolean} */ Container.prototype.contain = function (element) { var children = this.getChildren(); return children.indexOf(element) > -1; }; /** * 移除对应子元素 * @param {IElement} element 子元素 * @param {boolean} destroy 是否销毁子元素,默认为 true */ Container.prototype.removeChild = function (element, destroy) { if (destroy === void 0) { destroy = true; } if (this.contain(element)) { element.remove(destroy); } }; /** * 查找所有匹配的元素 * @param {ElementFilterFn} fn 匹配函数 * @return {IElement[]} 元素数组 */ Container.prototype.findAll = function (fn) { var rst = []; var children = this.getChildren(); Object(_util_util__WEBPACK_IMPORTED_MODULE_2__["each"])(children, function (element) { if (fn(element)) { rst.push(element); } if (element.isGroup()) { rst = rst.concat(element.findAll(fn)); } }); return rst; }; /** * 查找元素,找到第一个返回 * @param {ElementFilterFn} fn 匹配函数 * @return {IElement|null} 元素,可以为空 */ Container.prototype.find = function (fn) { var rst = null; var children = this.getChildren(); Object(_util_util__WEBPACK_IMPORTED_MODULE_2__["each"])(children, function (element) { if (fn(element)) { rst = element; } else if (element.isGroup()) { rst = element.find(fn); } if (rst) { return false; } }); return rst; }; /** * 根据 ID 查找元素 * @param {string} id 元素 id * @return {IElement|null} 元素 */ Container.prototype.findById = function (id) { return this.find(function (element) { return element.get('id') === id; }); }; /** * 该方法即将废弃,不建议使用 * 根据 className 查找元素 * TODO: 该方式定义暂时只给 G6 3.3 以后的版本使用,待 G6 中的 findByClassName 方法移除后,G 也需要同步移除 * @param {string} className 元素 className * @return {IElement | null} 元素 */ Container.prototype.findByClassName = function (className) { return this.find(function (element) { return element.get('className') === className; }); }; /** * 根据 name 查找元素列表 * @param {string} name 元素名称 * @return {IElement[]} 元素 */ Container.prototype.findAllByName = function (name) { return this.findAll(function (element) { return element.get('name') === name; }); }; return Container; }(_element__WEBPACK_IMPORTED_MODULE_1__["default"]); /* harmony default export */ __webpack_exports__["default"] = (Container); /***/ }), /***/ "./node_modules/_@antv_g-base@0.5.0-beta.1@@antv/g-base/esm/abstract/element.js": /*!**************************************************************************************!*\ !*** ./node_modules/_@antv_g-base@0.5.0-beta.1@@antv/g-base/esm/abstract/element.js ***! \**************************************************************************************/ /*! exports provided: default */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "./node_modules/_tslib@1.13.0@tslib/tslib.es6.js"); /* harmony import */ var _antv_util__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @antv/util */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/index.js"); /* harmony import */ var _antv_matrix_util__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @antv/matrix-util */ "./node_modules/_@antv_matrix-util@3.1.0-beta.2@@antv/matrix-util/esm/index.js"); /* harmony import */ var _util_util__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../util/util */ "./node_modules/_@antv_g-base@0.5.0-beta.1@@antv/g-base/esm/util/util.js"); /* harmony import */ var _util_matrix__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../util/matrix */ "./node_modules/_@antv_g-base@0.5.0-beta.1@@antv/g-base/esm/util/matrix.js"); /* harmony import */ var _base__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./base */ "./node_modules/_@antv_g-base@0.5.0-beta.1@@antv/g-base/esm/abstract/base.js"); var MATRIX = 'matrix'; var CLONE_CFGS = ['zIndex', 'capture', 'visible', 'type']; // 可以在 toAttrs 中设置,但不属于绘图属性的字段 var RESERVED_PORPS = ['repeat']; var DELEGATION_SPLIT = ':'; var WILDCARD = '*'; // 需要考虑数组嵌套数组的场景 // 数组嵌套对象的场景不考虑 function _cloneArrayAttr(arr) { var result = []; for (var i = 0; i < arr.length; i++) { if (Object(_antv_util__WEBPACK_IMPORTED_MODULE_1__["isArray"])(arr[i])) { result.push([].concat(arr[i])); } else { result.push(arr[i]); } } return result; } function getFormatFromAttrs(toAttrs, shape) { var fromAttrs = {}; var attrs = shape.attrs; for (var k in toAttrs) { fromAttrs[k] = attrs[k]; } return fromAttrs; } function getFormatToAttrs(props, shape) { var toAttrs = {}; var attrs = shape.attr(); Object(_antv_util__WEBPACK_IMPORTED_MODULE_1__["each"])(props, function (v, k) { if (RESERVED_PORPS.indexOf(k) === -1 && !Object(_antv_util__WEBPACK_IMPORTED_MODULE_1__["isEqual"])(attrs[k], v)) { toAttrs[k] = v; } }); return toAttrs; } function checkExistedAttrs(animations, animation) { if (animation.onFrame) { return animations; } var startTime = animation.startTime, delay = animation.delay, duration = animation.duration; var hasOwnProperty = Object.prototype.hasOwnProperty; Object(_antv_util__WEBPACK_IMPORTED_MODULE_1__["each"])(animations, function (item) { // 后一个动画开始执行的时间 < 前一个动画的结束时间 && 后一个动画的执行时间 > 前一个动画的延迟 if (startTime + delay < item.startTime + item.delay + item.duration && duration > item.delay) { Object(_antv_util__WEBPACK_IMPORTED_MODULE_1__["each"])(animation.toAttrs, function (v, k) { if (hasOwnProperty.call(item.toAttrs, k)) { delete item.toAttrs[k]; delete item.fromAttrs[k]; } }); } }); return animations; } var Element = /** @class */ function (_super) { Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(Element, _super); function Element(cfg) { var _this = _super.call(this, cfg) || this; /** * @protected * 图形属性 * @type {ShapeAttrs} */ _this.attrs = {}; var attrs = _this.getDefaultAttrs(); Object(_antv_util__WEBPACK_IMPORTED_MODULE_1__["mix"])(attrs, cfg.attrs); _this.attrs = attrs; _this.initAttrs(attrs); _this.initAnimate(); // 初始化动画 return _this; } // override Element.prototype.getDefaultCfg = function () { return { visible: true, capture: true, zIndex: 0 }; }; /** * @protected * 获取默认的属相 */ Element.prototype.getDefaultAttrs = function () { return { matrix: this.getDefaultMatrix(), opacity: 1 }; }; /** * @protected * 一些方法调用会引起画布变化 * @param {ChangeType} changeType 改变的类型 */ Element.prototype.onCanvasChange = function (changeType) {}; /** * @protected * 初始化属性,有些属性需要加工 * @param {object} attrs 属性值 */ Element.prototype.initAttrs = function (attrs) {}; /** * @protected * 初始化动画 */ Element.prototype.initAnimate = function () { this.set('animable', true); this.set('animating', false); }; Element.prototype.isGroup = function () { return false; }; Element.prototype.getParent = function () { return this.get('parent'); }; Element.prototype.getCanvas = function () { return this.get('canvas'); }; Element.prototype.attr = function () { var _a; var args = []; for (var _i = 0; _i < arguments.length; _i++) { args[_i] = arguments[_i]; } var name = args[0], value = args[1]; if (!name) return this.attrs; if (Object(_antv_util__WEBPACK_IMPORTED_MODULE_1__["isObject"])(name)) { for (var k in name) { this.setAttr(k, name[k]); } this.afterAttrsChange(name); return this; } if (args.length === 2) { this.setAttr(name, value); this.afterAttrsChange((_a = {}, _a[name] = value, _a)); return this; } return this.attrs[name]; }; // 是否被裁剪,被裁剪则不显示,不参与拾取 Element.prototype.isClipped = function (refX, refY) { var clip = this.getClip(); return clip && !clip.isHit(refX, refY); }; /** * 内部设置属性值的接口 * @param {string} name 属性名 * @param {any} value 属性值 */ Element.prototype.setAttr = function (name, value) { var originValue = this.attrs[name]; if (originValue !== value) { this.attrs[name] = value; this.onAttrChange(name, value, originValue); } }; /** * @protected * 属性值发生改变 * @param {string} name 属性名 * @param {any} value 属性值 * @param {any} originValue 属性值 */ Element.prototype.onAttrChange = function (name, value, originValue) { if (name === 'matrix') { this.set('totalMatrix', null); } }; /** * 属性更改后需要做的事情 * @protected */ Element.prototype.afterAttrsChange = function (targetAttrs) { if (this.cfg.isClipShape) { var applyTo = this.cfg.applyTo; if (applyTo) { applyTo.onCanvasChange('clip'); } } else { this.onCanvasChange('attr'); } }; Element.prototype.show = function () { // 不是高频操作直接使用 set this.set('visible', true); this.onCanvasChange('show'); return this; }; Element.prototype.hide = function () { // 不是高频操作直接使用 set this.set('visible', false); this.onCanvasChange('hide'); return this; }; Element.prototype.setZIndex = function (zIndex) { this.set('zIndex', zIndex); var parent = this.getParent(); if (parent) { // 改变 zIndex 不应该立即触发渲染 (调用 onCanvasChange('zIndex')),需要经过 sort 再触发 parent.sort(); } return this; }; Element.prototype.toFront = function () { var parent = this.getParent(); if (!parent) { return; } var children = parent.getChildren(); var el = this.get('el'); var index = children.indexOf(this); children.splice(index, 1); children.push(this); this.onCanvasChange('zIndex'); }; Element.prototype.toBack = function () { var parent = this.getParent(); if (!parent) { return; } var children = parent.getChildren(); var el = this.get('el'); var index = children.indexOf(this); children.splice(index, 1); children.unshift(this); this.onCanvasChange('zIndex'); }; Element.prototype.remove = function (destroy) { if (destroy === void 0) { destroy = true; } var parent = this.getParent(); if (parent) { Object(_util_util__WEBPACK_IMPORTED_MODULE_3__["removeFromArray"])(parent.getChildren(), this); if (!parent.get('clearing')) { // 如果父元素正在清理,当前元素不触发 remove this.onCanvasChange('remove'); } } else { this.onCanvasChange('remove'); } if (destroy) { this.destroy(); } }; Element.prototype.resetMatrix = function () { this.attr(MATRIX, this.getDefaultMatrix()); this.onCanvasChange('matrix'); }; Element.prototype.getMatrix = function () { return this.attr(MATRIX); }; Element.prototype.setMatrix = function (m) { this.attr(MATRIX, m); this.onCanvasChange('matrix'); }; // 获取总的 matrix Element.prototype.getTotalMatrix = function () { var totalMatrix = this.cfg.totalMatrix; if (!totalMatrix) { var currentMatrix = this.attr('matrix'); var parentMatrix = this.cfg.parentMatrix; if (parentMatrix && currentMatrix) { totalMatrix = Object(_util_matrix__WEBPACK_IMPORTED_MODULE_4__["multiplyMatrix"])(parentMatrix, currentMatrix); } else { totalMatrix = currentMatrix || parentMatrix; } this.set('totalMatrix', totalMatrix); } return totalMatrix; }; // 上层分组设置 matrix Element.prototype.applyMatrix = function (matrix) { var currentMatrix = this.attr('matrix'); var totalMatrix = null; if (matrix && currentMatrix) { totalMatrix = Object(_util_matrix__WEBPACK_IMPORTED_MODULE_4__["multiplyMatrix"])(matrix, currentMatrix); } else { totalMatrix = currentMatrix || matrix; } this.set('totalMatrix', totalMatrix); this.set('parentMatrix', matrix); }; /** * @protected * 获取默认的矩阵 * @returns {number[]|null} 默认的矩阵 */ Element.prototype.getDefaultMatrix = function () { return null; }; // 将向量应用设置的矩阵 Element.prototype.applyToMatrix = function (v) { var matrix = this.attr('matrix'); if (matrix) { return Object(_util_matrix__WEBPACK_IMPORTED_MODULE_4__["multiplyVec2"])(matrix, v); } return v; }; // 根据设置的矩阵,将向量转换相对于图形/分组的位置 Element.prototype.invertFromMatrix = function (v) { var matrix = this.attr('matrix'); if (matrix) { var invertMatrix = Object(_util_matrix__WEBPACK_IMPORTED_MODULE_4__["invert"])(matrix); if (invertMatrix) { return Object(_util_matrix__WEBPACK_IMPORTED_MODULE_4__["multiplyVec2"])(invertMatrix, v); } } return v; }; // 设置 clip Element.prototype.setClip = function (clipCfg) { var canvas = this.getCanvas(); // 应该只设置当前元素的 clip,不应该去修改 clip 本身,方便 clip 被复用 // TODO: setClip 的传参既 shape 配置,也支持 shape 对象 // const preShape = this.get('clipShape'); // if (preShape) { // // 将之前的 clipShape 销毁 // preShape.destroy(); // } var clipShape = null; // 如果配置项为 null,则不移除 clipShape if (clipCfg) { var ShapeBase = this.getShapeBase(); var shapeType = Object(_antv_util__WEBPACK_IMPORTED_MODULE_1__["upperFirst"])(clipCfg.type); var Cons = ShapeBase[shapeType]; if (Cons) { clipShape = new Cons({ type: clipCfg.type, isClipShape: true, applyTo: this, attrs: clipCfg.attrs, canvas: canvas }); } } this.set('clipShape', clipShape); this.onCanvasChange('clip'); return clipShape; }; Element.prototype.getClip = function () { // 高频率调用的地方直接使用 this.cfg.xxx var clipShape = this.cfg.clipShape; // 未设置时返回 Null,保证一致性 if (!clipShape) { return null; } return clipShape; }; Element.prototype.clone = function () { var _this = this; var originAttrs = this.attrs; var attrs = {}; Object(_antv_util__WEBPACK_IMPORTED_MODULE_1__["each"])(originAttrs, function (i, k) { if (Object(_antv_util__WEBPACK_IMPORTED_MODULE_1__["isArray"])(originAttrs[k])) { attrs[k] = _cloneArrayAttr(originAttrs[k]); } else { attrs[k] = originAttrs[k]; } }); var cons = this.constructor; // @ts-ignore var clone = new cons({ attrs: attrs }); Object(_antv_util__WEBPACK_IMPORTED_MODULE_1__["each"])(CLONE_CFGS, function (cfgName) { clone.set(cfgName, _this.get(cfgName)); }); return clone; }; Element.prototype.destroy = function () { var destroyed = this.destroyed; if (destroyed) { return; } this.attrs = {}; _super.prototype.destroy.call(this); // this.onCanvasChange('destroy'); }; /** * 是否处于动画暂停状态 * @return {boolean} 是否处于动画暂停状态 */ Element.prototype.isAnimatePaused = function () { return this.get('_pause').isPaused; }; /** * 执行动画,支持多种函数签名 * 1. animate(toAttrs: ElementAttrs, duration: number, easing?: string, callback?: () => void, delay?: number) * 2. animate(onFrame: OnFrame, duration: number, easing?: string, callback?: () => void, delay?: number) * 3. animate(toAttrs: ElementAttrs, cfg: AnimateCfg) * 4. animate(onFrame: OnFrame, cfg: AnimateCfg) * 各个参数的含义为: * toAttrs 动画最终状态 * onFrame 自定义帧动画函数 * duration 动画执行时间 * easing 动画缓动效果 * callback 动画执行后的回调 * delay 动画延迟时间 */ Element.prototype.animate = function () { var args = []; for (var _i = 0; _i < arguments.length; _i++) { args[_i] = arguments[_i]; } this.set('animating', true); var timeline = this.get('timeline'); if (!timeline) { timeline = this.get('canvas').get('timeline'); this.set('timeline', timeline); } var animations = this.get('animations') || []; // 初始化 tick if (!timeline.timer) { timeline.initTimer(); } var toAttrs = args[0], duration = args[1], _a = args[2], easing = _a === void 0 ? 'easeLinear' : _a, _b = args[3], callback = _b === void 0 ? _antv_util__WEBPACK_IMPORTED_MODULE_1__["noop"] : _b, _c = args[4], delay = _c === void 0 ? 0 : _c; var onFrame; var repeat; var pauseCallback; var resumeCallback; var animateCfg; // 第二个参数,既可以是动画最终状态 toAttrs,也可以是自定义帧动画函数 onFrame if (Object(_antv_util__WEBPACK_IMPORTED_MODULE_1__["isFunction"])(toAttrs)) { onFrame = toAttrs; toAttrs = {}; } else if (Object(_antv_util__WEBPACK_IMPORTED_MODULE_1__["isObject"])(toAttrs) && toAttrs.onFrame) { // 兼容 3.0 中的写法,onFrame 和 repeat 可在 toAttrs 中设置 onFrame = toAttrs.onFrame; repeat = toAttrs.repeat; } // 第二个参数,既可以是执行时间 duration,也可以是动画参数 animateCfg if (Object(_antv_util__WEBPACK_IMPORTED_MODULE_1__["isObject"])(duration)) { animateCfg = duration; duration = animateCfg.duration; easing = animateCfg.easing || 'easeLinear'; delay = animateCfg.delay || 0; // animateCfg 中的设置优先级更高 repeat = animateCfg.repeat || repeat || false; callback = animateCfg.callback || _antv_util__WEBPACK_IMPORTED_MODULE_1__["noop"]; pauseCallback = animateCfg.pauseCallback || _antv_util__WEBPACK_IMPORTED_MODULE_1__["noop"]; resumeCallback = animateCfg.resumeCallback || _antv_util__WEBPACK_IMPORTED_MODULE_1__["noop"]; } else { // 第四个参数,既可以是回调函数 callback,也可以是延迟时间 delay if (Object(_antv_util__WEBPACK_IMPORTED_MODULE_1__["isNumber"])(callback)) { delay = callback; callback = null; } // 第三个参数,既可以是缓动参数 easing,也可以是回调函数 callback if (Object(_antv_util__WEBPACK_IMPORTED_MODULE_1__["isFunction"])(easing)) { callback = easing; easing = 'easeLinear'; } else { easing = easing || 'easeLinear'; } } var formatToAttrs = getFormatToAttrs(toAttrs, this); var animation = { fromAttrs: getFormatFromAttrs(formatToAttrs, this), toAttrs: formatToAttrs, duration: duration, easing: easing, repeat: repeat, callback: callback, pauseCallback: pauseCallback, resumeCallback: resumeCallback, delay: delay, startTime: timeline.getTime(), id: Object(_antv_util__WEBPACK_IMPORTED_MODULE_1__["uniqueId"])(), onFrame: onFrame, pathFormatted: false }; // 如果动画元素队列中已经有这个图形了 if (animations.length > 0) { // 先检查是否需要合并属性。若有相同的动画,将该属性从前一个动画中删除,直接用后一个动画中 animations = checkExistedAttrs(animations, animation); } else { // 否则将图形添加到动画元素队列 timeline.addAnimator(this); } animations.push(animation); this.set('animations', animations); this.set('_pause', { isPaused: false }); }; /** * 停止动画 * @param {boolean} toEnd 是否到动画的最终状态 */ Element.prototype.stopAnimate = function (toEnd) { var _this = this; if (toEnd === void 0) { toEnd = true; } var animations = this.get('animations'); Object(_antv_util__WEBPACK_IMPORTED_MODULE_1__["each"])(animations, function (animation) { // 将动画执行到最后一帧 if (toEnd) { if (animation.onFrame) { _this.attr(animation.onFrame(1)); } else { _this.attr(animation.toAttrs); } } if (animation.callback) { // 动画停止时的回调 animation.callback(); } }); this.set('animating', false); this.set('animations', []); }; /** * 暂停动画 */ Element.prototype.pauseAnimate = function () { var timeline = this.get('timeline'); var animations = this.get('animations'); var pauseTime = timeline.getTime(); Object(_antv_util__WEBPACK_IMPORTED_MODULE_1__["each"])(animations, function (animation) { animation._paused = true; animation._pauseTime = pauseTime; if (animation.pauseCallback) { // 动画暂停时的回调 animation.pauseCallback(); } }); // 记录下是在什么时候暂停的 this.set('_pause', { isPaused: true, pauseTime: pauseTime }); return this; }; /** * 恢复动画 */ Element.prototype.resumeAnimate = function () { var timeline = this.get('timeline'); var current = timeline.getTime(); var animations = this.get('animations'); var pauseTime = this.get('_pause').pauseTime; // 之后更新属性需要计算动画已经执行的时长,如果暂停了,就把初始时间调后 Object(_antv_util__WEBPACK_IMPORTED_MODULE_1__["each"])(animations, function (animation) { animation.startTime = animation.startTime + (current - pauseTime); animation._paused = false; animation._pauseTime = null; if (animation.resumeCallback) { animation.resumeCallback(); } }); this.set('_pause', { isPaused: false }); this.set('animations', animations); return this; }; /** * 触发委托事件 * @param {string} type 事件类型 * @param {GraphEvent} eventObj 事件对象 */ Element.prototype.emitDelegation = function (type, eventObj) { var _this = this; var paths = eventObj.propagationPath; var events = this.getEvents(); var relativeShape; if (type === 'mouseenter') { relativeShape = eventObj.fromShape; } else if (type === 'mouseleave') { relativeShape = eventObj.toShape; } var _loop_1 = function (i) { var element = paths[i]; // 暂定跟 name 绑定 var name_1 = element.get('name'); if (name_1) { // 第一个 mouseenter 和 mouseleave 的停止即可,因为后面的都是前面的 Parent if ( // 只有 element 是 Group 或者 Canvas 的时候,才需要判断 isParent (element.isGroup() || element.isCanvas && element.isCanvas()) && relativeShape && Object(_util_util__WEBPACK_IMPORTED_MODULE_3__["isParent"])(element, relativeShape)) { return "break"; } if (Object(_antv_util__WEBPACK_IMPORTED_MODULE_1__["isArray"])(name_1)) { Object(_antv_util__WEBPACK_IMPORTED_MODULE_1__["each"])(name_1, function (subName) { _this.emitDelegateEvent(element, subName, eventObj); }); } else { this_1.emitDelegateEvent(element, name_1, eventObj); } } }; var this_1 = this; // 至少有一个对象,且第一个对象为 shape for (var i = 0; i < paths.length; i++) { var state_1 = _loop_1(i); if (state_1 === "break") break; } }; Element.prototype.emitDelegateEvent = function (element, name, eventObj) { var events = this.getEvents(); // 事件委托的形式 name:type var eventName = name + DELEGATION_SPLIT + eventObj.type; if (events[eventName] || events[WILDCARD]) { // 对于通配符 *,事件名称 = 委托事件名称 eventObj.name = eventName; eventObj.currentTarget = element; eventObj.delegateTarget = this; // 将委托事件的监听对象 delegateObject 挂载到事件对象上 eventObj.delegateObject = element.get('delegateObject'); this.emit(eventName, eventObj); } }; /** * 移动元素 * @param {number} translateX 水平移动距离 * @param {number} translateY 垂直移动距离 * @return {IElement} 元素 */ Element.prototype.translate = function (translateX, translateY) { if (translateX === void 0) { translateX = 0; } if (translateY === void 0) { translateY = 0; } var matrix = this.getMatrix(); var newMatrix = _antv_matrix_util__WEBPACK_IMPORTED_MODULE_2__["ext"].transform(matrix, [['t', translateX, translateY]]); this.setMatrix(newMatrix); return this; }; /** * 移动元素到目标位置 * @param {number} targetX 目标位置的水平坐标 * @param {number} targetX 目标位置的垂直坐标 * @return {IElement} 元素 */ Element.prototype.move = function (targetX, targetY) { var x = this.attr('x') || 0; var y = this.attr('y') || 0; this.translate(targetX - x, targetY - y); return this; }; /** * 移动元素到目标位置,等价于 move 方法。由于 moveTo 的语义性更强,因此在文档中推荐使用 moveTo 方法 * @param {number} targetX 目标位置的 x 轴坐标 * @param {number} targetY 目标位置的 y 轴坐标 * @return {IElement} 元素 */ Element.prototype.moveTo = function (targetX, targetY) { return this.move(targetX, targetY); }; /** * 缩放元素 * @param {number} ratioX 水平缩放比例 * @param {number} ratioY 垂直缩放比例 * @return {IElement} 元素 */ Element.prototype.scale = function (ratioX, ratioY) { var matrix = this.getMatrix(); var newMatrix = _antv_matrix_util__WEBPACK_IMPORTED_MODULE_2__["ext"].transform(matrix, [['s', ratioX, ratioY || ratioX]]); this.setMatrix(newMatrix); return this; }; /** * 以画布左上角 (0, 0) 为中心旋转元素 * @param {number} radian 旋转角度(弧度值) * @return {IElement} 元素 */ Element.prototype.rotate = function (radian) { var matrix = this.getMatrix(); var newMatrix = _antv_matrix_util__WEBPACK_IMPORTED_MODULE_2__["ext"].transform(matrix, [['r', radian]]); this.setMatrix(newMatrix); return this; }; /** * 以起始点为中心旋转元素 * @param {number} radian 旋转角度(弧度值) * @return {IElement} 元素 */ Element.prototype.rotateAtStart = function (rotate) { var _a = this.attr(), x = _a.x, y = _a.y; var matrix = this.getMatrix(); var newMatrix = _antv_matrix_util__WEBPACK_IMPORTED_MODULE_2__["ext"].transform(matrix, [['t', -x, -y], ['r', rotate], ['t', x, y]]); this.setMatrix(newMatrix); return this; }; /** * 以任意点 (x, y) 为中心旋转元素 * @param {number} radian 旋转角度(弧度值) * @return {IElement} 元素 */ Element.prototype.rotateAtPoint = function (x, y, rotate) { var matrix = this.getMatrix(); var newMatrix = _antv_matrix_util__WEBPACK_IMPORTED_MODULE_2__["ext"].transform(matrix, [['t', -x, -y], ['r', rotate], ['t', x, y]]); this.setMatrix(newMatrix); return this; }; return Element; }(_base__WEBPACK_IMPORTED_MODULE_5__["default"]); /* harmony default export */ __webpack_exports__["default"] = (Element); /***/ }), /***/ "./node_modules/_@antv_g-base@0.5.0-beta.1@@antv/g-base/esm/abstract/group.js": /*!************************************************************************************!*\ !*** ./node_modules/_@antv_g-base@0.5.0-beta.1@@antv/g-base/esm/abstract/group.js ***! \************************************************************************************/ /*! exports provided: default */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "./node_modules/_tslib@1.13.0@tslib/tslib.es6.js"); /* harmony import */ var _container__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./container */ "./node_modules/_@antv_g-base@0.5.0-beta.1@@antv/g-base/esm/abstract/container.js"); var AbstractGroup = /** @class */ function (_super) { Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(AbstractGroup, _super); function AbstractGroup() { return _super !== null && _super.apply(this, arguments) || this; } AbstractGroup.prototype.isGroup = function () { return true; }; AbstractGroup.prototype.isEntityGroup = function () { return false; }; AbstractGroup.prototype.clone = function () { var clone = _super.prototype.clone.call(this); // 获取构造函数 var children = this.getChildren(); for (var i = 0; i < children.length; i++) { var child = children[i]; clone.add(child.clone()); } return clone; }; return AbstractGroup; }(_container__WEBPACK_IMPORTED_MODULE_1__["default"]); /* harmony default export */ __webpack_exports__["default"] = (AbstractGroup); /***/ }), /***/ "./node_modules/_@antv_g-base@0.5.0-beta.1@@antv/g-base/esm/abstract/shape.js": /*!************************************************************************************!*\ !*** ./node_modules/_@antv_g-base@0.5.0-beta.1@@antv/g-base/esm/abstract/shape.js ***! \************************************************************************************/ /*! exports provided: default */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "./node_modules/_tslib@1.13.0@tslib/tslib.es6.js"); /* harmony import */ var _element__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./element */ "./node_modules/_@antv_g-base@0.5.0-beta.1@@antv/g-base/esm/abstract/element.js"); /* harmony import */ var _util_matrix__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../util/matrix */ "./node_modules/_@antv_g-base@0.5.0-beta.1@@antv/g-base/esm/util/matrix.js"); var AbstractShape = /** @class */ function (_super) { Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(AbstractShape, _super); function AbstractShape(cfg) { return _super.call(this, cfg) || this; } // 是否在包围盒内 AbstractShape.prototype._isInBBox = function (refX, refY) { var bbox = this.getBBox(); return bbox.minX <= refX && bbox.maxX >= refX && bbox.minY <= refY && bbox.maxY >= refY; }; /** * 属性更改后需要做的事情 * @protected * @param {ShapeAttrs} targetAttrs 渲染的图像属性 */ AbstractShape.prototype.afterAttrsChange = function (targetAttrs) { _super.prototype.afterAttrsChange.call(this, targetAttrs); this.clearCacheBBox(); }; // 计算包围盒时,需要缓存,这是一个高频的操作 AbstractShape.prototype.getBBox = function () { var bbox = this.cfg.bbox; if (!bbox) { bbox = this.calculateBBox(); this.set('bbox', bbox); } return bbox; }; // 计算相对于画布的包围盒 AbstractShape.prototype.getCanvasBBox = function () { var canvasBBox = this.cfg.canvasBBox; if (!canvasBBox) { canvasBBox = this.calculateCanvasBBox(); this.set('canvasBBox', canvasBBox); } return canvasBBox; }; AbstractShape.prototype.applyMatrix = function (matrix) { _super.prototype.applyMatrix.call(this, matrix); // 清理掉缓存的包围盒 this.set('canvasBBox', null); }; /** * 计算相对于画布的包围盒,默认等同于 bbox * @return {BBox} 包围盒 */ AbstractShape.prototype.calculateCanvasBBox = function () { var bbox = this.getBBox(); var totalMatrix = this.getTotalMatrix(); var minX = bbox.minX, minY = bbox.minY, maxX = bbox.maxX, maxY = bbox.maxY; if (totalMatrix) { var topLeft = Object(_util_matrix__WEBPACK_IMPORTED_MODULE_2__["multiplyVec2"])(totalMatrix, [bbox.minX, bbox.minY]); var topRight = Object(_util_matrix__WEBPACK_IMPORTED_MODULE_2__["multiplyVec2"])(totalMatrix, [bbox.maxX, bbox.minY]); var bottomLeft = Object(_util_matrix__WEBPACK_IMPORTED_MODULE_2__["multiplyVec2"])(totalMatrix, [bbox.minX, bbox.maxY]); var bottomRight = Object(_util_matrix__WEBPACK_IMPORTED_MODULE_2__["multiplyVec2"])(totalMatrix, [bbox.maxX, bbox.maxY]); minX = Math.min(topLeft[0], topRight[0], bottomLeft[0], bottomRight[0]); maxX = Math.max(topLeft[0], topRight[0], bottomLeft[0], bottomRight[0]); minY = Math.min(topLeft[1], topRight[1], bottomLeft[1], bottomRight[1]); maxY = Math.max(topLeft[1], topRight[1], bottomLeft[1], bottomRight[1]); } var attrs = this.attrs; // 如果存在 shadow 则计算 shadow if (attrs.shadowColor) { var _a = attrs.shadowBlur, shadowBlur = _a === void 0 ? 0 : _a, _b = attrs.shadowOffsetX, shadowOffsetX = _b === void 0 ? 0 : _b, _c = attrs.shadowOffsetY, shadowOffsetY = _c === void 0 ? 0 : _c; var shadowLeft = minX - shadowBlur + shadowOffsetX; var shadowRight = maxX + shadowBlur + shadowOffsetX; var shadowTop = minY - shadowBlur + shadowOffsetY; var shadowBottom = maxY + shadowBlur + shadowOffsetY; minX = Math.min(minX, shadowLeft); maxX = Math.max(maxX, shadowRight); minY = Math.min(minY, shadowTop); maxY = Math.max(maxY, shadowBottom); } return { x: minX, y: minY, minX: minX, minY: minY, maxX: maxX, maxY: maxY, width: maxX - minX, height: maxY - minY }; }; /** * @protected * 清理缓存的 bbox */ AbstractShape.prototype.clearCacheBBox = function () { this.set('bbox', null); this.set('canvasBBox', null); }; // 实现接口 AbstractShape.prototype.isClipShape = function () { return this.get('isClipShape'); }; /** * @protected * 不同的图形自己实现是否在图形内部的逻辑,要判断边和填充区域 * @param {number} refX 相对于图形的坐标 x * @param {number} refY 相对于图形的坐标 Y * @return {boolean} 点是否在图形内部 */ AbstractShape.prototype.isInShape = function (refX, refY) { return false; }; /** * 是否仅仅使用 BBox 检测就可以判定拾取到图形 * 默认是 false,但是有些图形例如 image、marker 等都可直接使用 BBox 的检测而不需要使用图形拾取 * @return {Boolean} 仅仅使用 BBox 进行拾取 */ AbstractShape.prototype.isOnlyHitBox = function () { return false; }; // 不同的 Shape 各自实现 AbstractShape.prototype.isHit = function (x, y) { var startArrowShape = this.get('startArrowShape'); var endArrowShape = this.get('endArrowShape'); var vec = [x, y, 1]; vec = this.invertFromMatrix(vec); var refX = vec[0], refY = vec[1]; var inBBox = this._isInBBox(refX, refY); // 跳过图形的拾取,在某些图形中可以省略一倍的检测成本 if (this.isOnlyHitBox()) { return inBBox; } // 被裁减掉的和不在包围盒内的不进行计算 if (inBBox && !this.isClipped(refX, refY)) { // 对图形进行拾取判断 if (this.isInShape(refX, refY)) { return true; } // 对起始箭头进行拾取判断 if (startArrowShape && startArrowShape.isHit(refX, refY)) { return true; } // 对结束箭头进行拾取判断 if (endArrowShape && endArrowShape.isHit(refX, refY)) { return true; } } return false; }; return AbstractShape; }(_element__WEBPACK_IMPORTED_MODULE_1__["default"]); /* harmony default export */ __webpack_exports__["default"] = (AbstractShape); /***/ }), /***/ "./node_modules/_@antv_g-base@0.5.0-beta.1@@antv/g-base/esm/animate/timeline.js": /*!**************************************************************************************!*\ !*** ./node_modules/_@antv_g-base@0.5.0-beta.1@@antv/g-base/esm/animate/timeline.js ***! \**************************************************************************************/ /*! exports provided: default */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony import */ var _antv_util__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @antv/util */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/index.js"); /* harmony import */ var d3_timer__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! d3-timer */ "./node_modules/_d3-timer@1.0.10@d3-timer/src/index.js"); /* harmony import */ var d3_ease__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! d3-ease */ "./node_modules/_d3-ease@1.0.6@d3-ease/src/index.js"); /* harmony import */ var d3_interpolate__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! d3-interpolate */ "./node_modules/_d3-interpolate@1.4.0@d3-interpolate/src/index.js"); /* harmony import */ var _util_path__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../util/path */ "./node_modules/_@antv_g-base@0.5.0-beta.1@@antv/g-base/esm/util/path.js"); /* harmony import */ var _util_color__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../util/color */ "./node_modules/_@antv_g-base@0.5.0-beta.1@@antv/g-base/esm/util/color.js"); // 目前整体动画只需要数值和数组的差值计算 var IDENTITY_MATRIX = [1, 0, 0, 0, 1, 0, 0, 0, 1]; /** * 使用 ratio 进行插值计算来更新属性 * @param {IElement} shape 元素 * @param {Animation} animation 动画 * @param {number} ratio 比例 * @return {boolean} 动画是否执行完成 */ function _update(shape, animation, ratio) { var cProps = {}; // 此刻属性 var fromAttrs = animation.fromAttrs, toAttrs = animation.toAttrs; if (shape.destroyed) { return; } var interf; // 差值函数 for (var k in toAttrs) { if (!Object(_antv_util__WEBPACK_IMPORTED_MODULE_0__["isEqual"])(fromAttrs[k], toAttrs[k])) { if (k === 'path') { var toPath = toAttrs[k]; var fromPath = fromAttrs[k]; if (toPath.length > fromPath.length) { toPath = _util_path__WEBPACK_IMPORTED_MODULE_4__["parsePathString"](toAttrs[k]); // 终点状态 fromPath = _util_path__WEBPACK_IMPORTED_MODULE_4__["parsePathString"](fromAttrs[k]); // 起始状态 fromPath = _util_path__WEBPACK_IMPORTED_MODULE_4__["fillPathByDiff"](fromPath, toPath); fromPath = _util_path__WEBPACK_IMPORTED_MODULE_4__["formatPath"](fromPath, toPath); animation.fromAttrs.path = fromPath; animation.toAttrs.path = toPath; } else if (!animation.pathFormatted) { toPath = _util_path__WEBPACK_IMPORTED_MODULE_4__["parsePathString"](toAttrs[k]); fromPath = _util_path__WEBPACK_IMPORTED_MODULE_4__["parsePathString"](fromAttrs[k]); fromPath = _util_path__WEBPACK_IMPORTED_MODULE_4__["formatPath"](fromPath, toPath); animation.fromAttrs.path = fromPath; animation.toAttrs.path = toPath; animation.pathFormatted = true; } cProps[k] = []; for (var i = 0; i < toPath.length; i++) { var toPathPoint = toPath[i]; var fromPathPoint = fromPath[i]; var cPathPoint = []; for (var j = 0; j < toPathPoint.length; j++) { if (Object(_antv_util__WEBPACK_IMPORTED_MODULE_0__["isNumber"])(toPathPoint[j]) && fromPathPoint && Object(_antv_util__WEBPACK_IMPORTED_MODULE_0__["isNumber"])(fromPathPoint[j])) { interf = Object(d3_interpolate__WEBPACK_IMPORTED_MODULE_3__["interpolate"])(fromPathPoint[j], toPathPoint[j]); cPathPoint.push(interf(ratio)); } else { cPathPoint.push(toPathPoint[j]); } } cProps[k].push(cPathPoint); } } else if (k === 'matrix') { /* 对矩阵进行插值时,需要保证矩阵不为空,为空则使用单位矩阵 TODO: 二维和三维场景下单位矩阵不同,之后 WebGL 版需要做进一步处理 */ var matrixFn = Object(d3_interpolate__WEBPACK_IMPORTED_MODULE_3__["interpolateArray"])(fromAttrs[k] || IDENTITY_MATRIX, toAttrs[k] || IDENTITY_MATRIX); var currentMatrix = matrixFn(ratio); cProps[k] = currentMatrix; } else if (Object(_util_color__WEBPACK_IMPORTED_MODULE_5__["isColorProp"])(k) && Object(_util_color__WEBPACK_IMPORTED_MODULE_5__["isGradientColor"])(toAttrs[k])) { cProps[k] = toAttrs[k]; } else if (!Object(_antv_util__WEBPACK_IMPORTED_MODULE_0__["isFunction"])(toAttrs[k])) { // 非函数类型的值才能做插值 interf = Object(d3_interpolate__WEBPACK_IMPORTED_MODULE_3__["interpolate"])(fromAttrs[k], toAttrs[k]); cProps[k] = interf(ratio); } } } shape.attr(cProps); } /** * 根据自定义帧动画函数 onFrame 来更新属性 * @param {IElement} shape 元素 * @param {Animation} animation 动画 * @param {number} elapsed 动画执行时间(毫秒) * @return {boolean} 动画是否执行完成 */ function update(shape, animation, elapsed) { var startTime = animation.startTime, delay = animation.delay; // 如果还没有开始执行或暂停,先不更新 if (elapsed < startTime + delay || animation._paused) { return false; } var ratio; var duration = animation.duration; var easing = animation.easing; // 已执行时间 elapsed = elapsed - startTime - animation.delay; if (animation.repeat) { // 如果动画重复执行,则 elapsed > duration,计算 ratio 时需取模 ratio = elapsed % duration / duration; ratio = d3_ease__WEBPACK_IMPORTED_MODULE_2__[easing](ratio); } else { ratio = elapsed / duration; if (ratio < 1) { // 动画未执行完 ratio = d3_ease__WEBPACK_IMPORTED_MODULE_2__[easing](ratio); } else { // 动画已执行完 if (animation.onFrame) { shape.attr(animation.onFrame(1)); } else { shape.attr(animation.toAttrs); } return true; } } if (animation.onFrame) { var attrs = animation.onFrame(ratio); shape.attr(attrs); } else { _update(shape, animation, ratio); } return false; } var Timeline = /** @class */ function () { /** * 时间轴构造函数,依赖于画布 * @param {} */ function Timeline(canvas) { /** * 执行动画的元素列表 * @type {IElement[]} */ this.animators = []; /** * 当前时间 * @type {number} */ this.current = 0; /** * 定时器 * @type {d3Timer.Timer} */ this.timer = null; this.canvas = canvas; } /** * 初始化定时器 */ Timeline.prototype.initTimer = function () { console.log('here... initTimer') var _this = this; var isFinished = false; var shape; var animations; var animation; this.timer = d3_timer__WEBPACK_IMPORTED_MODULE_1__["timer"](function (elapsed) { _this.current = elapsed; console.log('here... run timer') if (_this.animators.length > 0) { for (var i = _this.animators.length - 1; i >= 0; i--) { shape = _this.animators[i]; if (shape.destroyed) { // 如果已经被销毁,直接移出队列 _this.removeAnimator(i); continue; } if (!shape.isAnimatePaused()) { animations = shape.get('animations'); for (var j = animations.length - 1; j >= 0; j--) { animation = animations[j]; isFinished = update(shape, animation, elapsed); if (isFinished) { animations.splice(j, 1); isFinished = false; if (animation.callback) { animation.callback(); } } } } if (animations.length === 0) { _this.removeAnimator(i); } } var autoDraw = _this.canvas.get('autoDraw'); // 非自动渲染模式下,手动调用 canvas.draw() 重新渲染 if (!autoDraw) { _this.canvas.draw(); } } }); }; /** * 增加动画元素 */ Timeline.prototype.addAnimator = function (shape) { this.animators.push(shape); }; /** * 移除动画元素 */ Timeline.prototype.removeAnimator = function (index) { this.animators.splice(index, 1); }; /** * 是否有动画在执行 */ Timeline.prototype.isAnimating = function () { return !!this.animators.length; }; /** * 停止定时器 */ Timeline.prototype.stop = function () { if (this.timer) { this.timer.stop(); } }; /** * 停止时间轴上所有元素的动画,并置空动画元素列表 * @param {boolean} toEnd 是否到动画的最终状态,用来透传给动画元素的 stopAnimate 方法 */ Timeline.prototype.stopAllAnimations = function (toEnd) { if (toEnd === void 0) { toEnd = true; } this.animators.forEach(function (animator) { animator.stopAnimate(toEnd); }); this.animators = []; this.canvas.draw(); }; /** * 获取当前时间 */ Timeline.prototype.getTime = function () { return this.current; }; return Timeline; }(); /* harmony default export */ __webpack_exports__["default"] = (Timeline); /***/ }), /***/ "./node_modules/_@antv_g-base@0.5.0-beta.1@@antv/g-base/esm/event/event-contoller.js": /*!*******************************************************************************************!*\ !*** ./node_modules/_@antv_g-base@0.5.0-beta.1@@antv/g-base/esm/event/event-contoller.js ***! \*******************************************************************************************/ /*! exports provided: default */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony import */ var _graph_event__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./graph-event */ "./node_modules/_@antv_g-base@0.5.0-beta.1@@antv/g-base/esm/event/graph-event.js"); /* harmony import */ var _util_util__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../util/util */ "./node_modules/_@antv_g-base@0.5.0-beta.1@@antv/g-base/esm/util/util.js"); /** * @fileoverview 事件处理器 * @author dxq613@gmail.com */ var CLICK_OFFSET = 40; var LEFT_BTN_CODE = 0; var DELEGATION_SPLIT = ':'; var EVENTS = ['mousedown', 'mouseup', 'dblclick', 'mouseout', 'mouseover', 'mousemove', 'mouseleave', 'mouseenter', 'touchstart', 'touchmove', 'touchend', 'dragenter', 'dragover', 'dragleave', 'drop', 'contextmenu', 'mousewheel']; // 是否有委托事件监听 function hasDelegation(events, type) { for (var key in events) { if (events.hasOwnProperty(key) && key.indexOf(DELEGATION_SPLIT + type) >= 0) { return true; } } return false; } // 触发目标事件,目标只能是 shape 或 canvas function emitTargetEvent(target, type, eventObj) { eventObj.name = type; eventObj.target = target; eventObj.currentTarget = target; eventObj.delegateTarget = target; target.emit(type, eventObj); } // 事件冒泡, enter 和 leave 需要对 fromShape 和 toShape 进行判同 function bubbleEvent(container, type, eventObj) { if (eventObj.bubbles) { var relativeShape = void 0; var isOverEvent = false; if (type === 'mouseenter') { relativeShape = eventObj.fromShape; isOverEvent = true; } else if (type === 'mouseleave') { isOverEvent = true; relativeShape = eventObj.toShape; } // canvas 上的 mouseenter, mouseleave 事件,仅当进入或者移出 canvas 时触发 if (container.isCanvas() && isOverEvent) { return; } // 如果相关图形同当前图形在同一个容器内,不触发事件 if (relativeShape && Object(_util_util__WEBPACK_IMPORTED_MODULE_1__["isParent"])(container, relativeShape)) { // 阻止继续向上冒泡 eventObj.bubbles = false; return; } // 事件名称可能在委托过程中被修改,因此事件冒泡时需要重新设置事件名称 eventObj.name = type; eventObj.currentTarget = container; eventObj.delegateTarget = container; container.emit(type, eventObj); } } var EventController = /** @class */ function () { function EventController(cfg) { var _this = this; // 正在被拖拽的图形 this.draggingShape = null; this.dragging = false; // 当前鼠标/touch所在位置的图形 this.currentShape = null; this.mousedownShape = null; this.mousedownPoint = null; // 统一处理所有的回调 this._eventCallback = function (ev) { var type = ev.type; _this._triggerEvent(type, ev); }; // 在 document 处理拖拽到画布外的事件,处理从图形上移除画布未被捕捉的问题 this._onDocumentMove = function (ev) { var canvas = _this.canvas; var el = canvas.get('el'); if (el !== ev.target) { // 不在 canvas 上移动 if (_this.dragging || _this.currentShape) { var pointInfo = _this._getPointInfo(ev); // 还在拖拽过程中 if (_this.dragging) { _this._emitEvent('drag', ev, pointInfo, _this.draggingShape); } // 说明从某个图形直接移动到了画布外面, // 修复了 mouseleave 的 bug 后不再出现这种情况 // if (this.currentShape) { // this._emitEvent('mouseleave', ev, pointInfo, this.currentShape, this.currentShape, null); // this.currentShape = null; // } } } }; // 在 document 上处理拖拽到外面,释放鼠标时触发 dragend this._onDocumentMouseUp = function (ev) { var canvas = _this.canvas; var el = canvas.get('el'); if (el !== ev.target) { // 不在 canvas 上移动 if (_this.dragging) { var pointInfo = _this._getPointInfo(ev); if (_this.draggingShape) { // 如果存在拖拽的图形,则也触发 drop 事件 _this._emitEvent('drop', ev, pointInfo, null); } _this._emitEvent('dragend', ev, pointInfo, _this.draggingShape); _this._afterDrag(_this.draggingShape, pointInfo, ev); } } }; this.canvas = cfg.canvas; } EventController.prototype.init = function () { this._bindEvents(); }; // 注册事件 EventController.prototype._bindEvents = function () { var _this = this; var el = this.canvas.get('el'); Object(_util_util__WEBPACK_IMPORTED_MODULE_1__["each"])(EVENTS, function (eventName) { el.addEventListener(eventName, _this._eventCallback); }); if (document) { // 处理移动到外面没有触发 shape mouse leave 的事件 // 处理拖拽到外部的问题 document.addEventListener('mousemove', this._onDocumentMove); // 处理拖拽过程中在外部释放鼠标的问题 document.addEventListener('mouseup', this._onDocumentMouseUp); } }; // 清理事件 EventController.prototype._clearEvents = function () { var _this = this; var el = this.canvas.get('el'); Object(_util_util__WEBPACK_IMPORTED_MODULE_1__["each"])(EVENTS, function (eventName) { el.removeEventListener(eventName, _this._eventCallback); }); if (document) { document.removeEventListener('mousemove', this._onDocumentMove); document.removeEventListener('mouseup', this._onDocumentMouseUp); } }; EventController.prototype._getEventObj = function (type, event, point, target, fromShape, toShape) { var eventObj = new _graph_event__WEBPACK_IMPORTED_MODULE_0__["default"](type, event); eventObj.fromShape = fromShape; eventObj.toShape = toShape; eventObj.x = point.x; eventObj.y = point.y; eventObj.clientX = point.clientX; eventObj.clientY = point.clientY; eventObj.propagationPath.push(target); // 事件的x,y应该是基于画布左上角的,与canvas的matrix无关 return eventObj; }; // 根据点获取图形,提取成独立方法,便于后续优化 EventController.prototype._getShape = function (point, ev) { return this.canvas.getShape(point.x, point.y, ev); }; // 获取事件的当前点的信息 EventController.prototype._getPointInfo = function (ev) { var canvas = this.canvas; var clientPoint = canvas.getClientByEvent(ev); var point = canvas.getPointByEvent(ev); return { x: point.x, y: point.y, clientX: clientPoint.x, clientY: clientPoint.y }; }; // 触发事件 EventController.prototype._triggerEvent = function (type, ev) { var pointInfo = this._getPointInfo(ev); // 每次都获取图形有一定成本,后期可以考虑进行缓存策略 var shape = this._getShape(pointInfo, ev); var method = this["_on" + type]; var leaveCanvas = false; if (method) { method.call(this, pointInfo, shape, ev); } else { var preShape = this.currentShape; // 如果进入、移出画布时存在图形,则要分别触发事件 if (type === 'mouseenter' || type === 'dragenter' || type === 'mouseover') { this._emitEvent(type, ev, pointInfo, null, null, shape); // 先进入画布 if (shape) { this._emitEvent(type, ev, pointInfo, shape, null, shape); // 再触发图形的事件 } if (type === 'mouseenter' && this.draggingShape) { // 如果正在拖拽图形, 则触发 dragleave this._emitEvent('dragenter', ev, pointInfo, null); } } else if (type === 'mouseleave' || type === 'dragleave' || type === 'mouseout') { leaveCanvas = true; if (preShape) { this._emitEvent(type, ev, pointInfo, preShape, preShape, null); // 先触发图形的事件 } this._emitEvent(type, ev, pointInfo, null, preShape, null); // 再触发离开画布事件 if (type === 'mouseleave' && this.draggingShape) { this._emitEvent('dragleave', ev, pointInfo, null); } } else { this._emitEvent(type, ev, pointInfo, shape, null, null); // 一般事件中不需要考虑 from, to } } if (!leaveCanvas) { this.currentShape = shape; } // 当鼠标从画布移动到 shape 或者从 preShape 移动到 shape 时,应用 shape 上的鼠标样式 if (shape && !shape.get('destroyed')) { var canvas = this.canvas; var el = canvas.get('el'); el.style.cursor = shape.attr('cursor') || canvas.get('cursor'); } }; // 记录下点击的位置、图形,便于拖拽事件、click 事件的判定 EventController.prototype._onmousedown = function (pointInfo, shape, event) { // 只有鼠标左键的 mousedown 事件才会设置 mousedownShape 等属性,避免鼠标右键的 mousedown 事件引起其他事件发生 if (event.button === LEFT_BTN_CODE) { this.mousedownShape = shape; this.mousedownPoint = pointInfo; this.mousedownTimeStamp = event.timeStamp; } this._emitEvent('mousedown', event, pointInfo, shape, null, null); // mousedown 不考虑fromShape, toShape }; // mouseleave 和 mouseenter 都是成对存在的 // mouseenter 和 mouseover 同时触发 EventController.prototype._emitMouseoverEvents = function (event, pointInfo, fromShape, toShape) { var el = this.canvas.get('el'); if (fromShape !== toShape) { if (fromShape) { this._emitEvent('mouseout', event, pointInfo, fromShape, fromShape, toShape); this._emitEvent('mouseleave', event, pointInfo, fromShape, fromShape, toShape); // 当鼠标从 fromShape 移动到画布上时,重置鼠标样式 if (!toShape || toShape.get('destroyed')) { el.style.cursor = this.canvas.get('cursor'); } } if (toShape) { this._emitEvent('mouseover', event, pointInfo, toShape, fromShape, toShape); this._emitEvent('mouseenter', event, pointInfo, toShape, fromShape, toShape); } } }; // dragover 不等同于 mouseover,而等同于 mousemove EventController.prototype._emitDragoverEvents = function (event, pointInfo, fromShape, toShape, isCanvasEmit) { if (toShape) { if (toShape !== fromShape) { if (fromShape) { this._emitEvent('dragleave', event, pointInfo, fromShape, fromShape, toShape); } this._emitEvent('dragenter', event, pointInfo, toShape, fromShape, toShape); } if (!isCanvasEmit) { this._emitEvent('dragover', event, pointInfo, toShape); } } else if (fromShape) { // TODO: 此处判断有问题,当 drag 图形时,也会触发一次 dragleave 事件,因为此时 toShape 为 null,这不是所期望的 // 经过空白区域 this._emitEvent('dragleave', event, pointInfo, fromShape, fromShape, toShape); } if (isCanvasEmit) { this._emitEvent('dragover', event, pointInfo, toShape); } }; // drag 完成后,需要做一些清理工作 EventController.prototype._afterDrag = function (draggingShape, pointInfo, event) { if (draggingShape) { draggingShape.set('capture', true); // 恢复可以拾取 this.draggingShape = null; } this.dragging = false; // drag 完成后,有可能 draggingShape 已经移动到了当前位置,所以不能直接取当前图形 var shape = this._getShape(pointInfo, event); // 拖拽完成后,进行 enter,leave 的判定 if (shape !== draggingShape) { this._emitMouseoverEvents(event, pointInfo, draggingShape, shape); } this.currentShape = shape; // 更新当前 shape,如果不处理当前图形的 mouseleave 事件可能会出问题 }; // 按键抬起时,会终止拖拽、触发点击 EventController.prototype._onmouseup = function (pointInfo, shape, event) { // eevent.button === 0 表示鼠标左键事件,此处加上判断主要是为了避免右键鼠标会触发 mouseup 和 click 事件 // ref: https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/button if (event.button === LEFT_BTN_CODE) { var draggingShape = this.draggingShape; if (this.dragging) { // 存在可以拖拽的图形,同时拖拽到其他图形上时触发 drag 事件 if (draggingShape) { this._emitEvent('drop', event, pointInfo, shape); } this._emitEvent('dragend', event, pointInfo, draggingShape); this._afterDrag(draggingShape, pointInfo, event); } else { this._emitEvent('mouseup', event, pointInfo, shape); // 先触发 mouseup 再触发 click if (shape === this.mousedownShape) { this._emitEvent('click', event, pointInfo, shape); } this.mousedownShape = null; this.mousedownPoint = null; } } }; // 当触发浏览器的 dragover 事件时,不会再触发 mousemove ,所以这时候的 dragenter, dragleave 事件需要重新处理 EventController.prototype._ondragover = function (pointInfo, shape, event) { event.preventDefault(); // 如果不对 dragover 进行 preventDefault,则不会在 canvas 上触发 drop 事件 var preShape = this.currentShape; this._emitDragoverEvents(event, pointInfo, preShape, shape, true); }; // 大量的图形事件,都通过 mousemove 模拟 EventController.prototype._onmousemove = function (pointInfo, shape, event) { var canvas = this.canvas; var preShape = this.currentShape; var draggingShape = this.draggingShape; // 正在拖拽时 if (this.dragging) { // 正在拖拽中 if (draggingShape) { // 如果拖拽了 shape 会触发 dragenter, dragleave, dragover 和 drag 事件 this._emitDragoverEvents(event, pointInfo, preShape, shape, false); } // 如果存在 draggingShape 则会在 draggingShape 上触发 drag 事件,冒泡到 canvas 上 // 否则在 canvas 上触发 drag 事件 this._emitEvent('drag', event, pointInfo, draggingShape); } else { var mousedownPoint = this.mousedownPoint; if (mousedownPoint) { // 当鼠标点击下去,同时移动时,进行 drag 判定 var mousedownShape = this.mousedownShape; var now = event.timeStamp; var timeWindow = now - this.mousedownTimeStamp; var dx = mousedownPoint.clientX - pointInfo.clientX; var dy = mousedownPoint.clientY - pointInfo.clientY; var dist = dx * dx + dy * dy; if (timeWindow > 120 || dist > CLICK_OFFSET) { if (mousedownShape && mousedownShape.get('draggable')) { // 设置了 draggable 的 shape 才能触发 drag 相关的事件 draggingShape = this.mousedownShape; // 拖动鼠标点下时的 shape draggingShape.set('capture', false); // 禁止继续拾取,否则无法进行 dragover,dragenter,dragleave,drop的判定 this.draggingShape = draggingShape; this.dragging = true; this._emitEvent('dragstart', event, pointInfo, draggingShape); // 清理按下鼠标时缓存的值 this.mousedownShape = null; this.mousedownPoint = null; } else if (!mousedownShape && canvas.get('draggable')) { // 设置了 draggable 的 canvas 才能触发 drag 相关的事件 this.dragging = true; this._emitEvent('dragstart', event, pointInfo, null); // 清理按下鼠标时缓存的值 this.mousedownShape = null; this.mousedownPoint = null; } else { this._emitMouseoverEvents(event, pointInfo, preShape, shape); this._emitEvent('mousemove', event, pointInfo, shape); } } else { this._emitMouseoverEvents(event, pointInfo, preShape, shape); this._emitEvent('mousemove', event, pointInfo, shape); } } else { // 没有按键按下时,则直接触发 mouse over 相关的各种事件 this._emitMouseoverEvents(event, pointInfo, preShape, shape); // 始终触发移动 this._emitEvent('mousemove', event, pointInfo, shape); } } }; // 触发事件 EventController.prototype._emitEvent = function (type, event, pointInfo, shape, fromShape, toShape) { var eventObj = this._getEventObj(type, event, pointInfo, shape, fromShape, toShape); // 存在 shape 触发,则进行冒泡处理 if (shape) { eventObj.shape = shape; // 触发 shape 上的事件 emitTargetEvent(shape, type, eventObj); var parent_1 = shape.getParent(); // 执行冒泡 while (parent_1) { // 委托事件要先触发 parent_1.emitDelegation(type, eventObj); // 事件冒泡停止,不能妨碍委托事件 if (!eventObj.propagationStopped) { bubbleEvent(parent_1, type, eventObj); } eventObj.propagationPath.push(parent_1); parent_1 = parent_1.getParent(); } } else { // 如果没有 shape 直接在 canvas 上触发 var canvas = this.canvas; // 直接触发 canvas 上的事件 emitTargetEvent(canvas, type, eventObj); } }; EventController.prototype.destroy = function () { // 清理事件 this._clearEvents(); // 清理缓存的对象 this.canvas = null; this.currentShape = null; this.draggingShape = null; this.mousedownPoint = null; this.mousedownShape = null; this.mousedownTimeStamp = null; }; return EventController; }(); /* harmony default export */ __webpack_exports__["default"] = (EventController); /***/ }), /***/ "./node_modules/_@antv_g-base@0.5.0-beta.1@@antv/g-base/esm/event/graph-event.js": /*!***************************************************************************************!*\ !*** ./node_modules/_@antv_g-base@0.5.0-beta.1@@antv/g-base/esm/event/graph-event.js ***! \***************************************************************************************/ /*! exports provided: default */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); var GraphEvent = /** @class */ function () { function GraphEvent(type, event) { /** * 是否允许冒泡 * @type {boolean} */ this.bubbles = true; /** * 触发对象 * @type {object} */ this.target = null; /** * 监听对象 * @type {object} */ this.currentTarget = null; /** * 委托对象 * @type {object} */ this.delegateTarget = null; /** * 委托事件监听对象的代理对象,即 ev.delegateObject = ev.currentTarget.get('delegateObject') * @type {object} */ this.delegateObject = null; /** * 是否阻止了原生事件 * @type {boolean} */ this.defaultPrevented = false; /** * 是否阻止传播(向上冒泡) * @type {boolean} */ this.propagationStopped = false; /** * 触发事件的图形 * @type {IShape} */ this.shape = null; /** * 开始触发事件的图形 * @type {IShape} */ this.fromShape = null; /** * 事件结束时的触发图形 * @type {IShape} */ this.toShape = null; // 触发事件的路径 this.propagationPath = []; this.type = type; this.name = type; this.originalEvent = event; this.timeStamp = event.timeStamp; } /** * 阻止浏览器默认的行为 */ GraphEvent.prototype.preventDefault = function () { this.defaultPrevented = true; if (this.originalEvent.preventDefault) { this.originalEvent.preventDefault(); } }; /** * 阻止冒泡 */ GraphEvent.prototype.stopPropagation = function () { this.propagationStopped = true; }; GraphEvent.prototype.toString = function () { var type = this.type; return "[Event (type=" + type + ")]"; }; GraphEvent.prototype.save = function () {}; GraphEvent.prototype.restore = function () {}; return GraphEvent; }(); /* harmony default export */ __webpack_exports__["default"] = (GraphEvent); /***/ }), /***/ "./node_modules/_@antv_g-base@0.5.0-beta.1@@antv/g-base/esm/index.js": /*!***************************************************************************!*\ !*** ./node_modules/_@antv_g-base@0.5.0-beta.1@@antv/g-base/esm/index.js ***! \***************************************************************************/ /*! exports provided: version, Event, Base, AbstractCanvas, AbstractGroup, AbstractShape, PathUtil */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "version", function() { return version; }); /* harmony import */ var _util_path__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./util/path */ "./node_modules/_@antv_g-base@0.5.0-beta.1@@antv/g-base/esm/util/path.js"); /* harmony reexport (module object) */ __webpack_require__.d(__webpack_exports__, "PathUtil", function() { return _util_path__WEBPACK_IMPORTED_MODULE_0__; }); /* harmony import */ var _event_graph_event__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./event/graph-event */ "./node_modules/_@antv_g-base@0.5.0-beta.1@@antv/g-base/esm/event/graph-event.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Event", function() { return _event_graph_event__WEBPACK_IMPORTED_MODULE_1__["default"]; }); /* harmony import */ var _abstract_base__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./abstract/base */ "./node_modules/_@antv_g-base@0.5.0-beta.1@@antv/g-base/esm/abstract/base.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Base", function() { return _abstract_base__WEBPACK_IMPORTED_MODULE_2__["default"]; }); /* harmony import */ var _abstract_canvas__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./abstract/canvas */ "./node_modules/_@antv_g-base@0.5.0-beta.1@@antv/g-base/esm/abstract/canvas.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "AbstractCanvas", function() { return _abstract_canvas__WEBPACK_IMPORTED_MODULE_3__["default"]; }); /* harmony import */ var _abstract_group__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./abstract/group */ "./node_modules/_@antv_g-base@0.5.0-beta.1@@antv/g-base/esm/abstract/group.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "AbstractGroup", function() { return _abstract_group__WEBPACK_IMPORTED_MODULE_4__["default"]; }); /* harmony import */ var _abstract_shape__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./abstract/shape */ "./node_modules/_@antv_g-base@0.5.0-beta.1@@antv/g-base/esm/abstract/shape.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "AbstractShape", function() { return _abstract_shape__WEBPACK_IMPORTED_MODULE_5__["default"]; }); /** * @fileoverview G 的基础接口定义和所有的抽象类 * @author dxq613@gmail.com */ var pkg = __webpack_require__(/*! ../package.json */ "./node_modules/_@antv_g-base@0.5.0-beta.1@@antv/g-base/package.json"); var version = pkg.version; /***/ }), /***/ "./node_modules/_@antv_g-base@0.5.0-beta.1@@antv/g-base/esm/util/color.js": /*!********************************************************************************!*\ !*** ./node_modules/_@antv_g-base@0.5.0-beta.1@@antv/g-base/esm/util/color.js ***! \********************************************************************************/ /*! exports provided: isColorProp, isGradientColor */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isColorProp", function() { return isColorProp; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isGradientColor", function() { return isGradientColor; }); var isColorProp = function (prop) { return ['fill', 'stroke', 'fillStyle', 'strokeStyle'].includes(prop); }; var isGradientColor = function (val) { return /^[r,R,L,l]{1}[\s]*\(/.test(val); }; /***/ }), /***/ "./node_modules/_@antv_g-base@0.5.0-beta.1@@antv/g-base/esm/util/matrix.js": /*!*********************************************************************************!*\ !*** ./node_modules/_@antv_g-base@0.5.0-beta.1@@antv/g-base/esm/util/matrix.js ***! \*********************************************************************************/ /*! exports provided: multiplyMatrix, multiplyVec2, invert */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "multiplyMatrix", function() { return multiplyMatrix; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "multiplyVec2", function() { return multiplyVec2; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "invert", function() { return invert; }); /** * @fileoverview 矩阵运算,本来是要引入 gl-matrix, 但是考虑到 g-mobile 对大小有限制,同时 g-webgl 使用的 matrix 不一致 * 所以,这里仅实现 2D 几个运算,上层自己引入 gl-matrix * @author dxq613@gmail.com */ /** * 3阶矩阵相乘 * @param {number[]} a 矩阵1 * @param {number[]} b 矩阵2 */ function multiplyMatrix(a, b) { var out = []; var a00 = a[0]; var a01 = a[1]; var a02 = a[2]; var a10 = a[3]; var a11 = a[4]; var a12 = a[5]; var a20 = a[6]; var a21 = a[7]; var a22 = a[8]; var b00 = b[0]; var b01 = b[1]; var b02 = b[2]; var b10 = b[3]; var b11 = b[4]; var b12 = b[5]; var b20 = b[6]; var b21 = b[7]; var b22 = b[8]; out[0] = b00 * a00 + b01 * a10 + b02 * a20; out[1] = b00 * a01 + b01 * a11 + b02 * a21; out[2] = b00 * a02 + b01 * a12 + b02 * a22; out[3] = b10 * a00 + b11 * a10 + b12 * a20; out[4] = b10 * a01 + b11 * a11 + b12 * a21; out[5] = b10 * a02 + b11 * a12 + b12 * a22; out[6] = b20 * a00 + b21 * a10 + b22 * a20; out[7] = b20 * a01 + b21 * a11 + b22 * a21; out[8] = b20 * a02 + b21 * a12 + b22 * a22; return out; } /** * 3阶矩阵同2阶向量相乘 * @param {number[]} m 矩阵 * @param {number[]} v 二阶向量 */ function multiplyVec2(m, v) { var out = []; var x = v[0]; var y = v[1]; out[0] = m[0] * x + m[3] * y + m[6]; out[1] = m[1] * x + m[4] * y + m[7]; return out; } /** * 矩阵的逆 * @param {number[]} a 矩阵 */ function invert(a) { var out = []; var a00 = a[0]; var a01 = a[1]; var a02 = a[2]; var a10 = a[3]; var a11 = a[4]; var a12 = a[5]; var a20 = a[6]; var a21 = a[7]; var a22 = a[8]; var b01 = a22 * a11 - a12 * a21; var b11 = -a22 * a10 + a12 * a20; var b21 = a21 * a10 - a11 * a20; // Calculate the determinant var det = a00 * b01 + a01 * b11 + a02 * b21; if (!det) { return null; } det = 1.0 / det; out[0] = b01 * det; out[1] = (-a22 * a01 + a02 * a21) * det; out[2] = (a12 * a01 - a02 * a11) * det; out[3] = b11 * det; out[4] = (a22 * a00 - a02 * a20) * det; out[5] = (-a12 * a00 + a02 * a10) * det; out[6] = b21 * det; out[7] = (-a21 * a00 + a01 * a20) * det; out[8] = (a11 * a00 - a01 * a10) * det; return out; } /***/ }), /***/ "./node_modules/_@antv_g-base@0.5.0-beta.1@@antv/g-base/esm/util/path.js": /*!*******************************************************************************!*\ !*** ./node_modules/_@antv_g-base@0.5.0-beta.1@@antv/g-base/esm/util/path.js ***! \*******************************************************************************/ /*! exports provided: catmullRomToBezier, fillPath, fillPathByDiff, formatPath, intersection, parsePathArray, parsePathString, pathToAbsolute, pathToCurve, rectPath */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "catmullRomToBezier", function() { return catmullRomToBezier; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "fillPath", function() { return fillPath; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "fillPathByDiff", function() { return fillPathByDiff; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "formatPath", function() { return formatPath; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "intersection", function() { return intersection; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "parsePathArray", function() { return parsePathArray; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "parsePathString", function() { return parsePathString; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "pathToAbsolute", function() { return pathToAbsolute; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "pathToCurve", function() { return pathToCurve; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "rectPath", function() { return rectPath; }); /* harmony import */ var _antv_util__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @antv/util */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/index.js"); var SPACES = '\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029'; var PATH_COMMAND = new RegExp("([a-z])[" + SPACES + ",]*((-?\\d*\\.?\\d*(?:e[\\-+]?\\d+)?[" + SPACES + "]*,?[" + SPACES + "]*)+)", 'ig'); var PATH_VALUES = new RegExp("(-?\\d*\\.?\\d*(?:e[\\-+]?\\d+)?)[" + SPACES + "]*,?[" + SPACES + "]*", 'ig'); // Parse given path string into an array of arrays of path segments var parsePathString = function (pathString) { if (!pathString) { return null; } if (Object(_antv_util__WEBPACK_IMPORTED_MODULE_0__["isArray"])(pathString)) { return pathString; } var paramCounts = { a: 7, c: 6, o: 2, h: 1, l: 2, m: 2, r: 4, q: 4, s: 4, t: 2, v: 1, u: 3, z: 0 }; var data = []; String(pathString).replace(PATH_COMMAND, function (a, b, c) { var params = []; var name = b.toLowerCase(); c.replace(PATH_VALUES, function (a, b) { b && params.push(+b); }); if (name === 'm' && params.length > 2) { data.push([b].concat(params.splice(0, 2))); name = 'l'; b = b === 'm' ? 'l' : 'L'; } if (name === 'o' && params.length === 1) { data.push([b, params[0]]); } if (name === 'r') { data.push([b].concat(params)); } else { while (params.length >= paramCounts[name]) { data.push([b].concat(params.splice(0, paramCounts[name]))); if (!paramCounts[name]) { break; } } } return pathString; }); return data; }; // http://schepers.cc/getting-to-the-point var catmullRomToBezier = function (crp, z) { var d = []; // @ts-ignore for (var i = 0, iLen = crp.length; iLen - 2 * !z > i; i += 2) { var p = [{ x: +crp[i - 2], y: +crp[i - 1] }, { x: +crp[i], y: +crp[i + 1] }, { x: +crp[i + 2], y: +crp[i + 3] }, { x: +crp[i + 4], y: +crp[i + 5] }]; if (z) { if (!i) { p[0] = { x: +crp[iLen - 2], y: +crp[iLen - 1] }; } else if (iLen - 4 === i) { p[3] = { x: +crp[0], y: +crp[1] }; } else if (iLen - 2 === i) { p[2] = { x: +crp[0], y: +crp[1] }; p[3] = { x: +crp[2], y: +crp[3] }; } } else { if (iLen - 4 === i) { p[3] = p[2]; } else if (!i) { p[0] = { x: +crp[i], y: +crp[i + 1] }; } } d.push(['C', (-p[0].x + 6 * p[1].x + p[2].x) / 6, (-p[0].y + 6 * p[1].y + p[2].y) / 6, (p[1].x + 6 * p[2].x - p[3].x) / 6, (p[1].y + 6 * p[2].y - p[3].y) / 6, p[2].x, p[2].y]); } return d; }; var ellipsePath = function (x, y, rx, ry, a) { var res = []; if (a === null && ry === null) { ry = rx; } x = +x; y = +y; rx = +rx; ry = +ry; if (a !== null) { var rad = Math.PI / 180; var x1 = x + rx * Math.cos(-ry * rad); var x2 = x + rx * Math.cos(-a * rad); var y1 = y + rx * Math.sin(-ry * rad); var y2 = y + rx * Math.sin(-a * rad); res = [['M', x1, y1], ['A', rx, rx, 0, +(a - ry > 180), 0, x2, y2]]; } else { res = [['M', x, y], ['m', 0, -ry], ['a', rx, ry, 0, 1, 1, 0, 2 * ry], ['a', rx, ry, 0, 1, 1, 0, -2 * ry], ['z']]; } return res; }; var pathToAbsolute = function (pathArray) { pathArray = parsePathString(pathArray); if (!pathArray || !pathArray.length) { return [['M', 0, 0]]; } var res = []; var x = 0; var y = 0; var mx = 0; var my = 0; var start = 0; var pa0; var dots; if (pathArray[0][0] === 'M') { x = +pathArray[0][1]; y = +pathArray[0][2]; mx = x; my = y; start++; res[0] = ['M', x, y]; } var crz = pathArray.length === 3 && pathArray[0][0] === 'M' && pathArray[1][0].toUpperCase() === 'R' && pathArray[2][0].toUpperCase() === 'Z'; for (var r = void 0, pa = void 0, i = start, ii = pathArray.length; i < ii; i++) { res.push(r = []); pa = pathArray[i]; pa0 = pa[0]; if (pa0 !== pa0.toUpperCase()) { r[0] = pa0.toUpperCase(); switch (r[0]) { case 'A': r[1] = pa[1]; r[2] = pa[2]; r[3] = pa[3]; r[4] = pa[4]; r[5] = pa[5]; r[6] = +pa[6] + x; r[7] = +pa[7] + y; break; case 'V': r[1] = +pa[1] + y; break; case 'H': r[1] = +pa[1] + x; break; case 'R': dots = [x, y].concat(pa.slice(1)); for (var j = 2, jj = dots.length; j < jj; j++) { dots[j] = +dots[j] + x; dots[++j] = +dots[j] + y; } res.pop(); res = res.concat(catmullRomToBezier(dots, crz)); break; case 'O': res.pop(); dots = ellipsePath(x, y, pa[1], pa[2]); dots.push(dots[0]); res = res.concat(dots); break; case 'U': res.pop(); res = res.concat(ellipsePath(x, y, pa[1], pa[2], pa[3])); r = ['U'].concat(res[res.length - 1].slice(-2)); break; case 'M': mx = +pa[1] + x; my = +pa[2] + y; break; // for lint default: for (var j = 1, jj = pa.length; j < jj; j++) { r[j] = +pa[j] + (j % 2 ? x : y); } } } else if (pa0 === 'R') { dots = [x, y].concat(pa.slice(1)); res.pop(); res = res.concat(catmullRomToBezier(dots, crz)); r = ['R'].concat(pa.slice(-2)); } else if (pa0 === 'O') { res.pop(); dots = ellipsePath(x, y, pa[1], pa[2]); dots.push(dots[0]); res = res.concat(dots); } else if (pa0 === 'U') { res.pop(); res = res.concat(ellipsePath(x, y, pa[1], pa[2], pa[3])); r = ['U'].concat(res[res.length - 1].slice(-2)); } else { for (var k = 0, kk = pa.length; k < kk; k++) { r[k] = pa[k]; } } pa0 = pa0.toUpperCase(); if (pa0 !== 'O') { switch (r[0]) { case 'Z': x = +mx; y = +my; break; case 'H': x = r[1]; break; case 'V': y = r[1]; break; case 'M': mx = r[r.length - 2]; my = r[r.length - 1]; break; // for lint default: x = r[r.length - 2]; y = r[r.length - 1]; } } } return res; }; var l2c = function (x1, y1, x2, y2) { return [x1, y1, x2, y2, x2, y2]; }; var q2c = function (x1, y1, ax, ay, x2, y2) { var _13 = 1 / 3; var _23 = 2 / 3; return [_13 * x1 + _23 * ax, _13 * y1 + _23 * ay, _13 * x2 + _23 * ax, _13 * y2 + _23 * ay, x2, y2]; }; var a2c = function (x1, y1, rx, ry, angle, large_arc_flag, sweep_flag, x2, y2, recursive) { // for more information of where this math came from visit: // http://www.w3.org/TR/SVG11/implnote.html#ArcImplementationNotes if (rx === ry) { rx += 1; } var _120 = Math.PI * 120 / 180; var rad = Math.PI / 180 * (+angle || 0); var res = []; var xy; var f1; var f2; var cx; var cy; var rotate = function (x, y, rad) { var X = x * Math.cos(rad) - y * Math.sin(rad); var Y = x * Math.sin(rad) + y * Math.cos(rad); return { x: X, y: Y }; }; if (!recursive) { xy = rotate(x1, y1, -rad); x1 = xy.x; y1 = xy.y; xy = rotate(x2, y2, -rad); x2 = xy.x; y2 = xy.y; if (x1 === x2 && y1 === y2) { // 若弧的起始点和终点重叠则错开一点 x2 += 1; y2 += 1; } // const cos = Math.cos(Math.PI / 180 * angle); // const sin = Math.sin(Math.PI / 180 * angle); var x = (x1 - x2) / 2; var y = (y1 - y2) / 2; var h = x * x / (rx * rx) + y * y / (ry * ry); if (h > 1) { h = Math.sqrt(h); rx = h * rx; ry = h * ry; } var rx2 = rx * rx; var ry2 = ry * ry; var k = (large_arc_flag === sweep_flag ? -1 : 1) * Math.sqrt(Math.abs((rx2 * ry2 - rx2 * y * y - ry2 * x * x) / (rx2 * y * y + ry2 * x * x))); cx = k * rx * y / ry + (x1 + x2) / 2; cy = k * -ry * x / rx + (y1 + y2) / 2; // @ts-ignore f1 = Math.asin(((y1 - cy) / ry).toFixed(9)); // @ts-ignore f2 = Math.asin(((y2 - cy) / ry).toFixed(9)); f1 = x1 < cx ? Math.PI - f1 : f1; f2 = x2 < cx ? Math.PI - f2 : f2; f1 < 0 && (f1 = Math.PI * 2 + f1); f2 < 0 && (f2 = Math.PI * 2 + f2); if (sweep_flag && f1 > f2) { f1 = f1 - Math.PI * 2; } if (!sweep_flag && f2 > f1) { f2 = f2 - Math.PI * 2; } } else { f1 = recursive[0]; f2 = recursive[1]; cx = recursive[2]; cy = recursive[3]; } var df = f2 - f1; if (Math.abs(df) > _120) { var f2old = f2; var x2old = x2; var y2old = y2; f2 = f1 + _120 * (sweep_flag && f2 > f1 ? 1 : -1); x2 = cx + rx * Math.cos(f2); y2 = cy + ry * Math.sin(f2); res = a2c(x2, y2, rx, ry, angle, 0, sweep_flag, x2old, y2old, [f2, f2old, cx, cy]); } df = f2 - f1; var c1 = Math.cos(f1); var s1 = Math.sin(f1); var c2 = Math.cos(f2); var s2 = Math.sin(f2); var t = Math.tan(df / 4); var hx = 4 / 3 * rx * t; var hy = 4 / 3 * ry * t; var m1 = [x1, y1]; var m2 = [x1 + hx * s1, y1 - hy * c1]; var m3 = [x2 + hx * s2, y2 - hy * c2]; var m4 = [x2, y2]; m2[0] = 2 * m1[0] - m2[0]; m2[1] = 2 * m1[1] - m2[1]; if (recursive) { return [m2, m3, m4].concat(res); } res = [m2, m3, m4].concat(res).join().split(','); var newres = []; for (var i = 0, ii = res.length; i < ii; i++) { newres[i] = i % 2 ? rotate(res[i - 1], res[i], rad).y : rotate(res[i], res[i + 1], rad).x; } return newres; }; var pathToCurve = function (path, path2) { var p = pathToAbsolute(path); var p2 = path2 && pathToAbsolute(path2); var attrs = { x: 0, y: 0, bx: 0, by: 0, X: 0, Y: 0, qx: null, qy: null }; var attrs2 = { x: 0, y: 0, bx: 0, by: 0, X: 0, Y: 0, qx: null, qy: null }; var pcoms1 = []; // path commands of original path p var pcoms2 = []; // path commands of original path p2 var pfirst = ''; // temporary holder for original path command var pcom = ''; // holder for previous path command of original path var ii; var processPath = function (path, d, pcom) { var nx; var ny; if (!path) { return ['C', d.x, d.y, d.x, d.y, d.x, d.y]; } !(path[0] in { T: 1, Q: 1 }) && (d.qx = d.qy = null); switch (path[0]) { case 'M': d.X = path[1]; d.Y = path[2]; break; case 'A': path = ['C'].concat(a2c.apply(0, [d.x, d.y].concat(path.slice(1)))); break; case 'S': if (pcom === 'C' || pcom === 'S') { // In "S" case we have to take into account, if the previous command is C/S. nx = d.x * 2 - d.bx; // And reflect the previous ny = d.y * 2 - d.by; // command's control point relative to the current point. } else { // or some else or nothing nx = d.x; ny = d.y; } path = ['C', nx, ny].concat(path.slice(1)); break; case 'T': if (pcom === 'Q' || pcom === 'T') { // In "T" case we have to take into account, if the previous command is Q/T. d.qx = d.x * 2 - d.qx; // And make a reflection similar d.qy = d.y * 2 - d.qy; // to case "S". } else { // or something else or nothing d.qx = d.x; d.qy = d.y; } path = ['C'].concat(q2c(d.x, d.y, d.qx, d.qy, path[1], path[2])); break; case 'Q': d.qx = path[1]; d.qy = path[2]; path = ['C'].concat(q2c(d.x, d.y, path[1], path[2], path[3], path[4])); break; case 'L': path = ['C'].concat(l2c(d.x, d.y, path[1], path[2])); break; case 'H': path = ['C'].concat(l2c(d.x, d.y, path[1], d.y)); break; case 'V': path = ['C'].concat(l2c(d.x, d.y, d.x, path[1])); break; case 'Z': path = ['C'].concat(l2c(d.x, d.y, d.X, d.Y)); break; default: break; } return path; }; var fixArc = function (pp, i) { if (pp[i].length > 7) { pp[i].shift(); var pi = pp[i]; while (pi.length) { pcoms1[i] = 'A'; // if created multiple C:s, their original seg is saved p2 && (pcoms2[i] = 'A'); // the same as above pp.splice(i++, 0, ['C'].concat(pi.splice(0, 6))); } pp.splice(i, 1); ii = Math.max(p.length, p2 && p2.length || 0); } }; var fixM = function (path1, path2, a1, a2, i) { if (path1 && path2 && path1[i][0] === 'M' && path2[i][0] !== 'M') { path2.splice(i, 0, ['M', a2.x, a2.y]); a1.bx = 0; a1.by = 0; a1.x = path1[i][1]; a1.y = path1[i][2]; ii = Math.max(p.length, p2 && p2.length || 0); } }; ii = Math.max(p.length, p2 && p2.length || 0); for (var i = 0; i < ii; i++) { p[i] && (pfirst = p[i][0]); // save current path command if (pfirst !== 'C') { // C is not saved yet, because it may be result of conversion pcoms1[i] = pfirst; // Save current path command i && (pcom = pcoms1[i - 1]); // Get previous path command pcom } p[i] = processPath(p[i], attrs, pcom); // Previous path command is inputted to processPath if (pcoms1[i] !== 'A' && pfirst === 'C') pcoms1[i] = 'C'; // A is the only command // which may produce multiple C:s // so we have to make sure that C is also C in original path fixArc(p, i); // fixArc adds also the right amount of A:s to pcoms1 if (p2) { // the same procedures is done to p2 p2[i] && (pfirst = p2[i][0]); if (pfirst !== 'C') { pcoms2[i] = pfirst; i && (pcom = pcoms2[i - 1]); } p2[i] = processPath(p2[i], attrs2, pcom); if (pcoms2[i] !== 'A' && pfirst === 'C') { pcoms2[i] = 'C'; } fixArc(p2, i); } fixM(p, p2, attrs, attrs2, i); fixM(p2, p, attrs2, attrs, i); var seg = p[i]; var seg2 = p2 && p2[i]; var seglen = seg.length; var seg2len = p2 && seg2.length; attrs.x = seg[seglen - 2]; attrs.y = seg[seglen - 1]; attrs.bx = parseFloat(seg[seglen - 4]) || attrs.x; attrs.by = parseFloat(seg[seglen - 3]) || attrs.y; attrs2.bx = p2 && (parseFloat(seg2[seg2len - 4]) || attrs2.x); attrs2.by = p2 && (parseFloat(seg2[seg2len - 3]) || attrs2.y); attrs2.x = p2 && seg2[seg2len - 2]; attrs2.y = p2 && seg2[seg2len - 1]; } return p2 ? [p, p2] : p; }; var p2s = /,?([a-z]),?/gi; var parsePathArray = function (path) { return path.join(',').replace(p2s, '$1'); }; var base3 = function (t, p1, p2, p3, p4) { var t1 = -3 * p1 + 9 * p2 - 9 * p3 + 3 * p4; var t2 = t * t1 + 6 * p1 - 12 * p2 + 6 * p3; return t * t2 - 3 * p1 + 3 * p2; }; var bezlen = function (x1, y1, x2, y2, x3, y3, x4, y4, z) { if (z === null) { z = 1; } z = z > 1 ? 1 : z < 0 ? 0 : z; var z2 = z / 2; var n = 12; var Tvalues = [-0.1252, 0.1252, -0.3678, 0.3678, -0.5873, 0.5873, -0.7699, 0.7699, -0.9041, 0.9041, -0.9816, 0.9816]; var Cvalues = [0.2491, 0.2491, 0.2335, 0.2335, 0.2032, 0.2032, 0.1601, 0.1601, 0.1069, 0.1069, 0.0472, 0.0472]; var sum = 0; for (var i = 0; i < n; i++) { var ct = z2 * Tvalues[i] + z2; var xbase = base3(ct, x1, x2, x3, x4); var ybase = base3(ct, y1, y2, y3, y4); var comb = xbase * xbase + ybase * ybase; sum += Cvalues[i] * Math.sqrt(comb); } return z2 * sum; }; var curveDim = function (x0, y0, x1, y1, x2, y2, x3, y3) { var tvalues = []; var bounds = [[], []]; var a; var b; var c; var t; for (var i = 0; i < 2; ++i) { if (i === 0) { b = 6 * x0 - 12 * x1 + 6 * x2; a = -3 * x0 + 9 * x1 - 9 * x2 + 3 * x3; c = 3 * x1 - 3 * x0; } else { b = 6 * y0 - 12 * y1 + 6 * y2; a = -3 * y0 + 9 * y1 - 9 * y2 + 3 * y3; c = 3 * y1 - 3 * y0; } if (Math.abs(a) < 1e-12) { if (Math.abs(b) < 1e-12) { continue; } t = -c / b; if (t > 0 && t < 1) { tvalues.push(t); } continue; } var b2ac = b * b - 4 * c * a; var sqrtb2ac = Math.sqrt(b2ac); if (b2ac < 0) { continue; } var t1 = (-b + sqrtb2ac) / (2 * a); if (t1 > 0 && t1 < 1) { tvalues.push(t1); } var t2 = (-b - sqrtb2ac) / (2 * a); if (t2 > 0 && t2 < 1) { tvalues.push(t2); } } var j = tvalues.length; var jlen = j; var mt; while (j--) { t = tvalues[j]; mt = 1 - t; bounds[0][j] = mt * mt * mt * x0 + 3 * mt * mt * t * x1 + 3 * mt * t * t * x2 + t * t * t * x3; bounds[1][j] = mt * mt * mt * y0 + 3 * mt * mt * t * y1 + 3 * mt * t * t * y2 + t * t * t * y3; } bounds[0][jlen] = x0; bounds[1][jlen] = y0; bounds[0][jlen + 1] = x3; bounds[1][jlen + 1] = y3; bounds[0].length = bounds[1].length = jlen + 2; return { min: { x: Math.min.apply(0, bounds[0]), y: Math.min.apply(0, bounds[1]) }, max: { x: Math.max.apply(0, bounds[0]), y: Math.max.apply(0, bounds[1]) } }; }; var intersect = function (x1, y1, x2, y2, x3, y3, x4, y4) { if (Math.max(x1, x2) < Math.min(x3, x4) || Math.min(x1, x2) > Math.max(x3, x4) || Math.max(y1, y2) < Math.min(y3, y4) || Math.min(y1, y2) > Math.max(y3, y4)) { return; } var nx = (x1 * y2 - y1 * x2) * (x3 - x4) - (x1 - x2) * (x3 * y4 - y3 * x4); var ny = (x1 * y2 - y1 * x2) * (y3 - y4) - (y1 - y2) * (x3 * y4 - y3 * x4); var denominator = (x1 - x2) * (y3 - y4) - (y1 - y2) * (x3 - x4); if (!denominator) { return; } var px = nx / denominator; var py = ny / denominator; var px2 = +px.toFixed(2); var py2 = +py.toFixed(2); if (px2 < +Math.min(x1, x2).toFixed(2) || px2 > +Math.max(x1, x2).toFixed(2) || px2 < +Math.min(x3, x4).toFixed(2) || px2 > +Math.max(x3, x4).toFixed(2) || py2 < +Math.min(y1, y2).toFixed(2) || py2 > +Math.max(y1, y2).toFixed(2) || py2 < +Math.min(y3, y4).toFixed(2) || py2 > +Math.max(y3, y4).toFixed(2)) { return; } return { x: px, y: py }; }; var isPointInsideBBox = function (bbox, x, y) { return x >= bbox.x && x <= bbox.x + bbox.width && y >= bbox.y && y <= bbox.y + bbox.height; }; var rectPath = function (x, y, w, h, r) { if (r) { return [['M', +x + +r, y], ['l', w - r * 2, 0], ['a', r, r, 0, 0, 1, r, r], ['l', 0, h - r * 2], ['a', r, r, 0, 0, 1, -r, r], ['l', r * 2 - w, 0], ['a', r, r, 0, 0, 1, -r, -r], ['l', 0, r * 2 - h], ['a', r, r, 0, 0, 1, r, -r], ['z']]; } var res = [['M', x, y], ['l', w, 0], ['l', 0, h], ['l', -w, 0], ['z']]; // @ts-ignore res.parsePathArray = parsePathArray; return res; }; var box = function (x, y, width, height) { if (x === null) { x = y = width = height = 0; } if (y === null) { y = x.y; width = x.width; height = x.height; x = x.x; } return { x: x, y: y, width: width, w: width, height: height, h: height, x2: x + width, y2: y + height, cx: x + width / 2, cy: y + height / 2, r1: Math.min(width, height) / 2, r2: Math.max(width, height) / 2, r0: Math.sqrt(width * width + height * height) / 2, path: rectPath(x, y, width, height), vb: [x, y, width, height].join(' ') }; }; var isBBoxIntersect = function (bbox1, bbox2) { bbox1 = box(bbox1); bbox2 = box(bbox2); return isPointInsideBBox(bbox2, bbox1.x, bbox1.y) || isPointInsideBBox(bbox2, bbox1.x2, bbox1.y) || isPointInsideBBox(bbox2, bbox1.x, bbox1.y2) || isPointInsideBBox(bbox2, bbox1.x2, bbox1.y2) || isPointInsideBBox(bbox1, bbox2.x, bbox2.y) || isPointInsideBBox(bbox1, bbox2.x2, bbox2.y) || isPointInsideBBox(bbox1, bbox2.x, bbox2.y2) || isPointInsideBBox(bbox1, bbox2.x2, bbox2.y2) || (bbox1.x < bbox2.x2 && bbox1.x > bbox2.x || bbox2.x < bbox1.x2 && bbox2.x > bbox1.x) && (bbox1.y < bbox2.y2 && bbox1.y > bbox2.y || bbox2.y < bbox1.y2 && bbox2.y > bbox1.y); }; var bezierBBox = function (p1x, p1y, c1x, c1y, c2x, c2y, p2x, p2y) { if (!Object(_antv_util__WEBPACK_IMPORTED_MODULE_0__["isArray"])(p1x)) { p1x = [p1x, p1y, c1x, c1y, c2x, c2y, p2x, p2y]; } var bbox = curveDim.apply(null, p1x); return box(bbox.min.x, bbox.min.y, bbox.max.x - bbox.min.x, bbox.max.y - bbox.min.y); }; var findDotsAtSegment = function (p1x, p1y, c1x, c1y, c2x, c2y, p2x, p2y, t) { var t1 = 1 - t; var t13 = Math.pow(t1, 3); var t12 = Math.pow(t1, 2); var t2 = t * t; var t3 = t2 * t; var x = t13 * p1x + t12 * 3 * t * c1x + t1 * 3 * t * t * c2x + t3 * p2x; var y = t13 * p1y + t12 * 3 * t * c1y + t1 * 3 * t * t * c2y + t3 * p2y; var mx = p1x + 2 * t * (c1x - p1x) + t2 * (c2x - 2 * c1x + p1x); var my = p1y + 2 * t * (c1y - p1y) + t2 * (c2y - 2 * c1y + p1y); var nx = c1x + 2 * t * (c2x - c1x) + t2 * (p2x - 2 * c2x + c1x); var ny = c1y + 2 * t * (c2y - c1y) + t2 * (p2y - 2 * c2y + c1y); var ax = t1 * p1x + t * c1x; var ay = t1 * p1y + t * c1y; var cx = t1 * c2x + t * p2x; var cy = t1 * c2y + t * p2y; var alpha = 90 - Math.atan2(mx - nx, my - ny) * 180 / Math.PI; // (mx > nx || my < ny) && (alpha += 180); return { x: x, y: y, m: { x: mx, y: my }, n: { x: nx, y: ny }, start: { x: ax, y: ay }, end: { x: cx, y: cy }, alpha: alpha }; }; var interHelper = function (bez1, bez2, justCount) { var bbox1 = bezierBBox(bez1); var bbox2 = bezierBBox(bez2); if (!isBBoxIntersect(bbox1, bbox2)) { return justCount ? 0 : []; } var l1 = bezlen.apply(0, bez1); var l2 = bezlen.apply(0, bez2); var n1 = ~~(l1 / 8); var n2 = ~~(l2 / 8); var dots1 = []; var dots2 = []; var xy = {}; var res = justCount ? 0 : []; for (var i = 0; i < n1 + 1; i++) { var d = findDotsAtSegment.apply(0, bez1.concat(i / n1)); dots1.push({ x: d.x, y: d.y, t: i / n1 }); } for (var i = 0; i < n2 + 1; i++) { var d = findDotsAtSegment.apply(0, bez2.concat(i / n2)); dots2.push({ x: d.x, y: d.y, t: i / n2 }); } for (var i = 0; i < n1; i++) { for (var j = 0; j < n2; j++) { var di = dots1[i]; var di1 = dots1[i + 1]; var dj = dots2[j]; var dj1 = dots2[j + 1]; var ci = Math.abs(di1.x - di.x) < 0.001 ? 'y' : 'x'; var cj = Math.abs(dj1.x - dj.x) < 0.001 ? 'y' : 'x'; var is = intersect(di.x, di.y, di1.x, di1.y, dj.x, dj.y, dj1.x, dj1.y); if (is) { if (xy[is.x.toFixed(4)] === is.y.toFixed(4)) { continue; } xy[is.x.toFixed(4)] = is.y.toFixed(4); var t1 = di.t + Math.abs((is[ci] - di[ci]) / (di1[ci] - di[ci])) * (di1.t - di.t); var t2 = dj.t + Math.abs((is[cj] - dj[cj]) / (dj1[cj] - dj[cj])) * (dj1.t - dj.t); if (t1 >= 0 && t1 <= 1 && t2 >= 0 && t2 <= 1) { if (justCount) { // @ts-ignore res += 1; } else { // @ts-ignore res.push({ x: is.x, y: is.y, t1: t1, t2: t2 }); } } } } } return res; }; var interPathHelper = function (path1, path2, justCount) { path1 = pathToCurve(path1); path2 = pathToCurve(path2); var x1; var y1; var x2; var y2; var x1m; var y1m; var x2m; var y2m; var bez1; var bez2; var res = justCount ? 0 : []; for (var i = 0, ii = path1.length; i < ii; i++) { var pi = path1[i]; if (pi[0] === 'M') { x1 = x1m = pi[1]; y1 = y1m = pi[2]; } else { if (pi[0] === 'C') { bez1 = [x1, y1].concat(pi.slice(1)); x1 = bez1[6]; y1 = bez1[7]; } else { bez1 = [x1, y1, x1, y1, x1m, y1m, x1m, y1m]; x1 = x1m; y1 = y1m; } for (var j = 0, jj = path2.length; j < jj; j++) { var pj = path2[j]; if (pj[0] === 'M') { x2 = x2m = pj[1]; y2 = y2m = pj[2]; } else { if (pj[0] === 'C') { bez2 = [x2, y2].concat(pj.slice(1)); x2 = bez2[6]; y2 = bez2[7]; } else { bez2 = [x2, y2, x2, y2, x2m, y2m, x2m, y2m]; x2 = x2m; y2 = y2m; } var intr = interHelper(bez1, bez2, justCount); if (justCount) { // @ts-ignore res += intr; } else { // @ts-ignore for (var k = 0, kk = intr.length; k < kk; k++) { intr[k].segment1 = i; intr[k].segment2 = j; intr[k].bez1 = bez1; intr[k].bez2 = bez2; } // @ts-ignore res = res.concat(intr); } } } } } return res; }; var intersection = function (path1, path2) { return interPathHelper(path1, path2); }; function decasteljau(points, t) { var left = []; var right = []; function recurse(points, t) { if (points.length === 1) { left.push(points[0]); right.push(points[0]); } else { var middlePoints = []; for (var i = 0; i < points.length - 1; i++) { if (i === 0) { left.push(points[0]); } if (i === points.length - 2) { right.push(points[i + 1]); } middlePoints[i] = [(1 - t) * points[i][0] + t * points[i + 1][0], (1 - t) * points[i][1] + t * points[i + 1][1]]; } recurse(middlePoints, t); } } if (points.length) { recurse(points, t); } return { left: left, right: right.reverse() }; } function splitCurve(start, end, count) { var points = [[start[1], start[2]]]; count = count || 2; var segments = []; if (end[0] === 'A') { points.push(end[6]); points.push(end[7]); } else if (end[0] === 'C') { points.push([end[1], end[2]]); points.push([end[3], end[4]]); points.push([end[5], end[6]]); } else if (end[0] === 'S' || end[0] === 'Q') { points.push([end[1], end[2]]); points.push([end[3], end[4]]); } else { points.push([end[1], end[2]]); } var leftSegments = points; var t = 1 / count; for (var i = 0; i < count - 1; i++) { var rt = t / (1 - t * i); var split = decasteljau(leftSegments, rt); segments.push(split.left); leftSegments = split.right; } segments.push(leftSegments); var result = segments.map(function (segment) { var cmd = []; if (segment.length === 4) { cmd.push('C'); cmd = cmd.concat(segment[2]); } if (segment.length >= 3) { if (segment.length === 3) { cmd.push('Q'); } cmd = cmd.concat(segment[1]); } if (segment.length === 2) { cmd.push('L'); } cmd = cmd.concat(segment[segment.length - 1]); return cmd; }); return result; } var splitSegment = function (start, end, count) { if (count === 1) { return [[].concat(start)]; } var segments = []; if (end[0] === 'L' || end[0] === 'C' || end[0] === 'Q') { segments = segments.concat(splitCurve(start, end, count)); } else { var temp = [].concat(start); if (temp[0] === 'M') { temp[0] = 'L'; } for (var i = 0; i <= count - 1; i++) { segments.push(temp); } } return segments; }; var fillPath = function (source, target) { if (source.length === 1) { return source; } var sourceLen = source.length - 1; var targetLen = target.length - 1; var ratio = sourceLen / targetLen; var segmentsToFill = []; if (source.length === 1 && source[0][0] === 'M') { for (var i = 0; i < targetLen - sourceLen; i++) { source.push(source[0]); } return source; } for (var i = 0; i < targetLen; i++) { var index = Math.floor(ratio * i); segmentsToFill[index] = (segmentsToFill[index] || 0) + 1; } var filled = segmentsToFill.reduce(function (filled, count, i) { if (i === sourceLen) { return filled.concat(source[sourceLen]); } return filled.concat(splitSegment(source[i], source[i + 1], count)); }, []); filled.unshift(source[0]); if (target[targetLen] === 'Z' || target[targetLen] === 'z') { filled.push('Z'); } return filled; }; var isEqual = function (obj1, obj2) { if (obj1.length !== obj2.length) { return false; } var result = true; Object(_antv_util__WEBPACK_IMPORTED_MODULE_0__["each"])(obj1, function (item, i) { if (item !== obj2[i]) { result = false; return false; } }); return result; }; function getMinDiff(del, add, modify) { var type = null; var min = modify; if (add < min) { min = add; type = 'add'; } if (del < min) { min = del; type = 'del'; } return { type: type, min: min }; } /* * https://en.wikipedia.org/wiki/Levenshtein_distance * 计算两条path的编辑距离 */ var levenshteinDistance = function (source, target) { var sourceLen = source.length; var targetLen = target.length; var sourceSegment; var targetSegment; var temp = 0; if (sourceLen === 0 || targetLen === 0) { return null; } var dist = []; for (var i = 0; i <= sourceLen; i++) { dist[i] = []; dist[i][0] = { min: i }; } for (var j = 0; j <= targetLen; j++) { dist[0][j] = { min: j }; } for (var i = 1; i <= sourceLen; i++) { sourceSegment = source[i - 1]; for (var j = 1; j <= targetLen; j++) { targetSegment = target[j - 1]; if (isEqual(sourceSegment, targetSegment)) { temp = 0; } else { temp = 1; } var del = dist[i - 1][j].min + 1; var add = dist[i][j - 1].min + 1; var modify = dist[i - 1][j - 1].min + temp; dist[i][j] = getMinDiff(del, add, modify); } } return dist; }; var fillPathByDiff = function (source, target) { var diffMatrix = levenshteinDistance(source, target); var sourceLen = source.length; var targetLen = target.length; var changes = []; var index = 1; var minPos = 1; // 如果source和target不是完全不相等 if (diffMatrix[sourceLen][targetLen].min !== sourceLen) { // 获取从source到target所需改动 for (var i = 1; i <= sourceLen; i++) { var min = diffMatrix[i][i].min; minPos = i; for (var j = index; j <= targetLen; j++) { if (diffMatrix[i][j].min < min) { min = diffMatrix[i][j].min; minPos = j; } } index = minPos; if (diffMatrix[i][index].type) { changes.push({ index: i - 1, type: diffMatrix[i][index].type }); } } // 对source进行增删path for (var i = changes.length - 1; i >= 0; i--) { index = changes[i].index; if (changes[i].type === 'add') { source.splice(index, 0, [].concat(source[index])); } else { source.splice(index, 1); } } } // source尾部补齐 sourceLen = source.length; var diff = targetLen - sourceLen; if (sourceLen < targetLen) { for (var i = 0; i < diff; i++) { if (source[sourceLen - 1][0] === 'z' || source[sourceLen - 1][0] === 'Z') { source.splice(sourceLen - 2, 0, source[sourceLen - 2]); } else { source.push(source[sourceLen - 1]); } sourceLen += 1; } } return source; }; // 将两个点均分成count个点 function _splitPoints(points, former, count) { var result = [].concat(points); var index; var t = 1 / (count + 1); var formerEnd = _getSegmentPoints(former)[0]; for (var i = 1; i <= count; i++) { t *= i; index = Math.floor(points.length * t); if (index === 0) { result.unshift([formerEnd[0] * t + points[index][0] * (1 - t), formerEnd[1] * t + points[index][1] * (1 - t)]); } else { result.splice(index, 0, [formerEnd[0] * t + points[index][0] * (1 - t), formerEnd[1] * t + points[index][1] * (1 - t)]); } } return result; } /* * 抽取pathSegment中的关键点 * M,L,A,Q,H,V一个端点 * Q, S抽取一个端点,一个控制点 * C抽取一个端点,两个控制点 */ function _getSegmentPoints(segment) { var points = []; switch (segment[0]) { case 'M': points.push([segment[1], segment[2]]); break; case 'L': points.push([segment[1], segment[2]]); break; case 'A': points.push([segment[6], segment[7]]); break; case 'Q': points.push([segment[3], segment[4]]); points.push([segment[1], segment[2]]); break; case 'T': points.push([segment[1], segment[2]]); break; case 'C': points.push([segment[5], segment[6]]); points.push([segment[1], segment[2]]); points.push([segment[3], segment[4]]); break; case 'S': points.push([segment[3], segment[4]]); points.push([segment[1], segment[2]]); break; case 'H': points.push([segment[1], segment[1]]); break; case 'V': points.push([segment[1], segment[1]]); break; default: } return points; } var formatPath = function (fromPath, toPath) { if (fromPath.length <= 1) { return fromPath; } var points; for (var i = 0; i < toPath.length; i++) { if (fromPath[i][0] !== toPath[i][0]) { // 获取fromPath的pathSegment的端点,根据toPath的指令对其改造 points = _getSegmentPoints(fromPath[i]); switch (toPath[i][0]) { case 'M': fromPath[i] = ['M'].concat(points[0]); break; case 'L': fromPath[i] = ['L'].concat(points[0]); break; case 'A': fromPath[i] = [].concat(toPath[i]); fromPath[i][6] = points[0][0]; fromPath[i][7] = points[0][1]; break; case 'Q': if (points.length < 2) { if (i > 0) { points = _splitPoints(points, fromPath[i - 1], 1); } else { fromPath[i] = toPath[i]; break; } } fromPath[i] = ['Q'].concat(points.reduce(function (arr, i) { return arr.concat(i); }, [])); break; case 'T': fromPath[i] = ['T'].concat(points[0]); break; case 'C': if (points.length < 3) { if (i > 0) { points = _splitPoints(points, fromPath[i - 1], 2); } else { fromPath[i] = toPath[i]; break; } } fromPath[i] = ['C'].concat(points.reduce(function (arr, i) { return arr.concat(i); }, [])); break; case 'S': if (points.length < 2) { if (i > 0) { points = _splitPoints(points, fromPath[i - 1], 1); } else { fromPath[i] = toPath[i]; break; } } fromPath[i] = ['S'].concat(points.reduce(function (arr, i) { return arr.concat(i); }, [])); break; default: fromPath[i] = toPath[i]; } } } return fromPath; }; /***/ }), /***/ "./node_modules/_@antv_g-base@0.5.0-beta.1@@antv/g-base/esm/util/util.js": /*!*******************************************************************************!*\ !*** ./node_modules/_@antv_g-base@0.5.0-beta.1@@antv/g-base/esm/util/util.js ***! \*******************************************************************************/ /*! exports provided: removeFromArray, isBrowser, isNil, isFunction, isString, isObject, isArray, mix, each, upperFirst, isParent, isAllowCapture */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "removeFromArray", function() { return removeFromArray; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isBrowser", function() { return isBrowser; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isParent", function() { return isParent; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isAllowCapture", function() { return isAllowCapture; }); /* harmony import */ var _antv_util_lib_is_nil__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @antv/util/lib/is-nil */ "./node_modules/_@antv_util@2.0.9@@antv/util/lib/is-nil.js"); /* harmony import */ var _antv_util_lib_is_nil__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_antv_util_lib_is_nil__WEBPACK_IMPORTED_MODULE_0__); /* harmony reexport (default from non-harmony) */ __webpack_require__.d(__webpack_exports__, "isNil", function() { return _antv_util_lib_is_nil__WEBPACK_IMPORTED_MODULE_0___default.a; }); /* harmony import */ var _antv_util_lib_is_function__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @antv/util/lib/is-function */ "./node_modules/_@antv_util@2.0.9@@antv/util/lib/is-function.js"); /* harmony import */ var _antv_util_lib_is_function__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_antv_util_lib_is_function__WEBPACK_IMPORTED_MODULE_1__); /* harmony reexport (default from non-harmony) */ __webpack_require__.d(__webpack_exports__, "isFunction", function() { return _antv_util_lib_is_function__WEBPACK_IMPORTED_MODULE_1___default.a; }); /* harmony import */ var _antv_util_lib_is_string__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @antv/util/lib/is-string */ "./node_modules/_@antv_util@2.0.9@@antv/util/lib/is-string.js"); /* harmony import */ var _antv_util_lib_is_string__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_antv_util_lib_is_string__WEBPACK_IMPORTED_MODULE_2__); /* harmony reexport (default from non-harmony) */ __webpack_require__.d(__webpack_exports__, "isString", function() { return _antv_util_lib_is_string__WEBPACK_IMPORTED_MODULE_2___default.a; }); /* harmony import */ var _antv_util_lib_is_object__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @antv/util/lib/is-object */ "./node_modules/_@antv_util@2.0.9@@antv/util/lib/is-object.js"); /* harmony import */ var _antv_util_lib_is_object__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_antv_util_lib_is_object__WEBPACK_IMPORTED_MODULE_3__); /* harmony reexport (default from non-harmony) */ __webpack_require__.d(__webpack_exports__, "isObject", function() { return _antv_util_lib_is_object__WEBPACK_IMPORTED_MODULE_3___default.a; }); /* harmony import */ var _antv_util_lib_is_array__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @antv/util/lib/is-array */ "./node_modules/_@antv_util@2.0.9@@antv/util/lib/is-array.js"); /* harmony import */ var _antv_util_lib_is_array__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_antv_util_lib_is_array__WEBPACK_IMPORTED_MODULE_4__); /* harmony reexport (default from non-harmony) */ __webpack_require__.d(__webpack_exports__, "isArray", function() { return _antv_util_lib_is_array__WEBPACK_IMPORTED_MODULE_4___default.a; }); /* harmony import */ var _antv_util_lib_mix__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @antv/util/lib/mix */ "./node_modules/_@antv_util@2.0.9@@antv/util/lib/mix.js"); /* harmony import */ var _antv_util_lib_mix__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_antv_util_lib_mix__WEBPACK_IMPORTED_MODULE_5__); /* harmony reexport (default from non-harmony) */ __webpack_require__.d(__webpack_exports__, "mix", function() { return _antv_util_lib_mix__WEBPACK_IMPORTED_MODULE_5___default.a; }); /* harmony import */ var _antv_util_lib_each__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @antv/util/lib/each */ "./node_modules/_@antv_util@2.0.9@@antv/util/lib/each.js"); /* harmony import */ var _antv_util_lib_each__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(_antv_util_lib_each__WEBPACK_IMPORTED_MODULE_6__); /* harmony reexport (default from non-harmony) */ __webpack_require__.d(__webpack_exports__, "each", function() { return _antv_util_lib_each__WEBPACK_IMPORTED_MODULE_6___default.a; }); /* harmony import */ var _antv_util_lib_upper_first__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @antv/util/lib/upper-first */ "./node_modules/_@antv_util@2.0.9@@antv/util/lib/upper-first.js"); /* harmony import */ var _antv_util_lib_upper_first__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(_antv_util_lib_upper_first__WEBPACK_IMPORTED_MODULE_7__); /* harmony reexport (default from non-harmony) */ __webpack_require__.d(__webpack_exports__, "upperFirst", function() { return _antv_util_lib_upper_first__WEBPACK_IMPORTED_MODULE_7___default.a; }); function removeFromArray(arr, obj) { var index = arr.indexOf(obj); if (index !== -1) { arr.splice(index, 1); } } var isBrowser = typeof window !== 'undefined' && typeof window.document !== 'undefined'; // 是否元素的父容器 function isParent(container, shape) { // 所有 shape 都是 canvas 的子元素 if (container.isCanvas()) { return true; } var parent = shape.getParent(); var isParent = false; while (parent) { if (parent === container) { isParent = true; break; } parent = parent.getParent(); } return isParent; } function isAllowCapture(element) { // @ts-ignore return element.cfg.visible && element.cfg.capture; } /***/ }), /***/ "./node_modules/_@antv_g-base@0.5.0-beta.1@@antv/g-base/lib/bbox/circle.js": /*!*********************************************************************************!*\ !*** ./node_modules/_@antv_g-base@0.5.0-beta.1@@antv/g-base/lib/bbox/circle.js ***! \*********************************************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); function default_1(shape) { var _a = shape.attr(), x = _a.x, y = _a.y, r = _a.r; return { x: x - r, y: y - r, width: r * 2, height: r * 2 }; } exports.default = default_1; /***/ }), /***/ "./node_modules/_@antv_g-base@0.5.0-beta.1@@antv/g-base/lib/bbox/ellipse.js": /*!**********************************************************************************!*\ !*** ./node_modules/_@antv_g-base@0.5.0-beta.1@@antv/g-base/lib/bbox/ellipse.js ***! \**********************************************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); function default_1(shape) { var attrs = shape.attr(); var x = attrs.x, y = attrs.y, rx = attrs.rx, ry = attrs.ry; return { x: x - rx, y: y - ry, width: rx * 2, height: ry * 2 }; } exports.default = default_1; /***/ }), /***/ "./node_modules/_@antv_g-base@0.5.0-beta.1@@antv/g-base/lib/bbox/index.js": /*!********************************************************************************!*\ !*** ./node_modules/_@antv_g-base@0.5.0-beta.1@@antv/g-base/lib/bbox/index.js ***! \********************************************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var register_1 = __webpack_require__(/*! ./register */ "./node_modules/_@antv_g-base@0.5.0-beta.1@@antv/g-base/lib/bbox/register.js"); exports.getBBoxMethod = register_1.getMethod; var rect_1 = __webpack_require__(/*! ./rect */ "./node_modules/_@antv_g-base@0.5.0-beta.1@@antv/g-base/lib/bbox/rect.js"); var circle_1 = __webpack_require__(/*! ./circle */ "./node_modules/_@antv_g-base@0.5.0-beta.1@@antv/g-base/lib/bbox/circle.js"); var polyline_1 = __webpack_require__(/*! ./polyline */ "./node_modules/_@antv_g-base@0.5.0-beta.1@@antv/g-base/lib/bbox/polyline.js"); var polygon_1 = __webpack_require__(/*! ./polygon */ "./node_modules/_@antv_g-base@0.5.0-beta.1@@antv/g-base/lib/bbox/polygon.js"); var text_1 = __webpack_require__(/*! ./text */ "./node_modules/_@antv_g-base@0.5.0-beta.1@@antv/g-base/lib/bbox/text.js"); var path_1 = __webpack_require__(/*! ./path */ "./node_modules/_@antv_g-base@0.5.0-beta.1@@antv/g-base/lib/bbox/path.js"); var line_1 = __webpack_require__(/*! ./line */ "./node_modules/_@antv_g-base@0.5.0-beta.1@@antv/g-base/lib/bbox/line.js"); var ellipse_1 = __webpack_require__(/*! ./ellipse */ "./node_modules/_@antv_g-base@0.5.0-beta.1@@antv/g-base/lib/bbox/ellipse.js"); register_1.register('rect', rect_1.default); register_1.register('image', rect_1.default); // image 使用 rect 的包围盒计算 register_1.register('circle', circle_1.default); register_1.register('marker', circle_1.default); // marker 使用 circle 的计算方案 register_1.register('polyline', polyline_1.default); register_1.register('polygon', polygon_1.default); register_1.register('text', text_1.default); register_1.register('path', path_1.default); register_1.register('line', line_1.default); register_1.register('ellipse', ellipse_1.default); /***/ }), /***/ "./node_modules/_@antv_g-base@0.5.0-beta.1@@antv/g-base/lib/bbox/line.js": /*!*******************************************************************************!*\ !*** ./node_modules/_@antv_g-base@0.5.0-beta.1@@antv/g-base/lib/bbox/line.js ***! \*******************************************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var util_1 = __webpack_require__(/*! ./util */ "./node_modules/_@antv_g-base@0.5.0-beta.1@@antv/g-base/lib/bbox/util.js"); function default_1(shape) { var attrs = shape.attr(); var x1 = attrs.x1, y1 = attrs.y1, x2 = attrs.x2, y2 = attrs.y2; var minX = Math.min(x1, x2); var maxX = Math.max(x1, x2); var minY = Math.min(y1, y2); var maxY = Math.max(y1, y2); var bbox = { minX: minX, maxX: maxX, minY: minY, maxY: maxY }; bbox = util_1.mergeArrowBBox(shape, bbox); return { x: bbox.minX, y: bbox.minY, width: bbox.maxX - bbox.minX, height: bbox.maxY - bbox.minY }; } exports.default = default_1; /***/ }), /***/ "./node_modules/_@antv_g-base@0.5.0-beta.1@@antv/g-base/lib/bbox/path.js": /*!*******************************************************************************!*\ !*** ./node_modules/_@antv_g-base@0.5.0-beta.1@@antv/g-base/lib/bbox/path.js ***! \*******************************************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var quadratic_1 = __webpack_require__(/*! @antv/g-math/lib/quadratic */ "./node_modules/_@antv_g-math@0.1.3@@antv/g-math/lib/quadratic.js"); var cubic_1 = __webpack_require__(/*! @antv/g-math/lib/cubic */ "./node_modules/_@antv_g-math@0.1.3@@antv/g-math/lib/cubic.js"); var arc_1 = __webpack_require__(/*! @antv/g-math/lib/arc */ "./node_modules/_@antv_g-math@0.1.3@@antv/g-math/lib/arc.js"); var path_2_segments_1 = __webpack_require__(/*! @antv/path-util/lib/path-2-segments */ "./node_modules/_@antv_path-util@2.0.8@@antv/path-util/lib/path-2-segments.js"); var is_number_equal_1 = __webpack_require__(/*! @antv/util/lib/is-number-equal */ "./node_modules/_@antv_util@2.0.9@@antv/util/lib/is-number-equal.js"); var util_1 = __webpack_require__(/*! ./util */ "./node_modules/_@antv_g-base@0.5.0-beta.1@@antv/g-base/lib/bbox/util.js"); function getPathBox(segments, lineWidth) { var xArr = []; var yArr = []; var segmentsWithAngle = []; for (var i = 0; i < segments.length; i++) { var segment = segments[i]; var currentPoint = segment.currentPoint, params = segment.params, prePoint = segment.prePoint; var box = void 0; switch (segment.command) { case 'Q': box = quadratic_1.default.box(prePoint[0], prePoint[1], params[1], params[2], params[3], params[4]); break; case 'C': box = cubic_1.default.box(prePoint[0], prePoint[1], params[1], params[2], params[3], params[4], params[5], params[6]); break; case 'A': var arcParams = segment.arcParams; box = arc_1.default.box(arcParams.cx, arcParams.cy, arcParams.rx, arcParams.ry, arcParams.xRotation, arcParams.startAngle, arcParams.endAngle); break; default: xArr.push(currentPoint[0]); yArr.push(currentPoint[1]); break; } if (box) { segment.box = box; xArr.push(box.x, box.x + box.width); yArr.push(box.y, box.y + box.height); } if (lineWidth && (segment.command === 'L' || segment.command === 'M') && segment.prePoint && segment.nextPoint) { segmentsWithAngle.push(segment); } } // bbox calculation should ignore NaN for path attribute // ref: https://github.com/antvis/g/issues/210 xArr = xArr.filter(function (item) { return !Number.isNaN(item); }); yArr = yArr.filter(function (item) { return !Number.isNaN(item); }); var minX = Math.min.apply(null, xArr); var minY = Math.min.apply(null, yArr); var maxX = Math.max.apply(null, xArr); var maxY = Math.max.apply(null, yArr); if (segmentsWithAngle.length === 0) { return { x: minX, y: minY, width: maxX - minX, height: maxY - minY }; } for (var i = 0; i < segmentsWithAngle.length; i++) { var segment = segmentsWithAngle[i]; var currentPoint = segment.currentPoint; var extra = void 0; if (currentPoint[0] === minX) { extra = getExtraFromSegmentWithAngle(segment, lineWidth); minX = minX - extra.xExtra; } else if (currentPoint[0] === maxX) { extra = getExtraFromSegmentWithAngle(segment, lineWidth); maxX = maxX + extra.xExtra; } if (currentPoint[1] === minY) { extra = getExtraFromSegmentWithAngle(segment, lineWidth); minY = minY - extra.yExtra; } else if (currentPoint[1] === maxY) { extra = getExtraFromSegmentWithAngle(segment, lineWidth); maxY = maxY + extra.yExtra; } } return { x: minX, y: minY, width: maxX - minX, height: maxY - minY }; } function getExtraFromSegmentWithAngle(segment, lineWidth) { var prePoint = segment.prePoint, currentPoint = segment.currentPoint, nextPoint = segment.nextPoint; var currentAndPre = Math.pow(currentPoint[0] - prePoint[0], 2) + Math.pow(currentPoint[1] - prePoint[1], 2); var currentAndNext = Math.pow(currentPoint[0] - nextPoint[0], 2) + Math.pow(currentPoint[1] - nextPoint[1], 2); var preAndNext = Math.pow(prePoint[0] - nextPoint[0], 2) + Math.pow(prePoint[1] - nextPoint[1], 2); // 以 currentPoint 为顶点的夹角 var currentAngle = Math.acos((currentAndPre + currentAndNext - preAndNext) / (2 * Math.sqrt(currentAndPre) * Math.sqrt(currentAndNext))); // 夹角为空、 0 或 PI 时,不需要计算夹角处的额外宽度 // 注意: 由于计算精度问题,夹角为 0 的情况计算出来的角度可能是一个很小的值,还需要判断其与 0 是否近似相等 if (!currentAngle || Math.sin(currentAngle) === 0 || is_number_equal_1.default(currentAngle, 0)) { return { xExtra: 0, yExtra: 0 }; } var xAngle = Math.abs(Math.atan2(nextPoint[1] - currentPoint[1], nextPoint[0] - currentPoint[0])); var yAngle = Math.abs(Math.atan2(nextPoint[0] - currentPoint[0], nextPoint[1] - currentPoint[1])); // 将夹角转为锐角 xAngle = xAngle > Math.PI / 2 ? Math.PI - xAngle : xAngle; yAngle = yAngle > Math.PI / 2 ? Math.PI - yAngle : yAngle; // 这里不考虑在水平和垂直方向的投影,直接使用最大差值 // 由于上层统一加减了二分之一线宽,这里需要进行弥补 var extra = { // 水平方向投影 xExtra: Math.cos(currentAngle / 2 - xAngle) * (lineWidth / 2 * (1 / Math.sin(currentAngle / 2))) - lineWidth / 2 || 0, // 垂直方向投影 yExtra: Math.cos(yAngle - currentAngle / 2) * (lineWidth / 2 * (1 / Math.sin(currentAngle / 2))) - lineWidth / 2 || 0 }; return extra; } function default_1(shape) { var attrs = shape.attr(); var path = attrs.path, stroke = attrs.stroke; var lineWidth = stroke ? attrs.lineWidth : 0; // 只有有 stroke 时,lineWidth 才生效 var segments = shape.get('segments') || path_2_segments_1.default(path); var _a = getPathBox(segments, lineWidth), x = _a.x, y = _a.y, width = _a.width, height = _a.height; var bbox = { minX: x, minY: y, maxX: x + width, maxY: y + height }; bbox = util_1.mergeArrowBBox(shape, bbox); return { x: bbox.minX, y: bbox.minY, width: bbox.maxX - bbox.minX, height: bbox.maxY - bbox.minY }; } exports.default = default_1; /***/ }), /***/ "./node_modules/_@antv_g-base@0.5.0-beta.1@@antv/g-base/lib/bbox/polygon.js": /*!**********************************************************************************!*\ !*** ./node_modules/_@antv_g-base@0.5.0-beta.1@@antv/g-base/lib/bbox/polygon.js ***! \**********************************************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var util_1 = __webpack_require__(/*! @antv/g-math/lib/util */ "./node_modules/_@antv_g-math@0.1.3@@antv/g-math/lib/util.js"); function default_1(shape) { var attrs = shape.attr(); var points = attrs.points; var xArr = []; var yArr = []; for (var i = 0; i < points.length; i++) { var point = points[i]; xArr.push(point[0]); yArr.push(point[1]); } return util_1.getBBoxByArray(xArr, yArr); } exports.default = default_1; /***/ }), /***/ "./node_modules/_@antv_g-base@0.5.0-beta.1@@antv/g-base/lib/bbox/polyline.js": /*!***********************************************************************************!*\ !*** ./node_modules/_@antv_g-base@0.5.0-beta.1@@antv/g-base/lib/bbox/polyline.js ***! \***********************************************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var util_1 = __webpack_require__(/*! @antv/g-math/lib/util */ "./node_modules/_@antv_g-math@0.1.3@@antv/g-math/lib/util.js"); var util_2 = __webpack_require__(/*! ./util */ "./node_modules/_@antv_g-base@0.5.0-beta.1@@antv/g-base/lib/bbox/util.js"); function default_1(shape) { var attrs = shape.attr(); var points = attrs.points; var xArr = []; var yArr = []; for (var i = 0; i < points.length; i++) { var point = points[i]; xArr.push(point[0]); yArr.push(point[1]); } var _a = util_1.getBBoxByArray(xArr, yArr), x = _a.x, y = _a.y, width = _a.width, height = _a.height; var bbox = { minX: x, minY: y, maxX: x + width, maxY: y + height }; bbox = util_2.mergeArrowBBox(shape, bbox); return { x: bbox.minX, y: bbox.minY, width: bbox.maxX - bbox.minX, height: bbox.maxY - bbox.minY }; } exports.default = default_1; /***/ }), /***/ "./node_modules/_@antv_g-base@0.5.0-beta.1@@antv/g-base/lib/bbox/rect.js": /*!*******************************************************************************!*\ !*** ./node_modules/_@antv_g-base@0.5.0-beta.1@@antv/g-base/lib/bbox/rect.js ***! \*******************************************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); function default_1(shape) { var attrs = shape.attr(); var x = attrs.x, y = attrs.y, width = attrs.width, height = attrs.height; return { x: x, y: y, width: width, height: height }; } exports.default = default_1; /***/ }), /***/ "./node_modules/_@antv_g-base@0.5.0-beta.1@@antv/g-base/lib/bbox/register.js": /*!***********************************************************************************!*\ !*** ./node_modules/_@antv_g-base@0.5.0-beta.1@@antv/g-base/lib/bbox/register.js ***! \***********************************************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var cache = new Map(); /** * 注册计算包围盒的算法 * @param type 方法名 * @param method 方法 */ function register(type, method) { cache.set(type, method); } exports.register = register; /** * 获取计算包围盒的算法 * @param type 方法名 */ function getMethod(type) { return cache.get(type); } exports.getMethod = getMethod; /***/ }), /***/ "./node_modules/_@antv_g-base@0.5.0-beta.1@@antv/g-base/lib/bbox/text.js": /*!*******************************************************************************!*\ !*** ./node_modules/_@antv_g-base@0.5.0-beta.1@@antv/g-base/lib/bbox/text.js ***! \*******************************************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var text_1 = __webpack_require__(/*! ../util/text */ "./node_modules/_@antv_g-base@0.5.0-beta.1@@antv/g-base/lib/util/text.js"); function default_1(shape) { var attrs = shape.attr(); var x = attrs.x, y = attrs.y, text = attrs.text, fontSize = attrs.fontSize, lineHeight = attrs.lineHeight; var font = attrs.font; if (!font) { // 如果未组装 font font = text_1.assembleFont(attrs); } var width = text_1.getTextWidth(text, font); var bbox; if (!width) { // 如果width不存在,四点共其实点 bbox = { x: x, y: y, width: 0, height: 0 }; } else { var textAlign = attrs.textAlign, textBaseline = attrs.textBaseline; var height = text_1.getTextHeight(text, fontSize, lineHeight); // attrs.height // 默认左右对齐:left, 默认上下对齐 bottom var point = { x: x, y: y - height }; if (textAlign) { if (textAlign === 'end' || textAlign === 'right') { point.x -= width; } else if (textAlign === 'center') { point.x -= width / 2; } } if (textBaseline) { if (textBaseline === 'top') { point.y += height; } else if (textBaseline === 'middle') { point.y += height / 2; } } bbox = { x: point.x, y: point.y, width: width, height: height }; } return bbox; } exports.default = default_1; /***/ }), /***/ "./node_modules/_@antv_g-base@0.5.0-beta.1@@antv/g-base/lib/bbox/util.js": /*!*******************************************************************************!*\ !*** ./node_modules/_@antv_g-base@0.5.0-beta.1@@antv/g-base/lib/bbox/util.js ***! \*******************************************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); // 合并包围盒 function mergeBBox(bbox1, bbox2) { if (!bbox1 || !bbox2) { return bbox1 || bbox2; } return { minX: Math.min(bbox1.minX, bbox2.minX), minY: Math.min(bbox1.minY, bbox2.minY), maxX: Math.max(bbox1.maxX, bbox2.maxX), maxY: Math.max(bbox1.maxY, bbox2.maxY) }; } exports.mergeBBox = mergeBBox; // 合并箭头的包围盒 function mergeArrowBBox(shape, bbox) { var startArrowShape = shape.get('startArrowShape'); var endArrowShape = shape.get('endArrowShape'); var startArrowBBox = null; var endArrowBBox = null; if (startArrowShape) { startArrowBBox = startArrowShape.getCanvasBBox(); bbox = mergeBBox(bbox, startArrowBBox); } if (endArrowShape) { endArrowBBox = endArrowShape.getCanvasBBox(); bbox = mergeBBox(bbox, endArrowBBox); } return bbox; } exports.mergeArrowBBox = mergeArrowBBox; /***/ }), /***/ "./node_modules/_@antv_g-base@0.5.0-beta.1@@antv/g-base/lib/interfaces.js": /*!********************************************************************************!*\ !*** ./node_modules/_@antv_g-base@0.5.0-beta.1@@antv/g-base/lib/interfaces.js ***! \********************************************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); /***/ }), /***/ "./node_modules/_@antv_g-base@0.5.0-beta.1@@antv/g-base/lib/types.js": /*!***************************************************************************!*\ !*** ./node_modules/_@antv_g-base@0.5.0-beta.1@@antv/g-base/lib/types.js ***! \***************************************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); /***/ }), /***/ "./node_modules/_@antv_g-base@0.5.0-beta.1@@antv/g-base/lib/util/matrix.js": /*!*********************************************************************************!*\ !*** ./node_modules/_@antv_g-base@0.5.0-beta.1@@antv/g-base/lib/util/matrix.js ***! \*********************************************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /** * @fileoverview 矩阵运算,本来是要引入 gl-matrix, 但是考虑到 g-mobile 对大小有限制,同时 g-webgl 使用的 matrix 不一致 * 所以,这里仅实现 2D 几个运算,上层自己引入 gl-matrix * @author dxq613@gmail.com */ Object.defineProperty(exports, "__esModule", { value: true }); /** * 3阶矩阵相乘 * @param {number[]} a 矩阵1 * @param {number[]} b 矩阵2 */ function multiplyMatrix(a, b) { var out = []; var a00 = a[0]; var a01 = a[1]; var a02 = a[2]; var a10 = a[3]; var a11 = a[4]; var a12 = a[5]; var a20 = a[6]; var a21 = a[7]; var a22 = a[8]; var b00 = b[0]; var b01 = b[1]; var b02 = b[2]; var b10 = b[3]; var b11 = b[4]; var b12 = b[5]; var b20 = b[6]; var b21 = b[7]; var b22 = b[8]; out[0] = b00 * a00 + b01 * a10 + b02 * a20; out[1] = b00 * a01 + b01 * a11 + b02 * a21; out[2] = b00 * a02 + b01 * a12 + b02 * a22; out[3] = b10 * a00 + b11 * a10 + b12 * a20; out[4] = b10 * a01 + b11 * a11 + b12 * a21; out[5] = b10 * a02 + b11 * a12 + b12 * a22; out[6] = b20 * a00 + b21 * a10 + b22 * a20; out[7] = b20 * a01 + b21 * a11 + b22 * a21; out[8] = b20 * a02 + b21 * a12 + b22 * a22; return out; } exports.multiplyMatrix = multiplyMatrix; /** * 3阶矩阵同2阶向量相乘 * @param {number[]} m 矩阵 * @param {number[]} v 二阶向量 */ function multiplyVec2(m, v) { var out = []; var x = v[0]; var y = v[1]; out[0] = m[0] * x + m[3] * y + m[6]; out[1] = m[1] * x + m[4] * y + m[7]; return out; } exports.multiplyVec2 = multiplyVec2; /** * 矩阵的逆 * @param {number[]} a 矩阵 */ function invert(a) { var out = []; var a00 = a[0]; var a01 = a[1]; var a02 = a[2]; var a10 = a[3]; var a11 = a[4]; var a12 = a[5]; var a20 = a[6]; var a21 = a[7]; var a22 = a[8]; var b01 = a22 * a11 - a12 * a21; var b11 = -a22 * a10 + a12 * a20; var b21 = a21 * a10 - a11 * a20; // Calculate the determinant var det = a00 * b01 + a01 * b11 + a02 * b21; if (!det) { return null; } det = 1.0 / det; out[0] = b01 * det; out[1] = (-a22 * a01 + a02 * a21) * det; out[2] = (a12 * a01 - a02 * a11) * det; out[3] = b11 * det; out[4] = (a22 * a00 - a02 * a20) * det; out[5] = (-a12 * a00 + a02 * a10) * det; out[6] = b21 * det; out[7] = (-a21 * a00 + a01 * a20) * det; out[8] = (a11 * a00 - a01 * a10) * det; return out; } exports.invert = invert; /***/ }), /***/ "./node_modules/_@antv_g-base@0.5.0-beta.1@@antv/g-base/lib/util/offscreen.js": /*!************************************************************************************!*\ !*** ./node_modules/_@antv_g-base@0.5.0-beta.1@@antv/g-base/lib/util/offscreen.js ***! \************************************************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); // 全局设置一个唯一离屏的 ctx,用于计算 isPointInPath var offScreenCtx = null; function getOffScreenContext() { if (!offScreenCtx) { var canvas = document.createElement('canvas'); canvas.width = 1; canvas.height = 1; offScreenCtx = canvas.getContext('2d'); } return offScreenCtx; } exports.getOffScreenContext = getOffScreenContext; /***/ }), /***/ "./node_modules/_@antv_g-base@0.5.0-beta.1@@antv/g-base/lib/util/text.js": /*!*******************************************************************************!*\ !*** ./node_modules/_@antv_g-base@0.5.0-beta.1@@antv/g-base/lib/util/text.js ***! \*******************************************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var util_1 = __webpack_require__(/*! ./util */ "./node_modules/_@antv_g-base@0.5.0-beta.1@@antv/g-base/lib/util/util.js"); var offscreen_1 = __webpack_require__(/*! ./offscreen */ "./node_modules/_@antv_g-base@0.5.0-beta.1@@antv/g-base/lib/util/offscreen.js"); /** * 获取文本的高度 * @param text 文本 * @param fontSize 字体大小 * @param lineHeight 行高,可以为空 */ function getTextHeight(text, fontSize, lineHeight) { var lineCount = 1; if (util_1.isString(text)) { lineCount = text.split('\n').length; } if (lineCount > 1) { var spaceingY = getLineSpaceing(fontSize, lineHeight); return fontSize * lineCount + spaceingY * (lineCount - 1); } return fontSize; } exports.getTextHeight = getTextHeight; /** * 获取行间距如果文本多行,需要获取文本间距 * @param fontSize 字体大小 * @param lineHeight 行高 */ function getLineSpaceing(fontSize, lineHeight) { return lineHeight ? lineHeight - fontSize : fontSize * 0.14; } exports.getLineSpaceing = getLineSpaceing; /** * 字体宽度 * @param text 文本 * @param font 字体 */ function getTextWidth(text, font) { var context = offscreen_1.getOffScreenContext(); // 获取离屏的 ctx 进行计算 var width = 0; // null 或者 undefined 时,宽度为 0 if (util_1.isNil(text) || text === '') { return width; } context.save(); context.font = font; if (util_1.isString(text) && text.includes('\n')) { var textArr = text.split('\n'); util_1.each(textArr, function (subText) { var measureWidth = context.measureText(subText).width; if (width < measureWidth) { width = measureWidth; } }); } else { width = context.measureText(text).width; } context.restore(); return width; } exports.getTextWidth = getTextWidth; function assembleFont(attrs) { var fontSize = attrs.fontSize, fontFamily = attrs.fontFamily, fontWeight = attrs.fontWeight, fontStyle = attrs.fontStyle, fontVariant = attrs.fontVariant; return [fontStyle, fontVariant, fontWeight, fontSize + "px", fontFamily].join(' ').trim(); } exports.assembleFont = assembleFont; /***/ }), /***/ "./node_modules/_@antv_g-base@0.5.0-beta.1@@antv/g-base/lib/util/util.js": /*!*******************************************************************************!*\ !*** ./node_modules/_@antv_g-base@0.5.0-beta.1@@antv/g-base/lib/util/util.js ***! \*******************************************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); function removeFromArray(arr, obj) { var index = arr.indexOf(obj); if (index !== -1) { arr.splice(index, 1); } } exports.removeFromArray = removeFromArray; exports.isBrowser = typeof window !== 'undefined' && typeof window.document !== 'undefined'; var is_nil_1 = __webpack_require__(/*! @antv/util/lib/is-nil */ "./node_modules/_@antv_util@2.0.9@@antv/util/lib/is-nil.js"); exports.isNil = is_nil_1.default; var is_function_1 = __webpack_require__(/*! @antv/util/lib/is-function */ "./node_modules/_@antv_util@2.0.9@@antv/util/lib/is-function.js"); exports.isFunction = is_function_1.default; var is_string_1 = __webpack_require__(/*! @antv/util/lib/is-string */ "./node_modules/_@antv_util@2.0.9@@antv/util/lib/is-string.js"); exports.isString = is_string_1.default; var is_object_1 = __webpack_require__(/*! @antv/util/lib/is-object */ "./node_modules/_@antv_util@2.0.9@@antv/util/lib/is-object.js"); exports.isObject = is_object_1.default; var is_array_1 = __webpack_require__(/*! @antv/util/lib/is-array */ "./node_modules/_@antv_util@2.0.9@@antv/util/lib/is-array.js"); exports.isArray = is_array_1.default; var mix_1 = __webpack_require__(/*! @antv/util/lib/mix */ "./node_modules/_@antv_util@2.0.9@@antv/util/lib/mix.js"); exports.mix = mix_1.default; var each_1 = __webpack_require__(/*! @antv/util/lib/each */ "./node_modules/_@antv_util@2.0.9@@antv/util/lib/each.js"); exports.each = each_1.default; var upper_first_1 = __webpack_require__(/*! @antv/util/lib/upper-first */ "./node_modules/_@antv_util@2.0.9@@antv/util/lib/upper-first.js"); exports.upperFirst = upper_first_1.default; // 是否元素的父容器 function isParent(container, shape) { // 所有 shape 都是 canvas 的子元素 if (container.isCanvas()) { return true; } var parent = shape.getParent(); var isParent = false; while (parent) { if (parent === container) { isParent = true; break; } parent = parent.getParent(); } return isParent; } exports.isParent = isParent; function isAllowCapture(element) { // @ts-ignore return element.cfg.visible && element.cfg.capture; } exports.isAllowCapture = isAllowCapture; /***/ }), /***/ "./node_modules/_@antv_g-base@0.5.0-beta.1@@antv/g-base/package.json": /*!***************************************************************************!*\ !*** ./node_modules/_@antv_g-base@0.5.0-beta.1@@antv/g-base/package.json ***! \***************************************************************************/ /*! exports provided: name, version, description, main, module, types, files, scripts, repository, keywords, publishConfig, author, license, bugs, devDependencies, homepage, dependencies, __npminstall_done, gitHead, _from, _resolved, default */ /***/ (function(module) { module.exports = JSON.parse("{\"name\":\"@antv/g-base\",\"version\":\"0.5.0-beta.1\",\"description\":\"A common util collection for antv projects\",\"main\":\"lib/index.js\",\"module\":\"esm/index.js\",\"types\":\"lib/index.d.ts\",\"files\":[\"package.json\",\"esm\",\"lib\",\"LICENSE\",\"README.md\"],\"scripts\":{\"build\":\"npm run clean && run-p build:*\",\"build:esm\":\"tsc -p tsconfig.json --target ES5 --module ESNext --outDir esm\",\"build:cjs\":\"tsc -p tsconfig.json --target ES5 --module commonjs --outDir lib\",\"clean\":\"rm -rf esm lib\",\"watch:cjs\":\"tsc-watch -p tsconfig.json --target ES5 --module commonjs --outDir lib --compiler typescript/bin/tsc\",\"coverage\":\"npm run coverage-generator && npm run coverage-viewer\",\"coverage-generator\":\"torch --coverage --compile --source-pattern src/*.js,src/**/*.js --opts tests/mocha.opts\",\"coverage-viewer\":\"torch-coverage\",\"test\":\"torch --renderer --compile --opts tests/mocha.opts\",\"test-live\":\"torch --compile --interactive tests/unit\",\"tsc\":\"tsc --noEmit\",\"typecheck\":\"tsc --noEmit\"},\"repository\":{\"type\":\"git\",\"url\":\"git+https://github.com/antvis/util.git\"},\"keywords\":[\"util\",\"antv\",\"g\"],\"publishConfig\":{\"access\":\"public\"},\"author\":\"https://github.com/orgs/antvis/people\",\"license\":\"ISC\",\"bugs\":{\"url\":\"https://github.com/antvis/util/issues\"},\"devDependencies\":{\"@antv/torch\":\"^1.0.0\",\"gl-matrix\":\"^3.0.0\",\"less\":\"^3.9.0\",\"npm-run-all\":\"^4.1.5\",\"tsc-watch\":\"^4.0.0\"},\"homepage\":\"https://github.com/antvis/util#readme\",\"dependencies\":{\"@antv/event-emitter\":\"^0.1.1\",\"@antv/g-math\":\"^0.1.3\",\"@antv/matrix-util\":\"^3.1.0-beta.1\",\"@antv/path-util\":\"~2.0.5\",\"@antv/util\":\"~2.0.0\",\"@types/d3-timer\":\"^1.0.9\",\"d3-ease\":\"^1.0.5\",\"d3-interpolate\":\"^1.3.2\",\"d3-timer\":\"^1.0.9\",\"detect-browser\":\"^5.1.0\"},\"__npminstall_done\":\"Fri May 29 2020 19:03:41 GMT+0800 (GMT+08:00)\",\"gitHead\":\"f1dd2cc436ea123939f400a9a9d88f1ebce46be9\",\"_from\":\"@antv/g-base@0.5.0-beta.1\",\"_resolved\":\"https://registry.npm.taobao.org/@antv/g-base/download/@antv/g-base-0.5.0-beta.1.tgz\"}"); /***/ }), /***/ "./node_modules/_@antv_g-math@0.1.3@@antv/g-math/lib/arc.js": /*!******************************************************************!*\ !*** ./node_modules/_@antv_g-math@0.1.3@@antv/g-math/lib/arc.js ***! \******************************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var util_1 = __webpack_require__(/*! ./util */ "./node_modules/_@antv_g-math@0.1.3@@antv/g-math/lib/util.js"); var ellipse_1 = __webpack_require__(/*! ./ellipse */ "./node_modules/_@antv_g-math@0.1.3@@antv/g-math/lib/ellipse.js"); // 偏导数 x function derivativeXAt(cx, cy, rx, ry, xRotation, startAngle, endAngle, angle) { return -1 * rx * Math.cos(xRotation) * Math.sin(angle) - ry * Math.sin(xRotation) * Math.cos(angle); } // 偏导数 y function derivativeYAt(cx, cy, rx, ry, xRotation, startAngle, endAngle, angle) { return -1 * rx * Math.sin(xRotation) * Math.sin(angle) + ry * Math.cos(xRotation) * Math.cos(angle); } // x 的极值 function xExtrema(rx, ry, xRotation) { return Math.atan(-ry / rx * Math.tan(xRotation)); } // y 的极值 function yExtrema(rx, ry, xRotation) { return Math.atan(ry / (rx * Math.tan(xRotation))); } // 根据角度求 x 坐标 function xAt(cx, cy, rx, ry, xRotation, angle) { return rx * Math.cos(xRotation) * Math.cos(angle) - ry * Math.sin(xRotation) * Math.sin(angle) + cx; } // 根据角度求 y 坐标 function yAt(cx, cy, rx, ry, xRotation, angle) { return rx * Math.sin(xRotation) * Math.cos(angle) + ry * Math.cos(xRotation) * Math.sin(angle) + cy; } // 获取点在椭圆上的角度 function getAngle(rx, ry, x0, y0) { var angle = Math.atan2(y0 * rx, x0 * ry); // 转换到 0 - 2PI 内 return (angle + Math.PI * 2) % (Math.PI * 2); } // 根据角度获取,x,y function getPoint(rx, ry, angle) { return { x: rx * Math.cos(angle), y: ry * Math.sin(angle) }; } // 旋转 function rotate(x, y, angle) { var cos = Math.cos(angle); var sin = Math.sin(angle); return [x * cos - y * sin, x * sin + y * cos]; } exports.default = { /** * 计算包围盒 * @param {number} cx 圆心 x * @param {number} cy 圆心 y * @param {number} rx x 轴方向的半径 * @param {number} ry y 轴方向的半径 * @param {number} xRotation 旋转角度 * @param {number} startAngle 起始角度 * @param {number} endAngle 结束角度 * @return {object} 包围盒对象 */ box: function (cx, cy, rx, ry, xRotation, startAngle, endAngle) { var xDim = xExtrema(rx, ry, xRotation); var minX = Infinity; var maxX = -Infinity; var xs = [startAngle, endAngle]; for (var i = -Math.PI * 2; i <= Math.PI * 2; i += Math.PI) { var xAngle = xDim + i; if (startAngle < endAngle) { if (startAngle < xAngle && xAngle < endAngle) { xs.push(xAngle); } } else { if (endAngle < xAngle && xAngle < startAngle) { xs.push(xAngle); } } } for (var i = 0; i < xs.length; i++) { var x = xAt(cx, cy, rx, ry, xRotation, xs[i]); if (x < minX) { minX = x; } if (x > maxX) { maxX = x; } } var yDim = yExtrema(rx, ry, xRotation); var minY = Infinity; var maxY = -Infinity; var ys = [startAngle, endAngle]; for (var i = -Math.PI * 2; i <= Math.PI * 2; i += Math.PI) { var yAngle = yDim + i; if (startAngle < endAngle) { if (startAngle < yAngle && yAngle < endAngle) { ys.push(yAngle); } } else { if (endAngle < yAngle && yAngle < startAngle) { ys.push(yAngle); } } } for (var i = 0; i < ys.length; i++) { var y = yAt(cx, cy, rx, ry, xRotation, ys[i]); if (y < minY) { minY = y; } if (y > maxY) { maxY = y; } } return { x: minX, y: minY, width: maxX - minX, height: maxY - minY }; }, /** * 获取圆弧的长度,计算圆弧长度时不考虑旋转角度, * 仅跟 rx, ry, startAngle, endAngle 相关 * @param {number} cx 圆心 x * @param {number} cy 圆心 y * @param {number} rx x 轴方向的半径 * @param {number} ry y 轴方向的半径 * @param {number} xRotation 旋转角度 * @param {number} startAngle 起始角度 * @param {number} endAngle 结束角度 */ length: function (cx, cy, rx, ry, xRotation, startAngle, endAngle) {}, /** * 获取指定点到圆弧的最近距离的点 * @param {number} cx 圆心 x * @param {number} cy 圆心 y * @param {number} rx x 轴方向的半径 * @param {number} ry y 轴方向的半径 * @param {number} xRotation 旋转角度 * @param {number} startAngle 起始角度 * @param {number} endAngle 结束角度 * @param {number} x0 指定点的 x * @param {number} y0 指定点的 y * @return {object} 到指定点最近距离的点 */ nearestPoint: function (cx, cy, rx, ry, xRotation, startAngle, endAngle, x0, y0) { // 将最近距离问题转换成到椭圆中心 0,0 没有旋转的椭圆问题 var relativeVector = rotate(x0 - cx, y0 - cy, -xRotation); var x1 = relativeVector[0], y1 = relativeVector[1]; // 计算点到椭圆的最近的点 var relativePoint = ellipse_1.default.nearestPoint(0, 0, rx, ry, x1, y1); // 获取点在椭圆上的角度 var angle = getAngle(rx, ry, relativePoint.x, relativePoint.y); // 点没有在圆弧上 if (angle < startAngle) { // 小于起始圆弧 relativePoint = getPoint(rx, ry, startAngle); } else if (angle > endAngle) { // 大于结束圆弧 relativePoint = getPoint(rx, ry, endAngle); } // 旋转到 xRotation 的角度 var vector = rotate(relativePoint.x, relativePoint.y, xRotation); return { x: vector[0] + cx, y: vector[1] + cy }; }, pointDistance: function (cx, cy, rx, ry, xRotation, startAngle, endAngle, x0, y0) { var nearestPoint = this.nearestPoint(cx, cy, rx, ry, x0, y0); return util_1.distance(nearestPoint.x, nearestPoint.y, x0, y0); }, pointAt: function (cx, cy, rx, ry, xRotation, startAngle, endAngle, t) { var angle = (endAngle - startAngle) * t + startAngle; return { x: xAt(cx, cy, rx, ry, xRotation, angle), y: yAt(cx, cy, rx, ry, xRotation, angle) }; }, tangentAngle: function (cx, cy, rx, ry, xRotation, startAngle, endAngle, t) { var angle = (endAngle - startAngle) * t + startAngle; var dx = derivativeXAt(cx, cy, rx, ry, xRotation, startAngle, endAngle, angle); var dy = derivativeYAt(cx, cy, rx, ry, xRotation, startAngle, endAngle, angle); return util_1.piMod(Math.atan2(dy, dx)); } }; /***/ }), /***/ "./node_modules/_@antv_g-math@0.1.3@@antv/g-math/lib/bezier.js": /*!*********************************************************************!*\ !*** ./node_modules/_@antv_g-math@0.1.3@@antv/g-math/lib/bezier.js ***! \*********************************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var util_1 = __webpack_require__(/*! ./util */ "./node_modules/_@antv_g-math@0.1.3@@antv/g-math/lib/util.js"); var EPSILON = 0.0001; /** * 使用牛顿切割法求最近的点 * @param {number[]} xArr 点的 x 数组 * @param {number[]} yArr 点的 y 数组 * @param {number} x 指定的点 x * @param {number} y 指定的点 y * @param {Function} tCallback 差值函数 */ function nearestPoint(xArr, yArr, x, y, tCallback) { var t; var interval = 0.005; var d = Infinity; var v0 = [x, y]; for (var i = 0; i <= 20; i++) { var _t = i * 0.05; var v1 = [tCallback.apply(null, xArr.concat([_t])), tCallback.apply(null, yArr.concat([_t]))]; var d1 = util_1.distance(v0[0], v0[1], v1[0], v1[1]); if (d1 < d) { t = _t; d = d1; } } // 提前终止 if (t === 0) { return { x: xArr[0], y: yArr[0] }; } if (t === 1) { var count = xArr.length; return { x: xArr[count - 1], y: yArr[count - 1] }; } d = Infinity; for (var i = 0; i < 32; i++) { if (interval < EPSILON) { break; } var prev = t - interval; var next = t + interval; var v1 = [tCallback.apply(null, xArr.concat([prev])), tCallback.apply(null, yArr.concat([prev]))]; var d1 = util_1.distance(v0[0], v0[1], v1[0], v1[1]); if (prev >= 0 && d1 < d) { t = prev; d = d1; } else { var v2 = [tCallback.apply(null, xArr.concat([next])), tCallback.apply(null, yArr.concat([next]))]; var d2 = util_1.distance(v0[0], v0[1], v2[0], v2[1]); if (next <= 1 && d2 < d) { t = next; d = d2; } else { interval *= 0.5; } } } return { x: tCallback.apply(null, xArr.concat([t])), y: tCallback.apply(null, yArr.concat([t])) }; } exports.nearestPoint = nearestPoint; // 近似求解 https://community.khronos.org/t/3d-cubic-bezier-segment-length/62363/2 function snapLength(xArr, yArr) { var totalLength = 0; var count = xArr.length; for (var i = 0; i < count; i++) { var x = xArr[i]; var y = yArr[i]; var nextX = xArr[(i + 1) % count]; var nextY = yArr[(i + 1) % count]; totalLength += util_1.distance(x, y, nextX, nextY); } return totalLength / 2; } exports.snapLength = snapLength; /***/ }), /***/ "./node_modules/_@antv_g-math@0.1.3@@antv/g-math/lib/cubic.js": /*!********************************************************************!*\ !*** ./node_modules/_@antv_g-math@0.1.3@@antv/g-math/lib/cubic.js ***! \********************************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var util_1 = __webpack_require__(/*! ./util */ "./node_modules/_@antv_g-math@0.1.3@@antv/g-math/lib/util.js"); var line_1 = __webpack_require__(/*! ./line */ "./node_modules/_@antv_g-math@0.1.3@@antv/g-math/lib/line.js"); var bezier_1 = __webpack_require__(/*! ./bezier */ "./node_modules/_@antv_g-math@0.1.3@@antv/g-math/lib/bezier.js"); function cubicAt(p0, p1, p2, p3, t) { var onet = 1 - t; // t * t * t 的性能大概是 Math.pow(t, 3) 的三倍 return onet * onet * onet * p0 + 3 * p1 * t * onet * onet + 3 * p2 * t * t * onet + p3 * t * t * t; } function derivativeAt(p0, p1, p2, p3, t) { var onet = 1 - t; return 3 * (onet * onet * (p1 - p0) + 2 * onet * t * (p2 - p1) + t * t * (p3 - p2)); } function extrema(p0, p1, p2, p3) { var a = -3 * p0 + 9 * p1 - 9 * p2 + 3 * p3; var b = 6 * p0 - 12 * p1 + 6 * p2; var c = 3 * p1 - 3 * p0; var extremas = []; var t1; var t2; var discSqrt; if (util_1.isNumberEqual(a, 0)) { if (!util_1.isNumberEqual(b, 0)) { t1 = -c / b; if (t1 >= 0 && t1 <= 1) { extremas.push(t1); } } } else { var disc = b * b - 4 * a * c; if (util_1.isNumberEqual(disc, 0)) { extremas.push(-b / (2 * a)); } else if (disc > 0) { discSqrt = Math.sqrt(disc); t1 = (-b + discSqrt) / (2 * a); t2 = (-b - discSqrt) / (2 * a); if (t1 >= 0 && t1 <= 1) { extremas.push(t1); } if (t2 >= 0 && t2 <= 1) { extremas.push(t2); } } } return extremas; } // 分割贝塞尔曲线 function divideCubic(x1, y1, x2, y2, x3, y3, x4, y4, t) { // 划分点 var xt = cubicAt(x1, x2, x3, x4, t); var yt = cubicAt(y1, y2, y3, y4, t); // 计算两点之间的差值点 var c1 = line_1.default.pointAt(x1, y1, x2, y2, t); var c2 = line_1.default.pointAt(x2, y2, x3, y3, t); var c3 = line_1.default.pointAt(x3, y3, x4, y4, t); var c12 = line_1.default.pointAt(c1.x, c1.y, c2.x, c2.y, t); var c23 = line_1.default.pointAt(c2.x, c2.y, c3.x, c3.y, t); return [[x1, y1, c1.x, c1.y, c12.x, c12.y, xt, yt], [xt, yt, c23.x, c23.y, c3.x, c3.y, x4, y4]]; } // 使用迭代法取贝塞尔曲线的长度,二阶和三阶分开写,更清晰和便于调试 function cubicLength(x1, y1, x2, y2, x3, y3, x4, y4, iterationCount) { if (iterationCount === 0) { return bezier_1.snapLength([x1, x2, x3, x4], [y1, y2, y3, y4]); } var cubics = divideCubic(x1, y1, x2, y2, x3, y3, x4, y4, 0.5); var left = cubics[0]; var right = cubics[1]; left.push(iterationCount - 1); right.push(iterationCount - 1); return cubicLength.apply(null, left) + cubicLength.apply(null, right); } exports.default = { extrema: extrema, box: function (x1, y1, x2, y2, x3, y3, x4, y4) { var xArr = [x1, x4]; var yArr = [y1, y4]; var xExtrema = extrema(x1, x2, x3, x4); var yExtrema = extrema(y1, y2, y3, y4); for (var i = 0; i < xExtrema.length; i++) { xArr.push(cubicAt(x1, x2, x3, x4, xExtrema[i])); } for (var i = 0; i < yExtrema.length; i++) { yArr.push(cubicAt(y1, y2, y3, y4, yExtrema[i])); } return util_1.getBBoxByArray(xArr, yArr); }, length: function (x1, y1, x2, y2, x3, y3, x4, y4) { // 迭代三次,划分成 8 段求长度 return cubicLength(x1, y1, x2, y2, x3, y3, x4, y4, 3); }, nearestPoint: function (x1, y1, x2, y2, x3, y3, x4, y4, x0, y0) { return bezier_1.nearestPoint([x1, x2, x3, x4], [y1, y2, y3, y4], x0, y0, cubicAt); }, pointDistance: function (x1, y1, x2, y2, x3, y3, x4, y4, x0, y0) { var point = this.nearestPoint(x1, y1, x2, y2, x3, y3, x4, y4, x0, y0); return util_1.distance(point.x, point.y, x0, y0); }, interpolationAt: cubicAt, pointAt: function (x1, y1, x2, y2, x3, y3, x4, y4, t) { return { x: cubicAt(x1, x2, x3, x4, t), y: cubicAt(y1, y2, y3, y4, t) }; }, divide: function (x1, y1, x2, y2, x3, y3, x4, y4, t) { return divideCubic(x1, y1, x2, y2, x3, y3, x4, y4, t); }, tangentAngle: function (x1, y1, x2, y2, x3, y3, x4, y4, t) { var dx = derivativeAt(x1, x2, x3, x4, t); var dy = derivativeAt(y1, y2, y3, y4, t); return util_1.piMod(Math.atan2(dy, dx)); } }; /***/ }), /***/ "./node_modules/_@antv_g-math@0.1.3@@antv/g-math/lib/ellipse.js": /*!**********************************************************************!*\ !*** ./node_modules/_@antv_g-math@0.1.3@@antv/g-math/lib/ellipse.js ***! \**********************************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /** * @fileoverview 椭圆的一些计算, * - 周长计算参考:https://www.mathsisfun.com/geometry/ellipse-perimeter.html * - 距离计算参考:https://wet-robots.ghost.io/simple-method-for-distance-to-ellipse/ * @author dxq613@gmail.com */ Object.defineProperty(exports, "__esModule", { value: true }); var util_1 = __webpack_require__(/*! ./util */ "./node_modules/_@antv_g-math@0.1.3@@antv/g-math/lib/util.js"); function copysign(v1, v2) { var absv = Math.abs(v1); return v2 > 0 ? absv : absv * -1; } exports.default = { /** * 包围盒计算 * @param {number} x 椭圆中心 x * @param {number} y 椭圆中心 y * @param {number} rx 椭圆 x 方向半径 * @param {number} ry 椭圆 y 方向半径 * @return {object} 包围盒 */ box: function (x, y, rx, ry) { return { x: x - rx, y: y - ry, width: rx * 2, height: ry * 2 }; }, /** * 计算周长,使用近似法 * @param {number} x 椭圆中心 x * @param {number} y 椭圆中心 y * @param {number} rx 椭圆 x 方向半径 * @param {number} ry 椭圆 y 方向半径 * @return {number} 椭圆周长 */ length: function (x, y, rx, ry) { return Math.PI * (3 * (rx + ry) - Math.sqrt((3 * rx + ry) * (rx + 3 * ry))); }, /** * 距离椭圆最近的点 * @param {number} x 椭圆中心 x * @param {number} y 椭圆中心 y * @param {number} rx 椭圆 x 方向半径 * @param {number} ry 椭圆 y 方向半径 * @param {number} x0 指定的点 x * @param {number} y0 指定的点 y * @return {object} 椭圆上距离指定点最近的点 */ nearestPoint: function (x, y, rx, ry, x0, y0) { var a = rx; var b = ry; // 假如椭圆半径为0则返回圆心 if (a === 0 || b === 0) { return { x: x, y: y }; } // 转换成 0, 0 为中心的椭圆计算 var relativeX = x0 - x; var relativeY = y0 - y; var px = Math.abs(relativeX); var py = Math.abs(relativeY); var squareA = a * a; var squareB = b * b; // const angle0 = Math.atan2(relativeY, relativeX); var t = Math.PI / 4; var nearestX; // 椭圆上的任一点 var nearestY; // 迭代 4 次 for (var i = 0; i < 4; i++) { nearestX = a * Math.cos(t); nearestY = b * Math.sin(t); var ex = (squareA - squareB) * Math.pow(Math.cos(t), 3) / a; var ey = (squareB - squareA) * Math.pow(Math.sin(t), 3) / b; var rx1 = nearestX - ex; var ry1 = nearestY - ey; var qx = px - ex; var qy = py - ey; var r = Math.hypot(ry1, rx1); var q = Math.hypot(qy, qx); var delta_c = r * Math.asin((rx1 * qy - ry1 * qx) / (r * q)); var delta_t = delta_c / Math.sqrt(squareA + squareB - nearestX * nearestX - nearestY * nearestY); t += delta_t; t = Math.min(Math.PI / 2, Math.max(0, t)); } return { x: x + copysign(nearestX, relativeX), y: y + copysign(nearestY, relativeY) }; }, /** * 点到椭圆最近的距离 * @param {number} x 椭圆中心 x * @param {number} y 椭圆中心 y * @param {number} rx 椭圆 x 方向半径 * @param {number} ry 椭圆 y 方向半径 * @param {number} x0 指定的点 x * @param {number} y0 指定的点 y * @return {number} 点到椭圆的距离 */ pointDistance: function (x, y, rx, ry, x0, y0) { var nearestPoint = this.nearestPoint(x, y, rx, ry, x0, y0); return util_1.distance(nearestPoint.x, nearestPoint.y, x0, y0); }, /** * 根据比例获取点 * @param {number} x 椭圆中心 x * @param {number} y 椭圆中心 y * @param {number} rx 椭圆 x 方向半径 * @param {number} ry 椭圆 y 方向半径 * @param {number} t 指定比例,x轴方向为 0 * @return {object} 点 */ pointAt: function (x, y, rx, ry, t) { var angle = 2 * Math.PI * t; // 按照角度进行计算,而不按照周长计算 return { x: x + rx * Math.cos(angle), y: y + ry * Math.sin(angle) }; }, /** * 根据比例计算切线角度 * @param {number} x 椭圆中心 x * @param {number} y 椭圆中心 y * @param {number} rx 椭圆 x 方向半径 * @param {number} ry 椭圆 y 方向半径 * @param {number} t 指定比例 0 - 1 之间,x轴方向为 0。在 0-1 范围之外是循环还是返回 null,还需要调整 * @return {number} 角度,在 0 - 2PI 之间 */ tangentAngle: function (x, y, rx, ry, t) { var angle = 2 * Math.PI * t; // 按照角度进行计算,而不按照周长计算 // 直接使用 x,y 的导数计算, x' = -rx * sin(t); y' = ry * cos(t); var tangentAngle = Math.atan2(ry * Math.cos(angle), -rx * Math.sin(angle)); // 也可以使用指定点的切线方程计算,成本有些高 // const point = this.pointAt(0, 0, rx, ry, t); // 椭圆的切线同椭圆的中心不相关 // let tangentAngle = -1 * Math.atan((ry * ry * point.x) / (rx * rx * point.y)); // if (angle >= 0 && angle <= Math.PI) { // tangentAngle += Math.PI; // } return util_1.piMod(tangentAngle); } }; /***/ }), /***/ "./node_modules/_@antv_g-math@0.1.3@@antv/g-math/lib/line.js": /*!*******************************************************************!*\ !*** ./node_modules/_@antv_g-math@0.1.3@@antv/g-math/lib/line.js ***! \*******************************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var util_1 = __webpack_require__(/*! ./util */ "./node_modules/_@antv_g-math@0.1.3@@antv/g-math/lib/util.js"); var vec2 = __webpack_require__(/*! gl-matrix/vec2 */ "./node_modules/_gl-matrix@3.3.0@gl-matrix/esm/vec2.js"); exports.default = { /** * 计算线段的包围盒 * @param {number} x1 起始点 x * @param {number} y1 起始点 y * @param {number} x2 结束点 x * @param {number} y2 结束点 y * @return {object} 包围盒对象 */ box: function (x1, y1, x2, y2) { return util_1.getBBoxByArray([x1, x2], [y1, y2]); }, /** * 线段的长度 * @param {number} x1 起始点 x * @param {number} y1 起始点 y * @param {number} x2 结束点 x * @param {number} y2 结束点 y * @return {number} 距离 */ length: function (x1, y1, x2, y2) { return util_1.distance(x1, y1, x2, y2); }, /** * 根据比例获取点 * @param {number} x1 起始点 x * @param {number} y1 起始点 y * @param {number} x2 结束点 x * @param {number} y2 结束点 y * @param {number} t 指定比例 * @return {object} 包含 x, y 的点 */ pointAt: function (x1, y1, x2, y2, t) { return { x: (1 - t) * x1 + t * x2, y: (1 - t) * y1 + t * y2 }; }, /** * 点到线段的距离 * @param {number} x1 起始点 x * @param {number} y1 起始点 y * @param {number} x2 结束点 x * @param {number} y2 结束点 y * @param {number} x 测试点 x * @param {number} y 测试点 y * @return {number} 距离 */ pointDistance: function (x1, y1, x2, y2, x, y) { // 投影距离 x1, y1 的向量,假设 p, p1, p2 三个点,投影点为 a // p1a = p1p.p1p2/|p1p2| * (p1p 的单位向量) var cross = (x2 - x1) * (x - x1) + (y2 - y1) * (y - y1); if (cross < 0) { return util_1.distance(x1, y1, x, y); } var lengthSquare = (x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1); if (cross > lengthSquare) { return util_1.distance(x2, y2, x, y); } return this.pointToLine(x1, y1, x2, y2, x, y); }, /** * 点到直线的距离,而不是点到线段的距离 * @param {number} x1 起始点 x * @param {number} y1 起始点 y * @param {number} x2 结束点 x * @param {number} y2 结束点 y * @param {number} x 测试点 x * @param {number} y 测试点 y * @return {number} 距离 */ pointToLine: function (x1, y1, x2, y2, x, y) { var d = [x2 - x1, y2 - y1]; // 如果端点相等,则判定点到点的距离 if (vec2.exactEquals(d, [0, 0])) { return Math.sqrt((x - x1) * (x - x1) + (y - y1) * (y - y1)); } var u = [-d[1], d[0]]; vec2.normalize(u, u); var a = [x - x1, y - y1]; return Math.abs(vec2.dot(a, u)); }, /** * 线段的角度 * @param {number} x1 起始点 x * @param {number} y1 起始点 y * @param {number} x2 结束点 x * @param {number} y2 结束点 y * @return {number} 导数 */ tangentAngle: function (x1, y1, x2, y2) { return Math.atan2(y2 - y1, x2 - x1); } }; /***/ }), /***/ "./node_modules/_@antv_g-math@0.1.3@@antv/g-math/lib/polyline.js": /*!***********************************************************************!*\ !*** ./node_modules/_@antv_g-math@0.1.3@@antv/g-math/lib/polyline.js ***! \***********************************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var segments_1 = __webpack_require__(/*! ./segments */ "./node_modules/_@antv_g-math@0.1.3@@antv/g-math/lib/segments.js"); var util_1 = __webpack_require__(/*! ./util */ "./node_modules/_@antv_g-math@0.1.3@@antv/g-math/lib/util.js"); exports.default = { /** * 计算多折线的包围盒 * @param {array} points 点的集合 [x,y] 的形式 * @return {object} 包围盒 */ box: function (points) { var xArr = []; var yArr = []; for (var i = 0; i < points.length; i++) { var point = points[i]; xArr.push(point[0]); yArr.push(point[1]); } return util_1.getBBoxByArray(xArr, yArr); }, /** * 计算多折线的长度 * @param {array} points 点的集合 [x,y] 的形式 * @return {object} 多条边的长度 */ length: function (points) { return segments_1.lengthOfSegment(points); }, /** * 根据比例获取多折线的点 * @param {array} points 点的集合 [x,y] 的形式 * @param {number} t 在多折线的长度上的比例 * @return {object} 根据比例值计算出来的点 */ pointAt: function (points, t) { return segments_1.pointAtSegments(points, t); }, /** * 指定点到多折线的距离 * @param {array} points 点的集合 [x,y] 的形式 * @param {number} x 指定点的 x * @param {number} y 指定点的 y * @return {number} 点到多折线的距离 */ pointDistance: function (points, x, y) { return segments_1.distanceAtSegment(points, x, y); }, /** * 根据比例获取多折线的切线角度 * @param {array} points 点的集合 [x,y] 的形式 * @param {number} t 在多折线的长度上的比例 * @return {object} 根据比例值计算出来的角度 */ tangentAngle: function (points, t) { return segments_1.angleAtSegments(points, t); } }; /***/ }), /***/ "./node_modules/_@antv_g-math@0.1.3@@antv/g-math/lib/quadratic.js": /*!************************************************************************!*\ !*** ./node_modules/_@antv_g-math@0.1.3@@antv/g-math/lib/quadratic.js ***! \************************************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var line_1 = __webpack_require__(/*! ./line */ "./node_modules/_@antv_g-math@0.1.3@@antv/g-math/lib/line.js"); var util_1 = __webpack_require__(/*! ./util */ "./node_modules/_@antv_g-math@0.1.3@@antv/g-math/lib/util.js"); var bezier_1 = __webpack_require__(/*! ./bezier */ "./node_modules/_@antv_g-math@0.1.3@@antv/g-math/lib/bezier.js"); // 差值公式 function quadraticAt(p0, p1, p2, t) { var onet = 1 - t; return onet * onet * p0 + 2 * t * onet * p1 + t * t * p2; } // 求极值 function extrema(p0, p1, p2) { var a = p0 + p2 - 2 * p1; if (util_1.isNumberEqual(a, 0)) { return [0.5]; } var rst = (p0 - p1) / a; if (rst <= 1 && rst >= 0) { return [rst]; } return []; } function derivativeAt(p0, p1, p2, t) { return 2 * (1 - t) * (p1 - p0) + 2 * t * (p2 - p1); } // 分割贝塞尔曲线 function divideQuadratic(x1, y1, x2, y2, x3, y3, t) { // 划分点 var xt = quadraticAt(x1, x2, x3, t); var yt = quadraticAt(y1, y2, y3, t); // 分割的第一条曲线的控制点 var controlPoint1 = line_1.default.pointAt(x1, y1, x2, y2, t); // 分割的第二条曲线的控制点 var controlPoint2 = line_1.default.pointAt(x2, y2, x3, y3, t); return [[x1, y1, controlPoint1.x, controlPoint1.y, xt, yt], [xt, yt, controlPoint2.x, controlPoint2.y, x3, y3]]; } // 使用迭代法取贝塞尔曲线的长度 function quadraticLength(x1, y1, x2, y2, x3, y3, iterationCount) { if (iterationCount === 0) { return (util_1.distance(x1, y1, x2, y2) + util_1.distance(x2, y2, x3, y3) + util_1.distance(x1, y1, x3, y3)) / 2; } var quadratics = divideQuadratic(x1, y1, x2, y2, x3, y3, 0.5); var left = quadratics[0]; var right = quadratics[1]; left.push(iterationCount - 1); right.push(iterationCount - 1); return quadraticLength.apply(null, left) + quadraticLength.apply(null, right); } exports.default = { box: function (x1, y1, x2, y2, x3, y3) { var xExtrema = extrema(x1, x2, x3)[0]; var yExtrema = extrema(y1, y2, y3)[0]; // 控制点不加入 box 的计算 var xArr = [x1, x3]; var yArr = [y1, y3]; if (xExtrema !== undefined) { xArr.push(quadraticAt(x1, x2, x3, xExtrema)); } if (yExtrema !== undefined) { yArr.push(quadraticAt(y1, y2, y3, yExtrema)); } return util_1.getBBoxByArray(xArr, yArr); }, length: function (x1, y1, x2, y2, x3, y3) { return quadraticLength(x1, y1, x2, y2, x3, y3, 3); }, nearestPoint: function (x1, y1, x2, y2, x3, y3, x0, y0) { return bezier_1.nearestPoint([x1, x2, x3], [y1, y2, y3], x0, y0, quadraticAt); }, pointDistance: function (x1, y1, x2, y2, x3, y3, x0, y0) { var point = this.nearestPoint(x1, y1, x2, y2, x3, y3, x0, y0); return util_1.distance(point.x, point.y, x0, y0); }, interpolationAt: quadraticAt, pointAt: function (x1, y1, x2, y2, x3, y3, t) { return { x: quadraticAt(x1, x2, x3, t), y: quadraticAt(y1, y2, y3, t) }; }, divide: function (x1, y1, x2, y2, x3, y3, t) { return divideQuadratic(x1, y1, x2, y2, x3, y3, t); }, tangentAngle: function (x1, y1, x2, y2, x3, y3, t) { var dx = derivativeAt(x1, x2, x3, t); var dy = derivativeAt(y1, y2, y3, t); var angle = Math.atan2(dy, dx); return util_1.piMod(angle); } }; /***/ }), /***/ "./node_modules/_@antv_g-math@0.1.3@@antv/g-math/lib/segments.js": /*!***********************************************************************!*\ !*** ./node_modules/_@antv_g-math@0.1.3@@antv/g-math/lib/segments.js ***! \***********************************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var line_1 = __webpack_require__(/*! ./line */ "./node_modules/_@antv_g-math@0.1.3@@antv/g-math/lib/line.js"); var util_1 = __webpack_require__(/*! ./util */ "./node_modules/_@antv_g-math@0.1.3@@antv/g-math/lib/util.js"); function analyzePoints(points) { // 计算每段的长度和总的长度 var totalLength = 0; var segments = []; for (var i = 0; i < points.length - 1; i++) { var from = points[i]; var to = points[i + 1]; var length_1 = util_1.distance(from[0], from[1], to[0], to[1]); var seg = { from: from, to: to, length: length_1 }; segments.push(seg); totalLength += length_1; } return { segments: segments, totalLength: totalLength }; } function lengthOfSegment(points) { if (points.length < 2) { return 0; } var totalLength = 0; for (var i = 0; i < points.length - 1; i++) { var from = points[i]; var to = points[i + 1]; totalLength += util_1.distance(from[0], from[1], to[0], to[1]); } return totalLength; } exports.lengthOfSegment = lengthOfSegment; /** * 按照比例在数据片段中获取点 * @param {array} points 点的集合 * @param {number} t 百分比 0-1 * @return {object} 点的坐标 */ function pointAtSegments(points, t) { // 边界判断 if (t > 1 || t < 0 || points.length < 2) { return null; } var _a = analyzePoints(points), segments = _a.segments, totalLength = _a.totalLength; // 多个点有可能重合 if (totalLength === 0) { return { x: points[0][0], y: points[0][1] }; } // 计算比例 var startRatio = 0; var point = null; for (var i = 0; i < segments.length; i++) { var seg = segments[i]; var from = seg.from, to = seg.to; var currentRatio = seg.length / totalLength; if (t >= startRatio && t <= startRatio + currentRatio) { var localRatio = (t - startRatio) / currentRatio; point = line_1.default.pointAt(from[0], from[1], to[0], to[1], localRatio); break; } startRatio += currentRatio; } return point; } exports.pointAtSegments = pointAtSegments; /** * 按照比例在数据片段中获取切线的角度 * @param {array} points 点的集合 * @param {number} t 百分比 0-1 */ function angleAtSegments(points, t) { // 边界判断 if (t > 1 || t < 0 || points.length < 2) { return 0; } var _a = analyzePoints(points), segments = _a.segments, totalLength = _a.totalLength; // 计算比例 var startRatio = 0; var angle = 0; for (var i = 0; i < segments.length; i++) { var seg = segments[i]; var from = seg.from, to = seg.to; var currentRatio = seg.length / totalLength; if (t >= startRatio && t <= startRatio + currentRatio) { angle = Math.atan2(to[1] - from[1], to[0] - from[0]); break; } startRatio += currentRatio; } return angle; } exports.angleAtSegments = angleAtSegments; function distanceAtSegment(points, x, y) { var minDistance = Infinity; for (var i = 0; i < points.length - 1; i++) { var point = points[i]; var nextPoint = points[i + 1]; var distance_1 = line_1.default.pointDistance(point[0], point[1], nextPoint[0], nextPoint[1], x, y); if (distance_1 < minDistance) { minDistance = distance_1; } } return minDistance; } exports.distanceAtSegment = distanceAtSegment; /***/ }), /***/ "./node_modules/_@antv_g-math@0.1.3@@antv/g-math/lib/util.js": /*!*******************************************************************!*\ !*** ./node_modules/_@antv_g-math@0.1.3@@antv/g-math/lib/util.js ***! \*******************************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); function minNum(array) { return Math.min.apply(null, array); } function maxNum(array) { return Math.max.apply(null, array); } /** * 两点之间的距离 * @param {number} x1 起始点 x * @param {number} y1 起始点 y * @param {number} x2 结束点 x * @param {number} y2 结束点 y * @return {number} 距离 */ function distance(x1, y1, x2, y2) { var dx = x1 - x2; var dy = y1 - y2; return Math.sqrt(dx * dx + dy * dy); } exports.distance = distance; function isNumberEqual(v1, v2) { return Math.abs(v1 - v2) < 0.001; } exports.isNumberEqual = isNumberEqual; function getBBoxByArray(xArr, yArr) { var minX = minNum(xArr); var minY = minNum(yArr); var maxX = maxNum(xArr); var maxY = maxNum(yArr); return { x: minX, y: minY, width: maxX - minX, height: maxY - minY }; } exports.getBBoxByArray = getBBoxByArray; function getBBoxRange(x1, y1, x2, y2) { return { minX: minNum([x1, x2]), maxX: maxNum([x1, x2]), minY: minNum([y1, y2]), maxY: maxNum([y1, y2]) }; } exports.getBBoxRange = getBBoxRange; function piMod(angle) { return (angle + Math.PI * 2) % (Math.PI * 2); } exports.piMod = piMod; /***/ }), /***/ "./node_modules/_@antv_matrix-util@3.0.3@@antv/matrix-util/lib/mat3.js": /*!*****************************************************************************!*\ !*** ./node_modules/_@antv_matrix-util@3.0.3@@antv/matrix-util/lib/mat3.js ***! \*****************************************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var tslib_1 = __webpack_require__(/*! tslib */ "./node_modules/_tslib@1.13.0@tslib/tslib.es6.js"); tslib_1.__exportStar(__webpack_require__(/*! gl-matrix/mat3 */ "./node_modules/_gl-matrix@3.3.0@gl-matrix/esm/mat3.js"), exports); var mat3_1 = __webpack_require__(/*! gl-matrix/mat3 */ "./node_modules/_gl-matrix@3.3.0@gl-matrix/esm/mat3.js"); function leftTranslate(out, a, v) { var transMat = new Array(9); mat3_1.fromTranslation(transMat, v); return mat3_1.multiply(out, transMat, a); } function leftRotate(out, a, rad) { var rotateMat = new Array(9); mat3_1.fromRotation(rotateMat, rad); return mat3_1.multiply(out, rotateMat, a); } function leftScale(out, a, v) { var scaleMat = new Array(9); mat3_1.fromScaling(scaleMat, v); return mat3_1.multiply(out, scaleMat, a); } function leftMultiply(out, a, a1) { return mat3_1.multiply(out, a1, a); } /** * 根据 actions 来做 transform * @param m * @param actions */ function transform(m, actions) { var matrix = m ? [].concat(m) : [1, 0, 0, 0, 1, 0, 0, 0, 1]; for (var i = 0, len = actions.length; i < len; i++) { var action = actions[i]; switch (action[0]) { case 't': leftTranslate(matrix, matrix, [action[1], action[2]]); break; case 's': leftScale(matrix, matrix, [action[1], action[2]]); break; case 'r': leftRotate(matrix, matrix, action[1]); break; case 'm': leftMultiply(matrix, matrix, action[1]); break; default: break; } } return matrix; } exports.transform = transform; /***/ }), /***/ "./node_modules/_@antv_matrix-util@3.1.0-beta.2@@antv/matrix-util/esm/ext.js": /*!***********************************************************************************!*\ !*** ./node_modules/_@antv_matrix-util@3.1.0-beta.2@@antv/matrix-util/esm/ext.js ***! \***********************************************************************************/ /*! exports provided: leftTranslate, leftRotate, leftScale, transform, direction, angleTo, vertical */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "leftTranslate", function() { return leftTranslate; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "leftRotate", function() { return leftRotate; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "leftScale", function() { return leftScale; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "transform", function() { return transform; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "direction", function() { return direction; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "angleTo", function() { return angleTo; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "vertical", function() { return vertical; }); /* harmony import */ var gl_matrix__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! gl-matrix */ "./node_modules/_gl-matrix@3.3.0@gl-matrix/esm/index.js"); /** * @description 扩展方法,提供 gl-matrix 为提供的方法 * */ function leftTranslate(out, a, v) { var transMat = [0, 0, 0, 0, 0, 0, 0, 0, 0]; gl_matrix__WEBPACK_IMPORTED_MODULE_0__["mat3"].fromTranslation(transMat, v); return gl_matrix__WEBPACK_IMPORTED_MODULE_0__["mat3"].multiply(out, transMat, a); } function leftRotate(out, a, rad) { var rotateMat = [0, 0, 0, 0, 0, 0, 0, 0, 0]; gl_matrix__WEBPACK_IMPORTED_MODULE_0__["mat3"].fromRotation(rotateMat, rad); return gl_matrix__WEBPACK_IMPORTED_MODULE_0__["mat3"].multiply(out, rotateMat, a); } function leftScale(out, a, v) { var scaleMat = [0, 0, 0, 0, 0, 0, 0, 0, 0]; gl_matrix__WEBPACK_IMPORTED_MODULE_0__["mat3"].fromScaling(scaleMat, v); return gl_matrix__WEBPACK_IMPORTED_MODULE_0__["mat3"].multiply(out, scaleMat, a); } function leftMultiply(out, a, a1) { return gl_matrix__WEBPACK_IMPORTED_MODULE_0__["mat3"].multiply(out, a1, a); } /** * 根据 actions 来做 transform * @param m * @param actions */ function transform(m, actions) { var matrix = m ? [].concat(m) : [1, 0, 0, 0, 1, 0, 0, 0, 1]; for (var i = 0, len = actions.length; i < len; i++) { var action = actions[i]; switch (action[0]) { case 't': leftTranslate(matrix, matrix, [action[1], action[2]]); break; case 's': leftScale(matrix, matrix, [action[1], action[2]]); break; case 'r': leftRotate(matrix, matrix, action[1]); break; case 'm': leftMultiply(matrix, matrix, action[1]); break; default: break; } } return matrix; } /** * 向量 v1 到 向量 v2 夹角的方向 * @param {Array} v1 向量 * @param {Array} v2 向量 * @return {Boolean} >= 0 顺时针 < 0 逆时针 */ function direction(v1, v2) { return v1[0] * v2[1] - v2[0] * v1[1]; } /** * 二维向量 v1 到 v2 的夹角 * @param v1 * @param v2 * @param direct */ function angleTo(v1, v2, direct) { var ang = gl_matrix__WEBPACK_IMPORTED_MODULE_0__["vec2"].angle(v1, v2); var angleLargeThanPI = direction(v1, v2) >= 0; if (direct) { if (angleLargeThanPI) { return Math.PI * 2 - ang; } return ang; } if (angleLargeThanPI) { return ang; } return Math.PI * 2 - ang; } /** * 计算二维向量的垂直向量 * @param out * @param v * @param flag */ function vertical(out, v, flag) { if (flag) { out[0] = v[1]; out[1] = -1 * v[0]; } else { out[0] = -1 * v[1]; out[1] = v[0]; } return out; } /***/ }), /***/ "./node_modules/_@antv_matrix-util@3.1.0-beta.2@@antv/matrix-util/esm/index.js": /*!*************************************************************************************!*\ !*** ./node_modules/_@antv_matrix-util@3.1.0-beta.2@@antv/matrix-util/esm/index.js ***! \*************************************************************************************/ /*! exports provided: mat3, vec2, vec3, ext */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony import */ var gl_matrix__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! gl-matrix */ "./node_modules/_gl-matrix@3.3.0@gl-matrix/esm/index.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "mat3", function() { return gl_matrix__WEBPACK_IMPORTED_MODULE_0__["mat3"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "vec2", function() { return gl_matrix__WEBPACK_IMPORTED_MODULE_0__["vec2"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "vec3", function() { return gl_matrix__WEBPACK_IMPORTED_MODULE_0__["vec3"]; }); /* harmony import */ var _ext__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./ext */ "./node_modules/_@antv_matrix-util@3.1.0-beta.2@@antv/matrix-util/esm/ext.js"); /* harmony reexport (module object) */ __webpack_require__.d(__webpack_exports__, "ext", function() { return _ext__WEBPACK_IMPORTED_MODULE_1__; }); /***/ }), /***/ "./node_modules/_@antv_path-util@2.0.8@@antv/path-util/lib/get-arc-params.js": /*!***********************************************************************************!*\ !*** ./node_modules/_@antv_path-util@2.0.8@@antv/path-util/lib/get-arc-params.js ***! \***********************************************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var mod_1 = __webpack_require__(/*! @antv/util/lib/mod */ "./node_modules/_@antv_util@2.0.9@@antv/util/lib/mod.js"); var to_radian_1 = __webpack_require__(/*! @antv/util/lib/to-radian */ "./node_modules/_@antv_util@2.0.9@@antv/util/lib/to-radian.js"); // 向量长度 function vMag(v) { return Math.sqrt(v[0] * v[0] + v[1] * v[1]); } // u.v/|u||v|,计算夹角的余弦值 function vRatio(u, v) { // 当存在一个向量的长度为 0 时,夹角也为 0,即夹角的余弦值为 1 return vMag(u) * vMag(v) ? (u[0] * v[0] + u[1] * v[1]) / (vMag(u) * vMag(v)) : 1; } // 向量角度 function vAngle(u, v) { return (u[0] * v[1] < u[1] * v[0] ? -1 : 1) * Math.acos(vRatio(u, v)); } /** * 判断两个点是否重合,点坐标的格式为 [x, y] * @param {Array} point1 第一个点 * @param {Array} point2 第二个点 */ function isSamePoint(point1, point2) { return point1[0] === point2[0] && point1[1] === point2[1]; } exports.isSamePoint = isSamePoint; // A 0:rx 1:ry 2:x-axis-rotation 3:large-arc-flag 4:sweep-flag 5: x 6: y function getArcParams(startPoint, params) { var rx = params[1]; var ry = params[2]; var xRotation = mod_1.default(to_radian_1.default(params[3]), Math.PI * 2); var arcFlag = params[4]; var sweepFlag = params[5]; // 弧形起点坐标 var x1 = startPoint[0]; var y1 = startPoint[1]; // 弧形终点坐标 var x2 = params[6]; var y2 = params[7]; var xp = Math.cos(xRotation) * (x1 - x2) / 2.0 + Math.sin(xRotation) * (y1 - y2) / 2.0; var yp = -1 * Math.sin(xRotation) * (x1 - x2) / 2.0 + Math.cos(xRotation) * (y1 - y2) / 2.0; var lambda = xp * xp / (rx * rx) + yp * yp / (ry * ry); if (lambda > 1) { rx *= Math.sqrt(lambda); ry *= Math.sqrt(lambda); } var diff = rx * rx * (yp * yp) + ry * ry * (xp * xp); var f = diff ? Math.sqrt((rx * rx * (ry * ry) - diff) / diff) : 1; if (arcFlag === sweepFlag) { f *= -1; } if (isNaN(f)) { f = 0; } // 旋转前的起点坐标,且当长半轴和短半轴的长度为 0 时,坐标按 (0, 0) 处理 var cxp = ry ? f * rx * yp / ry : 0; var cyp = rx ? f * -ry * xp / rx : 0; // 椭圆圆心坐标 var cx = (x1 + x2) / 2.0 + Math.cos(xRotation) * cxp - Math.sin(xRotation) * cyp; var cy = (y1 + y2) / 2.0 + Math.sin(xRotation) * cxp + Math.cos(xRotation) * cyp; // 起始点的单位向量 var u = [(xp - cxp) / rx, (yp - cyp) / ry]; // 终止点的单位向量 var v = [(-1 * xp - cxp) / rx, (-1 * yp - cyp) / ry]; // 计算起始点和圆心的连线,与 x 轴正方向的夹角 var theta = vAngle([1, 0], u); // 计算圆弧起始点和终止点与椭圆圆心连线的夹角 var dTheta = vAngle(u, v); if (vRatio(u, v) <= -1) { dTheta = Math.PI; } if (vRatio(u, v) >= 1) { dTheta = 0; } if (sweepFlag === 0 && dTheta > 0) { dTheta = dTheta - 2 * Math.PI; } if (sweepFlag === 1 && dTheta < 0) { dTheta = dTheta + 2 * Math.PI; } return { cx: cx, cy: cy, // 弧形的起点和终点相同时,长轴和短轴的长度按 0 处理 rx: isSamePoint(startPoint, [x2, y2]) ? 0 : rx, ry: isSamePoint(startPoint, [x2, y2]) ? 0 : ry, startAngle: theta, endAngle: theta + dTheta, xRotation: xRotation, arcFlag: arcFlag, sweepFlag: sweepFlag }; } exports.default = getArcParams; /***/ }), /***/ "./node_modules/_@antv_path-util@2.0.8@@antv/path-util/lib/parse-path-string.js": /*!**************************************************************************************!*\ !*** ./node_modules/_@antv_path-util@2.0.8@@antv/path-util/lib/parse-path-string.js ***! \**************************************************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var is_array_1 = __webpack_require__(/*! @antv/util/lib/is-array */ "./node_modules/_@antv_util@2.0.9@@antv/util/lib/is-array.js"); var SPACES = '\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029'; var PATH_COMMAND = new RegExp('([a-z])[' + SPACES + ',]*((-?\\d*\\.?\\d*(?:e[\\-+]?\\d+)?[' + SPACES + ']*,?[' + SPACES + ']*)+)', 'ig'); var PATH_VALUES = new RegExp('(-?\\d*\\.?\\d*(?:e[\\-+]?\\d+)?)[' + SPACES + ']*,?[' + SPACES + ']*', 'ig'); // Parses given path string into an array of arrays of path segments function parsePathString(pathString) { if (!pathString) { return null; } if (is_array_1.default(pathString)) { return pathString; } var paramCounts = { a: 7, c: 6, o: 2, h: 1, l: 2, m: 2, r: 4, q: 4, s: 4, t: 2, v: 1, u: 3, z: 0 }; var data = []; String(pathString).replace(PATH_COMMAND, function (a, b, c) { var params = []; var name = b.toLowerCase(); c.replace(PATH_VALUES, function (a, b) { b && params.push(+b); }); if (name === 'm' && params.length > 2) { data.push([b].concat(params.splice(0, 2))); name = 'l'; b = b === 'm' ? 'l' : 'L'; } if (name === 'o' && params.length === 1) { data.push([b, params[0]]); } if (name === 'r') { data.push([b].concat(params)); } else { while (params.length >= paramCounts[name]) { data.push([b].concat(params.splice(0, paramCounts[name]))); if (!paramCounts[name]) { break; } } } return ''; }); return data; } exports.default = parsePathString; /***/ }), /***/ "./node_modules/_@antv_path-util@2.0.8@@antv/path-util/lib/parse-path.js": /*!*******************************************************************************!*\ !*** ./node_modules/_@antv_path-util@2.0.8@@antv/path-util/lib/parse-path.js ***! \*******************************************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var each_1 = __webpack_require__(/*! @antv/util/lib/each */ "./node_modules/_@antv_util@2.0.9@@antv/util/lib/each.js"); var is_array_1 = __webpack_require__(/*! @antv/util/lib/is-array */ "./node_modules/_@antv_util@2.0.9@@antv/util/lib/is-array.js"); var is_string_1 = __webpack_require__(/*! @antv/util/lib/is-string */ "./node_modules/_@antv_util@2.0.9@@antv/util/lib/is-string.js"); var regexTags = /[MLHVQTCSAZ]([^MLHVQTCSAZ]*)/ig; var regexDot = /[^\s\,]+/ig; function parsePath(p) { var path = p || []; if (is_array_1.default(path)) { return path; } if (is_string_1.default(path)) { path = path.match(regexTags); each_1.default(path, function (item, index) { // @ts-ignore item = item.match(regexDot); if (item[0].length > 1) { var tag = item[0].charAt(0); // @ts-ignore item.splice(1, 0, item[0].substr(1)); // @ts-ignore item[0] = tag; } // @ts-ignore each_1.default(item, function (sub, i) { if (!isNaN(sub)) { // @ts-ignore item[i] = +sub; } }); // @ts-ignore path[index] = item; }); return path; } } exports.default = parsePath; /***/ }), /***/ "./node_modules/_@antv_path-util@2.0.8@@antv/path-util/lib/path-2-absolute.js": /*!************************************************************************************!*\ !*** ./node_modules/_@antv_path-util@2.0.8@@antv/path-util/lib/path-2-absolute.js ***! \************************************************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var parse_path_string_1 = __webpack_require__(/*! ./parse-path-string */ "./node_modules/_@antv_path-util@2.0.8@@antv/path-util/lib/parse-path-string.js"); var REGEX_MD = /[a-z]/; function toSymmetry(p, c) { return [c[0] + (c[0] - p[0]), c[1] + (c[1] - p[1])]; } function pathToAbsolute(pathString) { var pathArray = parse_path_string_1.default(pathString); if (!pathArray || !pathArray.length) { return [['M', 0, 0]]; } var needProcess = false; // 如果存在小写的命令或者 V,H,T,S 则需要处理 for (var i = 0; i < pathArray.length; i++) { var cmd = pathArray[i][0]; // 如果存在相对位置的命令,则中断返回 if (REGEX_MD.test(cmd) || ['V', 'H', 'T', 'S'].indexOf(cmd) >= 0) { needProcess = true; break; } } // 如果不存在相对命令,则直接返回 // 如果在业务上都写绝对路径,这种方式最快,仅做了一次检测 if (!needProcess) { return pathArray; } var res = []; var x = 0; var y = 0; var mx = 0; var my = 0; var start = 0; var pa0; var dots; var first = pathArray[0]; if (first[0] === 'M' || first[0] === 'm') { x = +first[1]; y = +first[2]; mx = x; my = y; start++; res[0] = ['M', x, y]; } for (var i = start, ii = pathArray.length; i < ii; i++) { var pa = pathArray[i]; var preParams = res[i - 1]; // 取前一个已经处理后的节点,否则会出现问题 var r = []; var cmd = pa[0]; var upCmd = cmd.toUpperCase(); if (cmd !== upCmd) { r[0] = upCmd; switch (upCmd) { case 'A': r[1] = pa[1]; r[2] = pa[2]; r[3] = pa[3]; r[4] = pa[4]; r[5] = pa[5]; r[6] = +pa[6] + x; r[7] = +pa[7] + y; break; case 'V': r[1] = +pa[1] + y; break; case 'H': r[1] = +pa[1] + x; break; case 'M': mx = +pa[1] + x; my = +pa[2] + y; break; // for lint default: for (var j = 1, jj = pa.length; j < jj; j++) { r[j] = +pa[j] + (j % 2 ? x : y); } } } else { // 如果本来已经大写,则不处理 r = pathArray[i]; } // 需要在外面统一做,同时处理 V,H,S,T 等特殊指令 switch (upCmd) { case 'Z': x = +mx; y = +my; break; case 'H': x = r[1]; r = ['L', x, y]; break; case 'V': y = r[1]; r = ['L', x, y]; break; case 'T': x = r[1]; y = r[2]; // 以 x, y 为中心的,上一个控制点的对称点 // 需要假设上一个节点的命令为 Q var symetricT = toSymmetry([preParams[1], preParams[2]], [preParams[3], preParams[4]]); r = ['Q', symetricT[0], symetricT[1], x, y]; break; case 'S': x = r[r.length - 2]; y = r[r.length - 1]; // 以 x,y 为中心,取上一个控制点, // 需要假设上一个线段为 C 或者 S var length_1 = preParams.length; var symetricS = toSymmetry([preParams[length_1 - 4], preParams[length_1 - 3]], [preParams[length_1 - 2], preParams[length_1 - 1]]); r = ['C', symetricS[0], symetricS[1], r[1], r[2], x, y]; break; case 'M': mx = r[r.length - 2]; my = r[r.length - 1]; break; // for lint default: x = r[r.length - 2]; y = r[r.length - 1]; } res.push(r); } return res; } exports.default = pathToAbsolute; /***/ }), /***/ "./node_modules/_@antv_path-util@2.0.8@@antv/path-util/lib/path-2-segments.js": /*!************************************************************************************!*\ !*** ./node_modules/_@antv_path-util@2.0.8@@antv/path-util/lib/path-2-segments.js ***! \************************************************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var get_arc_params_1 = __webpack_require__(/*! ./get-arc-params */ "./node_modules/_@antv_path-util@2.0.8@@antv/path-util/lib/get-arc-params.js"); var get_arc_params_2 = __webpack_require__(/*! ./get-arc-params */ "./node_modules/_@antv_path-util@2.0.8@@antv/path-util/lib/get-arc-params.js"); var parse_path_1 = __webpack_require__(/*! ./parse-path */ "./node_modules/_@antv_path-util@2.0.8@@antv/path-util/lib/parse-path.js"); // 点对称 function toSymmetry(point, center) { return [center[0] + (center[0] - point[0]), center[1] + (center[1] - point[1])]; } function getSegments(path) { path = parse_path_1.default(path); var segments = []; var currentPoint = null; // 当前图形 var nextParams = null; // 下一节点的 path 参数 var startMovePoint = null; // 开始 M 的点,可能会有多个 var lastStartMovePointIndex = 0; // 最近一个开始点 M 的索引 var count = path.length; for (var i = 0; i < count; i++) { var params = path[i]; nextParams = path[i + 1]; var command = params[0]; // 数学定义上的参数,便于后面的计算 var segment = { command: command, prePoint: currentPoint, params: params, startTangent: null, endTangent: null }; switch (command) { case 'M': startMovePoint = [params[1], params[2]]; lastStartMovePointIndex = i; break; case 'A': var arcParams = get_arc_params_1.default(currentPoint, params); segment['arcParams'] = arcParams; break; default: break; } if (command === 'Z') { // 有了 Z 后,当前节点从开始 M 的点开始 currentPoint = startMovePoint; // 如果当前点的命令为 Z,相当于当前点为最近一个 M 点,则下一个点直接指向最近一个 M 点的下一个点 nextParams = path[lastStartMovePointIndex + 1]; } else { var len = params.length; currentPoint = [params[len - 2], params[len - 1]]; } if (nextParams && nextParams[0] === 'Z') { // 如果下一个点的命令为 Z,则下一个点直接指向最近一个 M 点 nextParams = path[lastStartMovePointIndex]; if (segments[lastStartMovePointIndex]) { // 如果下一个点的命令为 Z,则最近一个 M 点的前一个点为当前点 segments[lastStartMovePointIndex].prePoint = currentPoint; } } segment['currentPoint'] = currentPoint; // 如果当前点与最近一个 M 点相同,则最近一个 M 点的前一个点为当前点的前一个点 if (segments[lastStartMovePointIndex] && get_arc_params_2.isSamePoint(currentPoint, segments[lastStartMovePointIndex].currentPoint)) { segments[lastStartMovePointIndex].prePoint = segment.prePoint; } var nextPoint = nextParams ? [nextParams[nextParams.length - 2], nextParams[nextParams.length - 1]] : null; segment['nextPoint'] = nextPoint; // Add startTangent and endTangent var prePoint = segment.prePoint; if (['L', 'H', 'V'].includes(command)) { segment.startTangent = [prePoint[0] - currentPoint[0], prePoint[1] - currentPoint[1]]; segment.endTangent = [currentPoint[0] - prePoint[0], currentPoint[1] - prePoint[1]]; } else if (command === 'Q') { // 二次贝塞尔曲线只有一个控制点 var cp = [params[1], params[2]]; // 二次贝塞尔曲线的终点为 currentPoint segment.startTangent = [prePoint[0] - cp[0], prePoint[1] - cp[1]]; segment.endTangent = [currentPoint[0] - cp[0], currentPoint[1] - cp[1]]; } else if (command === 'T') { var preSegment = segments[i - 1]; var cp = toSymmetry(preSegment.currentPoint, prePoint); if (preSegment.command === 'Q') { segment.command = 'Q'; segment.startTangent = [prePoint[0] - cp[0], prePoint[1] - cp[1]]; segment.endTangent = [currentPoint[0] - cp[0], currentPoint[1] - cp[1]]; } else { segment.command = 'TL'; segment.startTangent = [prePoint[0] - currentPoint[0], prePoint[1] - currentPoint[1]]; segment.endTangent = [currentPoint[0] - prePoint[0], currentPoint[1] - prePoint[1]]; } } else if (command === 'C') { // 三次贝塞尔曲线有两个控制点 var cp1 = [params[1], params[2]]; var cp2 = [params[3], params[4]]; segment.startTangent = [prePoint[0] - cp1[0], prePoint[1] - cp1[1]]; segment.endTangent = [currentPoint[0] - cp2[0], currentPoint[1] - cp2[1]]; } else if (command === 'S') { var preSegment = segments[i - 1]; var cp1 = toSymmetry(preSegment.currentPoint, prePoint); var cp2 = [params[1], params[2]]; if (preSegment.command === 'C') { segment.command = 'C'; // 将 S 命令变换为 C 命令 segment.startTangent = [prePoint[0] - cp1[0], prePoint[1] - cp1[1]]; segment.endTangent = [currentPoint[0] - cp2[0], currentPoint[1] - cp2[1]]; } else { segment.command = 'SQ'; // 将 S 命令变换为 SQ 命令 segment.startTangent = [prePoint[0] - cp2[0], prePoint[1] - cp2[1]]; segment.endTangent = [currentPoint[0] - cp2[0], currentPoint[1] - cp2[1]]; } } else if (command === 'A') { var d = 0.001; var _a = segment['arcParams'] || {}, _b = _a.cx, cx = _b === void 0 ? 0 : _b, _c = _a.cy, cy = _c === void 0 ? 0 : _c, _d = _a.rx, rx = _d === void 0 ? 0 : _d, _e = _a.ry, ry = _e === void 0 ? 0 : _e, _f = _a.sweepFlag, sweepFlag = _f === void 0 ? 0 : _f, _g = _a.startAngle, startAngle = _g === void 0 ? 0 : _g, _h = _a.endAngle, endAngle = _h === void 0 ? 0 : _h; if (sweepFlag === 0) { d *= -1; } var dx1 = rx * Math.cos(startAngle - d) + cx; var dy1 = ry * Math.sin(startAngle - d) + cy; segment.startTangent = [dx1 - startMovePoint[0], dy1 - startMovePoint[1]]; var dx2 = rx * Math.cos(startAngle + endAngle + d) + cx; var dy2 = ry * Math.sin(startAngle + endAngle - d) + cy; segment.endTangent = [prePoint[0] - dx2, prePoint[1] - dy2]; } segments.push(segment); } return segments; } exports.default = getSegments; /***/ }), /***/ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/augment.js": /*!******************************************************************!*\ !*** ./node_modules/_@antv_util@2.0.9@@antv/util/esm/augment.js ***! \******************************************************************/ /*! exports provided: default */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony import */ var _mix__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./mix */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/mix.js"); /* harmony import */ var _is_function__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./is-function */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/is-function.js"); var augment = function () { var args = []; for (var _i = 0; _i < arguments.length; _i++) { args[_i] = arguments[_i]; } var c = args[0]; for (var i = 1; i < args.length; i++) { var obj = args[i]; if (Object(_is_function__WEBPACK_IMPORTED_MODULE_1__["default"])(obj)) { obj = obj.prototype; } Object(_mix__WEBPACK_IMPORTED_MODULE_0__["default"])(c.prototype, obj); } }; /* harmony default export */ __webpack_exports__["default"] = (augment); /***/ }), /***/ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/cache.js": /*!****************************************************************!*\ !*** ./node_modules/_@antv_util@2.0.9@@antv/util/esm/cache.js ***! \****************************************************************/ /*! exports provided: default */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /** * k-v 存储 */ var default_1 = /** @class */ function () { function default_1() { this.map = {}; } default_1.prototype.has = function (key) { return this.map[key] !== undefined; }; default_1.prototype.get = function (key, def) { var v = this.map[key]; return v === undefined ? def : v; }; default_1.prototype.set = function (key, value) { this.map[key] = value; }; default_1.prototype.clear = function () { this.map = {}; }; default_1.prototype.delete = function (key) { delete this.map[key]; }; default_1.prototype.size = function () { return Object.keys(this.map).length; }; return default_1; }(); /* harmony default export */ __webpack_exports__["default"] = (default_1); /***/ }), /***/ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/clamp.js": /*!****************************************************************!*\ !*** ./node_modules/_@antv_util@2.0.9@@antv/util/esm/clamp.js ***! \****************************************************************/ /*! exports provided: default */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); var clamp = function (a, min, max) { if (a < min) { return min; } else if (a > max) { return max; } return a; }; /* harmony default export */ __webpack_exports__["default"] = (clamp); /***/ }), /***/ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/clear-animation-frame.js": /*!********************************************************************************!*\ !*** ./node_modules/_@antv_util@2.0.9@@antv/util/esm/clear-animation-frame.js ***! \********************************************************************************/ /*! exports provided: default */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return cancelAnimationFrame; }); function cancelAnimationFrame(handler) { var method = window.cancelAnimationFrame || window.webkitCancelAnimationFrame || // @ts-ignore window.mozCancelAnimationFrame || // @ts-ignore window.msCancelAnimationFrame || clearTimeout; method(handler); } ; /***/ }), /***/ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/clone.js": /*!****************************************************************!*\ !*** ./node_modules/_@antv_util@2.0.9@@antv/util/esm/clone.js ***! \****************************************************************/ /*! exports provided: default */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony import */ var _is_array__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./is-array */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/is-array.js"); var clone = function (obj) { if (typeof obj !== 'object' || obj === null) { return obj; } var rst; if (Object(_is_array__WEBPACK_IMPORTED_MODULE_0__["default"])(obj)) { rst = []; for (var i = 0, l = obj.length; i < l; i++) { if (typeof obj[i] === 'object' && obj[i] != null) { rst[i] = clone(obj[i]); } else { rst[i] = obj[i]; } } } else { rst = {}; for (var k in obj) { if (typeof obj[k] === 'object' && obj[k] != null) { rst[k] = clone(obj[k]); } else { rst[k] = obj[k]; } } } return rst; }; /* harmony default export */ __webpack_exports__["default"] = (clone); /***/ }), /***/ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/contains.js": /*!*******************************************************************!*\ !*** ./node_modules/_@antv_util@2.0.9@@antv/util/esm/contains.js ***! \*******************************************************************/ /*! exports provided: default */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony import */ var _is_array_like__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./is-array-like */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/is-array-like.js"); var contains = function (arr, value) { if (!Object(_is_array_like__WEBPACK_IMPORTED_MODULE_0__["default"])(arr)) { return false; } return arr.indexOf(value) > -1; }; /* harmony default export */ __webpack_exports__["default"] = (contains); /***/ }), /***/ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/debounce.js": /*!*******************************************************************!*\ !*** ./node_modules/_@antv_util@2.0.9@@antv/util/esm/debounce.js ***! \*******************************************************************/ /*! exports provided: default */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); function debounce(func, wait, immediate) { var timeout; return function () { var context = this, args = arguments; var later = function () { timeout = null; if (!immediate) { func.apply(context, args); } }; var callNow = immediate && !timeout; clearTimeout(timeout); timeout = setTimeout(later, wait); if (callNow) { func.apply(context, args); } }; } /* harmony default export */ __webpack_exports__["default"] = (debounce); /***/ }), /***/ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/deep-mix.js": /*!*******************************************************************!*\ !*** ./node_modules/_@antv_util@2.0.9@@antv/util/esm/deep-mix.js ***! \*******************************************************************/ /*! exports provided: default */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony import */ var _is_array__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./is-array */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/is-array.js"); /* harmony import */ var _is_plain_object__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./is-plain-object */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/is-plain-object.js"); var MAX_MIX_LEVEL = 5; function _deepMix(dist, src, level, maxLevel) { level = level || 0; maxLevel = maxLevel || MAX_MIX_LEVEL; for (var key in src) { if (src.hasOwnProperty(key)) { var value = src[key]; if (value !== null && Object(_is_plain_object__WEBPACK_IMPORTED_MODULE_1__["default"])(value)) { if (!Object(_is_plain_object__WEBPACK_IMPORTED_MODULE_1__["default"])(dist[key])) { dist[key] = {}; } if (level < maxLevel) { _deepMix(dist[key], value, level + 1, maxLevel); } else { dist[key] = src[key]; } } else if (Object(_is_array__WEBPACK_IMPORTED_MODULE_0__["default"])(value)) { dist[key] = []; dist[key] = dist[key].concat(value); } else if (value !== undefined) { dist[key] = value; } } } } // todo 重写 var deepMix = function (rst) { var args = []; for (var _i = 1; _i < arguments.length; _i++) { args[_i - 1] = arguments[_i]; } for (var i = 0; i < args.length; i += 1) { _deepMix(rst, args[i]); } return rst; }; /* harmony default export */ __webpack_exports__["default"] = (deepMix); /***/ }), /***/ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/difference.js": /*!*********************************************************************!*\ !*** ./node_modules/_@antv_util@2.0.9@@antv/util/esm/difference.js ***! \*********************************************************************/ /*! exports provided: default */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony import */ var _filter__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./filter */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/filter.js"); /* harmony import */ var _contains__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./contains */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/contains.js"); /** * Flattens `array` a single level deep. * * @param {Array} arr The array to inspect. * @param {Array} values The values to exclude. * @return {Array} Returns the new array of filtered values. * @example * difference([2, 1], [2, 3]); // => [1] */ var difference = function (arr, values) { if (values === void 0) { values = []; } return Object(_filter__WEBPACK_IMPORTED_MODULE_0__["default"])(arr, function (value) { return !Object(_contains__WEBPACK_IMPORTED_MODULE_1__["default"])(values, value); }); }; /* harmony default export */ __webpack_exports__["default"] = (difference); /***/ }), /***/ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/each.js": /*!***************************************************************!*\ !*** ./node_modules/_@antv_util@2.0.9@@antv/util/esm/each.js ***! \***************************************************************/ /*! exports provided: default */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony import */ var _is_array__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./is-array */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/is-array.js"); /* harmony import */ var _is_object__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./is-object */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/is-object.js"); function each(elements, func) { if (!elements) { return; } var rst; if (Object(_is_array__WEBPACK_IMPORTED_MODULE_0__["default"])(elements)) { for (var i = 0, len = elements.length; i < len; i++) { rst = func(elements[i], i); if (rst === false) { break; } } } else if (Object(_is_object__WEBPACK_IMPORTED_MODULE_1__["default"])(elements)) { for (var k in elements) { if (elements.hasOwnProperty(k)) { rst = func(elements[k], k); if (rst === false) { break; } } } } } /* harmony default export */ __webpack_exports__["default"] = (each); /***/ }), /***/ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/ends-with.js": /*!********************************************************************!*\ !*** ./node_modules/_@antv_util@2.0.9@@antv/util/esm/ends-with.js ***! \********************************************************************/ /*! exports provided: default */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony import */ var _is_array__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./is-array */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/is-array.js"); /* harmony import */ var _is_string__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./is-string */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/is-string.js"); function endsWith(arr, e) { return Object(_is_array__WEBPACK_IMPORTED_MODULE_0__["default"])(arr) || Object(_is_string__WEBPACK_IMPORTED_MODULE_1__["default"])(arr) ? arr[arr.length - 1] === e : false; } /* harmony default export */ __webpack_exports__["default"] = (endsWith); /***/ }), /***/ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/every.js": /*!****************************************************************!*\ !*** ./node_modules/_@antv_util@2.0.9@@antv/util/esm/every.js ***! \****************************************************************/ /*! exports provided: default */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /** * 只要有一个不满足条件就返回 false * @param arr * @param func */ var every = function (arr, func) { for (var i = 0; i < arr.length; i++) { if (!func(arr[i], i)) return false; } return true; }; /* harmony default export */ __webpack_exports__["default"] = (every); /***/ }), /***/ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/extend.js": /*!*****************************************************************!*\ !*** ./node_modules/_@antv_util@2.0.9@@antv/util/esm/extend.js ***! \*****************************************************************/ /*! exports provided: default */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony import */ var _mix__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./mix */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/mix.js"); /* harmony import */ var _is_function__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./is-function */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/is-function.js"); var extend = function (subclass, superclass, overrides, staticOverrides) { // 如果只提供父类构造函数,则自动生成子类构造函数 if (!Object(_is_function__WEBPACK_IMPORTED_MODULE_1__["default"])(superclass)) { overrides = superclass; superclass = subclass; subclass = function () {}; } var create = Object.create ? function (proto, c) { return Object.create(proto, { constructor: { value: c } }); } : function (proto, c) { function Tmp() {} Tmp.prototype = proto; var o = new Tmp(); o.constructor = c; return o; }; var superObj = create(superclass.prototype, subclass); // new superclass(),//实例化父类作为子类的prototype subclass.prototype = Object(_mix__WEBPACK_IMPORTED_MODULE_0__["default"])(superObj, subclass.prototype); // 指定子类的prototype subclass.superclass = create(superclass.prototype, superclass); Object(_mix__WEBPACK_IMPORTED_MODULE_0__["default"])(superObj, overrides); Object(_mix__WEBPACK_IMPORTED_MODULE_0__["default"])(subclass, staticOverrides); return subclass; }; /* harmony default export */ __webpack_exports__["default"] = (extend); /***/ }), /***/ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/filter.js": /*!*****************************************************************!*\ !*** ./node_modules/_@antv_util@2.0.9@@antv/util/esm/filter.js ***! \*****************************************************************/ /*! exports provided: default */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony import */ var _is_array_like__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./is-array-like */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/is-array-like.js"); var filter = function (arr, func) { if (!Object(_is_array_like__WEBPACK_IMPORTED_MODULE_0__["default"])(arr)) { return arr; } var result = []; for (var index = 0; index < arr.length; index++) { var value = arr[index]; if (func(value, index)) { result.push(value); } } return result; }; /* harmony default export */ __webpack_exports__["default"] = (filter); /***/ }), /***/ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/find-index.js": /*!*********************************************************************!*\ !*** ./node_modules/_@antv_util@2.0.9@@antv/util/esm/find-index.js ***! \*********************************************************************/ /*! exports provided: default */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); function findIndex(arr, predicate, fromIndex) { if (fromIndex === void 0) { fromIndex = 0; } for (var i = fromIndex; i < arr.length; i++) { if (predicate(arr[i], i)) { // 找到终止循环 return i; } } return -1; } /* harmony default export */ __webpack_exports__["default"] = (findIndex); /***/ }), /***/ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/find.js": /*!***************************************************************!*\ !*** ./node_modules/_@antv_util@2.0.9@@antv/util/esm/find.js ***! \***************************************************************/ /*! exports provided: default */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony import */ var _is_function__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./is-function */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/is-function.js"); /* harmony import */ var _is_match__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./is-match */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/is-match.js"); /* harmony import */ var _is_array__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./is-array */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/is-array.js"); /* harmony import */ var _is_plain_object__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./is-plain-object */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/is-plain-object.js"); function find(arr, predicate) { if (!Object(_is_array__WEBPACK_IMPORTED_MODULE_2__["default"])(arr)) return null; var _predicate; if (Object(_is_function__WEBPACK_IMPORTED_MODULE_0__["default"])(predicate)) { _predicate = predicate; } if (Object(_is_plain_object__WEBPACK_IMPORTED_MODULE_3__["default"])(predicate)) { _predicate = function (a) { return Object(_is_match__WEBPACK_IMPORTED_MODULE_1__["default"])(a, predicate); }; } if (_predicate) { for (var i = 0; i < arr.length; i += 1) { if (_predicate(arr[i])) { return arr[i]; } } } return null; } /* harmony default export */ __webpack_exports__["default"] = (find); /***/ }), /***/ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/first-value.js": /*!**********************************************************************!*\ !*** ./node_modules/_@antv_util@2.0.9@@antv/util/esm/first-value.js ***! \**********************************************************************/ /*! exports provided: default */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony import */ var _is_nil__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./is-nil */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/is-nil.js"); /* harmony import */ var _is_array__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./is-array */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/is-array.js"); var firstValue = function (data, name) { var rst = null; for (var i = 0; i < data.length; i++) { var obj = data[i]; var value = obj[name]; if (!Object(_is_nil__WEBPACK_IMPORTED_MODULE_0__["default"])(value)) { if (Object(_is_array__WEBPACK_IMPORTED_MODULE_1__["default"])(value)) { rst = value[0]; // todo 这里是否应该使用递归,调用 firstValue @绝云 } else { rst = value; } break; } } return rst; }; /* harmony default export */ __webpack_exports__["default"] = (firstValue); /***/ }), /***/ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/fixed-base.js": /*!*********************************************************************!*\ !*** ./node_modules/_@antv_util@2.0.9@@antv/util/esm/fixed-base.js ***! \*********************************************************************/ /*! exports provided: default */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); var fixedBase = function (v, base) { var str = base.toString(); var index = str.indexOf('.'); if (index === -1) { return Math.round(v); } var length = str.substr(index + 1).length; if (length > 20) { length = 20; } return parseFloat(v.toFixed(length)); }; /* harmony default export */ __webpack_exports__["default"] = (fixedBase); /***/ }), /***/ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/flatten-deep.js": /*!***********************************************************************!*\ !*** ./node_modules/_@antv_util@2.0.9@@antv/util/esm/flatten-deep.js ***! \***********************************************************************/ /*! exports provided: default */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony import */ var _is_array__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./is-array */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/is-array.js"); /** * Flattens `array` a single level deep. * * @param {Array} arr The array to flatten. * @param {Array} result The array to return. * @return {Array} Returns the new flattened array. * @example * * flattenDeep([1, [2, [3, [4]], 5]]); // => [1, 2, 3, 4, 5] */ var flattenDeep = function (arr, result) { if (result === void 0) { result = []; } if (!Object(_is_array__WEBPACK_IMPORTED_MODULE_0__["default"])(arr)) { result.push(arr); } else { for (var i = 0; i < arr.length; i += 1) { flattenDeep(arr[i], result); } } return result; }; /* harmony default export */ __webpack_exports__["default"] = (flattenDeep); /***/ }), /***/ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/flatten.js": /*!******************************************************************!*\ !*** ./node_modules/_@antv_util@2.0.9@@antv/util/esm/flatten.js ***! \******************************************************************/ /*! exports provided: default */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony import */ var _is_array__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./is-array */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/is-array.js"); /** * Flattens `array` a single level deep. * * @param {Array} arr The array to flatten. * @return {Array} Returns the new flattened array. * @example * * flatten([1, [2, [3, [4]], 5]]); // => [1, 2, [3, [4]], 5] */ var flatten = function (arr) { if (!Object(_is_array__WEBPACK_IMPORTED_MODULE_0__["default"])(arr)) { return []; } var rst = []; for (var i = 0; i < arr.length; i++) { rst = rst.concat(arr[i]); } return rst; }; /* harmony default export */ __webpack_exports__["default"] = (flatten); /***/ }), /***/ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/for-in.js": /*!*****************************************************************!*\ !*** ./node_modules/_@antv_util@2.0.9@@antv/util/esm/for-in.js ***! \*****************************************************************/ /*! exports provided: default */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony import */ var _each__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./each */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/each.js"); /* harmony default export */ __webpack_exports__["default"] = (_each__WEBPACK_IMPORTED_MODULE_0__["default"]); /***/ }), /***/ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/get-range.js": /*!********************************************************************!*\ !*** ./node_modules/_@antv_util@2.0.9@@antv/util/esm/get-range.js ***! \********************************************************************/ /*! exports provided: default */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony import */ var _is_array__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./is-array */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/is-array.js"); var getRange = function (values) { // 存在 NaN 时,min,max 判定会出问题 var filterValues = values.filter(function (v) { return !isNaN(v); }); if (!filterValues.length) { // 如果没有数值则直接返回0 return { min: 0, max: 0 }; } if (Object(_is_array__WEBPACK_IMPORTED_MODULE_0__["default"])(values[0])) { var tmp = []; for (var i = 0; i < values.length; i++) { tmp = tmp.concat(values[i]); } filterValues = tmp; } var max = Math.max.apply(null, filterValues); var min = Math.min.apply(null, filterValues); return { min: min, max: max }; }; /* harmony default export */ __webpack_exports__["default"] = (getRange); /***/ }), /***/ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/get-type.js": /*!*******************************************************************!*\ !*** ./node_modules/_@antv_util@2.0.9@@antv/util/esm/get-type.js ***! \*******************************************************************/ /*! exports provided: default */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); var toString = {}.toString; var getType = function (value) { return toString.call(value).replace(/^\[object /, '').replace(/]$/, ''); }; /* harmony default export */ __webpack_exports__["default"] = (getType); /***/ }), /***/ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/get-wrap-behavior.js": /*!****************************************************************************!*\ !*** ./node_modules/_@antv_util@2.0.9@@antv/util/esm/get-wrap-behavior.js ***! \****************************************************************************/ /*! exports provided: default */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /** * 获取封装的事件 * @protected * @param {Object} obj 对象 * @param {String} action 事件名称 * @return {Function} 返回事件处理函数 */ function getWrapBehavior(obj, action) { return obj['_wrap_' + action]; } /* harmony default export */ __webpack_exports__["default"] = (getWrapBehavior); /***/ }), /***/ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/get.js": /*!**************************************************************!*\ !*** ./node_modules/_@antv_util@2.0.9@@antv/util/esm/get.js ***! \**************************************************************/ /*! exports provided: default */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony import */ var _is_string__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./is-string */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/is-string.js"); /** * https://github.com/developit/dlv/blob/master/index.js * @param obj * @param key * @param defaultValue */ /* harmony default export */ __webpack_exports__["default"] = (function (obj, key, defaultValue) { var p = 0; var keyArr = Object(_is_string__WEBPACK_IMPORTED_MODULE_0__["default"])(key) ? key.split('.') : key; while (obj && p < keyArr.length) { obj = obj[keyArr[p++]]; } return obj === undefined || p < keyArr.length ? defaultValue : obj; }); /***/ }), /***/ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/group-by.js": /*!*******************************************************************!*\ !*** ./node_modules/_@antv_util@2.0.9@@antv/util/esm/group-by.js ***! \*******************************************************************/ /*! exports provided: default */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony import */ var _is_array__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./is-array */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/is-array.js"); /* harmony import */ var _is_function__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./is-function */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/is-function.js"); var hasOwnProperty = Object.prototype.hasOwnProperty; function groupBy(data, condition) { if (!condition || !Object(_is_array__WEBPACK_IMPORTED_MODULE_0__["default"])(data)) { return {}; } var result = {}; // 兼容方法和 字符串的写法 var predicate = Object(_is_function__WEBPACK_IMPORTED_MODULE_1__["default"])(condition) ? condition : function (item) { return item[condition]; }; var key; for (var i = 0; i < data.length; i++) { var item = data[i]; key = predicate(item); if (hasOwnProperty.call(result, key)) { result[key].push(item); } else { result[key] = [item]; } } return result; } /* harmony default export */ __webpack_exports__["default"] = (groupBy); /***/ }), /***/ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/group-to-map.js": /*!***********************************************************************!*\ !*** ./node_modules/_@antv_util@2.0.9@@antv/util/esm/group-to-map.js ***! \***********************************************************************/ /*! exports provided: default */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony import */ var _is_array__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./is-array */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/is-array.js"); /* harmony import */ var _is_function__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./is-function */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/is-function.js"); /* harmony import */ var _group_by__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./group-by */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/group-by.js"); var groupToMap = function (data, condition) { if (!condition) { return { 0: data }; } if (!Object(_is_function__WEBPACK_IMPORTED_MODULE_1__["default"])(condition)) { var paramsCondition_1 = Object(_is_array__WEBPACK_IMPORTED_MODULE_0__["default"])(condition) ? condition : condition.replace(/\s+/g, '').split('*'); condition = function (row) { var unique = '_'; // 避免出现数字作为Key的情况,会进行按照数字的排序 for (var i = 0, l = paramsCondition_1.length; i < l; i++) { unique += row[paramsCondition_1[i]] && row[paramsCondition_1[i]].toString(); } return unique; }; } var groups = Object(_group_by__WEBPACK_IMPORTED_MODULE_2__["default"])(data, condition); return groups; }; /* harmony default export */ __webpack_exports__["default"] = (groupToMap); /***/ }), /***/ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/group.js": /*!****************************************************************!*\ !*** ./node_modules/_@antv_util@2.0.9@@antv/util/esm/group.js ***! \****************************************************************/ /*! exports provided: default */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony import */ var _group_to_map__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./group-to-map */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/group-to-map.js"); /* harmony default export */ __webpack_exports__["default"] = (function (data, condition) { if (!condition) { // 没有条件,则自身改成数组 return [data]; } var groups = Object(_group_to_map__WEBPACK_IMPORTED_MODULE_0__["default"])(data, condition); var array = []; for (var i in groups) { array.push(groups[i]); } return array; }); /***/ }), /***/ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/has-key.js": /*!******************************************************************!*\ !*** ./node_modules/_@antv_util@2.0.9@@antv/util/esm/has-key.js ***! \******************************************************************/ /*! exports provided: default */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony import */ var _has__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./has */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/has.js"); /* harmony default export */ __webpack_exports__["default"] = (_has__WEBPACK_IMPORTED_MODULE_0__["default"]); /***/ }), /***/ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/has-value.js": /*!********************************************************************!*\ !*** ./node_modules/_@antv_util@2.0.9@@antv/util/esm/has-value.js ***! \********************************************************************/ /*! exports provided: default */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony import */ var _contains__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./contains */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/contains.js"); /* harmony import */ var _values__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./values */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/values.js"); /* harmony default export */ __webpack_exports__["default"] = (function (obj, value) { return Object(_contains__WEBPACK_IMPORTED_MODULE_0__["default"])(Object(_values__WEBPACK_IMPORTED_MODULE_1__["default"])(obj), value); }); /***/ }), /***/ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/has.js": /*!**************************************************************!*\ !*** ./node_modules/_@antv_util@2.0.9@@antv/util/esm/has.js ***! \**************************************************************/ /*! exports provided: default */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony default export */ __webpack_exports__["default"] = (function (obj, key) { return obj.hasOwnProperty(key); }); /***/ }), /***/ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/head.js": /*!***************************************************************!*\ !*** ./node_modules/_@antv_util@2.0.9@@antv/util/esm/head.js ***! \***************************************************************/ /*! exports provided: default */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return head; }); /* harmony import */ var _is_array_like__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./is-array-like */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/is-array-like.js"); function head(o) { if (Object(_is_array_like__WEBPACK_IMPORTED_MODULE_0__["default"])(o)) { return o[0]; } return undefined; } /***/ }), /***/ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/identity.js": /*!*******************************************************************!*\ !*** ./node_modules/_@antv_util@2.0.9@@antv/util/esm/identity.js ***! \*******************************************************************/ /*! exports provided: default */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony default export */ __webpack_exports__["default"] = (function (v) { return v; }); /***/ }), /***/ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/index-of.js": /*!*******************************************************************!*\ !*** ./node_modules/_@antv_util@2.0.9@@antv/util/esm/index-of.js ***! \*******************************************************************/ /*! exports provided: default */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony import */ var _is_array_like__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./is-array-like */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/is-array-like.js"); var indexOf = function (arr, obj) { if (!Object(_is_array_like__WEBPACK_IMPORTED_MODULE_0__["default"])(arr)) { return -1; } var m = Array.prototype.indexOf; if (m) { return m.call(arr, obj); } var index = -1; for (var i = 0; i < arr.length; i++) { if (arr[i] === obj) { index = i; break; } } return index; }; /* harmony default export */ __webpack_exports__["default"] = (indexOf); /***/ }), /***/ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/index.js": /*!****************************************************************!*\ !*** ./node_modules/_@antv_util@2.0.9@@antv/util/esm/index.js ***! \****************************************************************/ /*! exports provided: contains, includes, difference, find, findIndex, firstValue, flatten, flattenDeep, getRange, pull, pullAt, reduce, remove, sortBy, union, uniq, valuesOfKey, head, last, startsWith, endsWith, filter, every, some, group, groupBy, groupToMap, getWrapBehavior, wrapBehavior, number2color, parseRadius, clamp, fixedBase, isDecimal, isEven, isInteger, isNegative, isNumberEqual, isOdd, isPositive, maxBy, minBy, mod, toDegree, toInteger, toRadian, forIn, has, hasKey, hasValue, keys, isMatch, values, lowerCase, lowerFirst, substitute, upperCase, upperFirst, getType, isArguments, isArray, isArrayLike, isBoolean, isDate, isError, isFunction, isFinite, isNil, isNull, isNumber, isObject, isObjectLike, isPlainObject, isPrototype, isRegExp, isString, isType, isUndefined, isElement, requestAnimationFrame, clearAnimationFrame, augment, clone, debounce, memoize, deepMix, each, extend, indexOf, isEmpty, isEqual, isEqualWith, map, mapValues, mix, assign, get, set, pick, throttle, toArray, toString, uniqueId, noop, identity, size, Cache */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony import */ var _contains__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./contains */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/contains.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "contains", function() { return _contains__WEBPACK_IMPORTED_MODULE_0__["default"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "includes", function() { return _contains__WEBPACK_IMPORTED_MODULE_0__["default"]; }); /* harmony import */ var _difference__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./difference */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/difference.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "difference", function() { return _difference__WEBPACK_IMPORTED_MODULE_1__["default"]; }); /* harmony import */ var _find__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./find */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/find.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "find", function() { return _find__WEBPACK_IMPORTED_MODULE_2__["default"]; }); /* harmony import */ var _find_index__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./find-index */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/find-index.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "findIndex", function() { return _find_index__WEBPACK_IMPORTED_MODULE_3__["default"]; }); /* harmony import */ var _first_value__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./first-value */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/first-value.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "firstValue", function() { return _first_value__WEBPACK_IMPORTED_MODULE_4__["default"]; }); /* harmony import */ var _flatten__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./flatten */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/flatten.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "flatten", function() { return _flatten__WEBPACK_IMPORTED_MODULE_5__["default"]; }); /* harmony import */ var _flatten_deep__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./flatten-deep */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/flatten-deep.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "flattenDeep", function() { return _flatten_deep__WEBPACK_IMPORTED_MODULE_6__["default"]; }); /* harmony import */ var _get_range__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./get-range */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/get-range.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "getRange", function() { return _get_range__WEBPACK_IMPORTED_MODULE_7__["default"]; }); /* harmony import */ var _pull__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./pull */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/pull.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "pull", function() { return _pull__WEBPACK_IMPORTED_MODULE_8__["default"]; }); /* harmony import */ var _pull_at__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./pull-at */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/pull-at.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "pullAt", function() { return _pull_at__WEBPACK_IMPORTED_MODULE_9__["default"]; }); /* harmony import */ var _reduce__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./reduce */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/reduce.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "reduce", function() { return _reduce__WEBPACK_IMPORTED_MODULE_10__["default"]; }); /* harmony import */ var _remove__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./remove */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/remove.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "remove", function() { return _remove__WEBPACK_IMPORTED_MODULE_11__["default"]; }); /* harmony import */ var _sort_by__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./sort-by */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/sort-by.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "sortBy", function() { return _sort_by__WEBPACK_IMPORTED_MODULE_12__["default"]; }); /* harmony import */ var _union__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./union */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/union.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "union", function() { return _union__WEBPACK_IMPORTED_MODULE_13__["default"]; }); /* harmony import */ var _uniq__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./uniq */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/uniq.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "uniq", function() { return _uniq__WEBPACK_IMPORTED_MODULE_14__["default"]; }); /* harmony import */ var _values_of_key__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./values-of-key */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/values-of-key.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "valuesOfKey", function() { return _values_of_key__WEBPACK_IMPORTED_MODULE_15__["default"]; }); /* harmony import */ var _head__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./head */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/head.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "head", function() { return _head__WEBPACK_IMPORTED_MODULE_16__["default"]; }); /* harmony import */ var _last__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ./last */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/last.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "last", function() { return _last__WEBPACK_IMPORTED_MODULE_17__["default"]; }); /* harmony import */ var _starts_with__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ./starts-with */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/starts-with.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "startsWith", function() { return _starts_with__WEBPACK_IMPORTED_MODULE_18__["default"]; }); /* harmony import */ var _ends_with__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! ./ends-with */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/ends-with.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "endsWith", function() { return _ends_with__WEBPACK_IMPORTED_MODULE_19__["default"]; }); /* harmony import */ var _filter__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(/*! ./filter */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/filter.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "filter", function() { return _filter__WEBPACK_IMPORTED_MODULE_20__["default"]; }); /* harmony import */ var _every__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(/*! ./every */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/every.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "every", function() { return _every__WEBPACK_IMPORTED_MODULE_21__["default"]; }); /* harmony import */ var _some__WEBPACK_IMPORTED_MODULE_22__ = __webpack_require__(/*! ./some */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/some.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "some", function() { return _some__WEBPACK_IMPORTED_MODULE_22__["default"]; }); /* harmony import */ var _group__WEBPACK_IMPORTED_MODULE_23__ = __webpack_require__(/*! ./group */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/group.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "group", function() { return _group__WEBPACK_IMPORTED_MODULE_23__["default"]; }); /* harmony import */ var _group_by__WEBPACK_IMPORTED_MODULE_24__ = __webpack_require__(/*! ./group-by */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/group-by.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "groupBy", function() { return _group_by__WEBPACK_IMPORTED_MODULE_24__["default"]; }); /* harmony import */ var _group_to_map__WEBPACK_IMPORTED_MODULE_25__ = __webpack_require__(/*! ./group-to-map */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/group-to-map.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "groupToMap", function() { return _group_to_map__WEBPACK_IMPORTED_MODULE_25__["default"]; }); /* harmony import */ var _get_wrap_behavior__WEBPACK_IMPORTED_MODULE_26__ = __webpack_require__(/*! ./get-wrap-behavior */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/get-wrap-behavior.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "getWrapBehavior", function() { return _get_wrap_behavior__WEBPACK_IMPORTED_MODULE_26__["default"]; }); /* harmony import */ var _wrap_behavior__WEBPACK_IMPORTED_MODULE_27__ = __webpack_require__(/*! ./wrap-behavior */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/wrap-behavior.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "wrapBehavior", function() { return _wrap_behavior__WEBPACK_IMPORTED_MODULE_27__["default"]; }); /* harmony import */ var _number2color__WEBPACK_IMPORTED_MODULE_28__ = __webpack_require__(/*! ./number2color */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/number2color.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "number2color", function() { return _number2color__WEBPACK_IMPORTED_MODULE_28__["default"]; }); /* harmony import */ var _parse_radius__WEBPACK_IMPORTED_MODULE_29__ = __webpack_require__(/*! ./parse-radius */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/parse-radius.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "parseRadius", function() { return _parse_radius__WEBPACK_IMPORTED_MODULE_29__["default"]; }); /* harmony import */ var _clamp__WEBPACK_IMPORTED_MODULE_30__ = __webpack_require__(/*! ./clamp */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/clamp.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "clamp", function() { return _clamp__WEBPACK_IMPORTED_MODULE_30__["default"]; }); /* harmony import */ var _fixed_base__WEBPACK_IMPORTED_MODULE_31__ = __webpack_require__(/*! ./fixed-base */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/fixed-base.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "fixedBase", function() { return _fixed_base__WEBPACK_IMPORTED_MODULE_31__["default"]; }); /* harmony import */ var _is_decimal__WEBPACK_IMPORTED_MODULE_32__ = __webpack_require__(/*! ./is-decimal */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/is-decimal.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "isDecimal", function() { return _is_decimal__WEBPACK_IMPORTED_MODULE_32__["default"]; }); /* harmony import */ var _is_even__WEBPACK_IMPORTED_MODULE_33__ = __webpack_require__(/*! ./is-even */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/is-even.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "isEven", function() { return _is_even__WEBPACK_IMPORTED_MODULE_33__["default"]; }); /* harmony import */ var _is_integer__WEBPACK_IMPORTED_MODULE_34__ = __webpack_require__(/*! ./is-integer */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/is-integer.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "isInteger", function() { return _is_integer__WEBPACK_IMPORTED_MODULE_34__["default"]; }); /* harmony import */ var _is_negative__WEBPACK_IMPORTED_MODULE_35__ = __webpack_require__(/*! ./is-negative */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/is-negative.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "isNegative", function() { return _is_negative__WEBPACK_IMPORTED_MODULE_35__["default"]; }); /* harmony import */ var _is_number_equal__WEBPACK_IMPORTED_MODULE_36__ = __webpack_require__(/*! ./is-number-equal */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/is-number-equal.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "isNumberEqual", function() { return _is_number_equal__WEBPACK_IMPORTED_MODULE_36__["default"]; }); /* harmony import */ var _is_odd__WEBPACK_IMPORTED_MODULE_37__ = __webpack_require__(/*! ./is-odd */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/is-odd.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "isOdd", function() { return _is_odd__WEBPACK_IMPORTED_MODULE_37__["default"]; }); /* harmony import */ var _is_positive__WEBPACK_IMPORTED_MODULE_38__ = __webpack_require__(/*! ./is-positive */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/is-positive.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "isPositive", function() { return _is_positive__WEBPACK_IMPORTED_MODULE_38__["default"]; }); /* harmony import */ var _max_by__WEBPACK_IMPORTED_MODULE_39__ = __webpack_require__(/*! ./max-by */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/max-by.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "maxBy", function() { return _max_by__WEBPACK_IMPORTED_MODULE_39__["default"]; }); /* harmony import */ var _min_by__WEBPACK_IMPORTED_MODULE_40__ = __webpack_require__(/*! ./min-by */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/min-by.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "minBy", function() { return _min_by__WEBPACK_IMPORTED_MODULE_40__["default"]; }); /* harmony import */ var _mod__WEBPACK_IMPORTED_MODULE_41__ = __webpack_require__(/*! ./mod */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/mod.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "mod", function() { return _mod__WEBPACK_IMPORTED_MODULE_41__["default"]; }); /* harmony import */ var _to_degree__WEBPACK_IMPORTED_MODULE_42__ = __webpack_require__(/*! ./to-degree */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/to-degree.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "toDegree", function() { return _to_degree__WEBPACK_IMPORTED_MODULE_42__["default"]; }); /* harmony import */ var _to_integer__WEBPACK_IMPORTED_MODULE_43__ = __webpack_require__(/*! ./to-integer */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/to-integer.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "toInteger", function() { return _to_integer__WEBPACK_IMPORTED_MODULE_43__["default"]; }); /* harmony import */ var _to_radian__WEBPACK_IMPORTED_MODULE_44__ = __webpack_require__(/*! ./to-radian */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/to-radian.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "toRadian", function() { return _to_radian__WEBPACK_IMPORTED_MODULE_44__["default"]; }); /* harmony import */ var _for_in__WEBPACK_IMPORTED_MODULE_45__ = __webpack_require__(/*! ./for-in */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/for-in.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "forIn", function() { return _for_in__WEBPACK_IMPORTED_MODULE_45__["default"]; }); /* harmony import */ var _has__WEBPACK_IMPORTED_MODULE_46__ = __webpack_require__(/*! ./has */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/has.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "has", function() { return _has__WEBPACK_IMPORTED_MODULE_46__["default"]; }); /* harmony import */ var _has_key__WEBPACK_IMPORTED_MODULE_47__ = __webpack_require__(/*! ./has-key */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/has-key.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "hasKey", function() { return _has_key__WEBPACK_IMPORTED_MODULE_47__["default"]; }); /* harmony import */ var _has_value__WEBPACK_IMPORTED_MODULE_48__ = __webpack_require__(/*! ./has-value */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/has-value.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "hasValue", function() { return _has_value__WEBPACK_IMPORTED_MODULE_48__["default"]; }); /* harmony import */ var _keys__WEBPACK_IMPORTED_MODULE_49__ = __webpack_require__(/*! ./keys */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/keys.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "keys", function() { return _keys__WEBPACK_IMPORTED_MODULE_49__["default"]; }); /* harmony import */ var _is_match__WEBPACK_IMPORTED_MODULE_50__ = __webpack_require__(/*! ./is-match */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/is-match.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "isMatch", function() { return _is_match__WEBPACK_IMPORTED_MODULE_50__["default"]; }); /* harmony import */ var _values__WEBPACK_IMPORTED_MODULE_51__ = __webpack_require__(/*! ./values */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/values.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "values", function() { return _values__WEBPACK_IMPORTED_MODULE_51__["default"]; }); /* harmony import */ var _lower_case__WEBPACK_IMPORTED_MODULE_52__ = __webpack_require__(/*! ./lower-case */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/lower-case.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "lowerCase", function() { return _lower_case__WEBPACK_IMPORTED_MODULE_52__["default"]; }); /* harmony import */ var _lower_first__WEBPACK_IMPORTED_MODULE_53__ = __webpack_require__(/*! ./lower-first */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/lower-first.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "lowerFirst", function() { return _lower_first__WEBPACK_IMPORTED_MODULE_53__["default"]; }); /* harmony import */ var _substitute__WEBPACK_IMPORTED_MODULE_54__ = __webpack_require__(/*! ./substitute */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/substitute.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "substitute", function() { return _substitute__WEBPACK_IMPORTED_MODULE_54__["default"]; }); /* harmony import */ var _upper_case__WEBPACK_IMPORTED_MODULE_55__ = __webpack_require__(/*! ./upper-case */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/upper-case.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "upperCase", function() { return _upper_case__WEBPACK_IMPORTED_MODULE_55__["default"]; }); /* harmony import */ var _upper_first__WEBPACK_IMPORTED_MODULE_56__ = __webpack_require__(/*! ./upper-first */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/upper-first.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "upperFirst", function() { return _upper_first__WEBPACK_IMPORTED_MODULE_56__["default"]; }); /* harmony import */ var _get_type__WEBPACK_IMPORTED_MODULE_57__ = __webpack_require__(/*! ./get-type */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/get-type.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "getType", function() { return _get_type__WEBPACK_IMPORTED_MODULE_57__["default"]; }); /* harmony import */ var _is_arguments__WEBPACK_IMPORTED_MODULE_58__ = __webpack_require__(/*! ./is-arguments */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/is-arguments.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "isArguments", function() { return _is_arguments__WEBPACK_IMPORTED_MODULE_58__["default"]; }); /* harmony import */ var _is_array__WEBPACK_IMPORTED_MODULE_59__ = __webpack_require__(/*! ./is-array */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/is-array.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "isArray", function() { return _is_array__WEBPACK_IMPORTED_MODULE_59__["default"]; }); /* harmony import */ var _is_array_like__WEBPACK_IMPORTED_MODULE_60__ = __webpack_require__(/*! ./is-array-like */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/is-array-like.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "isArrayLike", function() { return _is_array_like__WEBPACK_IMPORTED_MODULE_60__["default"]; }); /* harmony import */ var _is_boolean__WEBPACK_IMPORTED_MODULE_61__ = __webpack_require__(/*! ./is-boolean */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/is-boolean.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "isBoolean", function() { return _is_boolean__WEBPACK_IMPORTED_MODULE_61__["default"]; }); /* harmony import */ var _is_date__WEBPACK_IMPORTED_MODULE_62__ = __webpack_require__(/*! ./is-date */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/is-date.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "isDate", function() { return _is_date__WEBPACK_IMPORTED_MODULE_62__["default"]; }); /* harmony import */ var _is_error__WEBPACK_IMPORTED_MODULE_63__ = __webpack_require__(/*! ./is-error */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/is-error.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "isError", function() { return _is_error__WEBPACK_IMPORTED_MODULE_63__["default"]; }); /* harmony import */ var _is_function__WEBPACK_IMPORTED_MODULE_64__ = __webpack_require__(/*! ./is-function */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/is-function.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "isFunction", function() { return _is_function__WEBPACK_IMPORTED_MODULE_64__["default"]; }); /* harmony import */ var _is_finite__WEBPACK_IMPORTED_MODULE_65__ = __webpack_require__(/*! ./is-finite */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/is-finite.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "isFinite", function() { return _is_finite__WEBPACK_IMPORTED_MODULE_65__["default"]; }); /* harmony import */ var _is_nil__WEBPACK_IMPORTED_MODULE_66__ = __webpack_require__(/*! ./is-nil */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/is-nil.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "isNil", function() { return _is_nil__WEBPACK_IMPORTED_MODULE_66__["default"]; }); /* harmony import */ var _is_null__WEBPACK_IMPORTED_MODULE_67__ = __webpack_require__(/*! ./is-null */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/is-null.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "isNull", function() { return _is_null__WEBPACK_IMPORTED_MODULE_67__["default"]; }); /* harmony import */ var _is_number__WEBPACK_IMPORTED_MODULE_68__ = __webpack_require__(/*! ./is-number */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/is-number.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "isNumber", function() { return _is_number__WEBPACK_IMPORTED_MODULE_68__["default"]; }); /* harmony import */ var _is_object__WEBPACK_IMPORTED_MODULE_69__ = __webpack_require__(/*! ./is-object */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/is-object.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "isObject", function() { return _is_object__WEBPACK_IMPORTED_MODULE_69__["default"]; }); /* harmony import */ var _is_object_like__WEBPACK_IMPORTED_MODULE_70__ = __webpack_require__(/*! ./is-object-like */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/is-object-like.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "isObjectLike", function() { return _is_object_like__WEBPACK_IMPORTED_MODULE_70__["default"]; }); /* harmony import */ var _is_plain_object__WEBPACK_IMPORTED_MODULE_71__ = __webpack_require__(/*! ./is-plain-object */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/is-plain-object.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "isPlainObject", function() { return _is_plain_object__WEBPACK_IMPORTED_MODULE_71__["default"]; }); /* harmony import */ var _is_prototype__WEBPACK_IMPORTED_MODULE_72__ = __webpack_require__(/*! ./is-prototype */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/is-prototype.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "isPrototype", function() { return _is_prototype__WEBPACK_IMPORTED_MODULE_72__["default"]; }); /* harmony import */ var _is_reg_exp__WEBPACK_IMPORTED_MODULE_73__ = __webpack_require__(/*! ./is-reg-exp */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/is-reg-exp.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "isRegExp", function() { return _is_reg_exp__WEBPACK_IMPORTED_MODULE_73__["default"]; }); /* harmony import */ var _is_string__WEBPACK_IMPORTED_MODULE_74__ = __webpack_require__(/*! ./is-string */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/is-string.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "isString", function() { return _is_string__WEBPACK_IMPORTED_MODULE_74__["default"]; }); /* harmony import */ var _is_type__WEBPACK_IMPORTED_MODULE_75__ = __webpack_require__(/*! ./is-type */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/is-type.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "isType", function() { return _is_type__WEBPACK_IMPORTED_MODULE_75__["default"]; }); /* harmony import */ var _is_undefined__WEBPACK_IMPORTED_MODULE_76__ = __webpack_require__(/*! ./is-undefined */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/is-undefined.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "isUndefined", function() { return _is_undefined__WEBPACK_IMPORTED_MODULE_76__["default"]; }); /* harmony import */ var _is_element__WEBPACK_IMPORTED_MODULE_77__ = __webpack_require__(/*! ./is-element */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/is-element.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "isElement", function() { return _is_element__WEBPACK_IMPORTED_MODULE_77__["default"]; }); /* harmony import */ var _request_animation_frame__WEBPACK_IMPORTED_MODULE_78__ = __webpack_require__(/*! ./request-animation-frame */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/request-animation-frame.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "requestAnimationFrame", function() { return _request_animation_frame__WEBPACK_IMPORTED_MODULE_78__["default"]; }); /* harmony import */ var _clear_animation_frame__WEBPACK_IMPORTED_MODULE_79__ = __webpack_require__(/*! ./clear-animation-frame */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/clear-animation-frame.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "clearAnimationFrame", function() { return _clear_animation_frame__WEBPACK_IMPORTED_MODULE_79__["default"]; }); /* harmony import */ var _augment__WEBPACK_IMPORTED_MODULE_80__ = __webpack_require__(/*! ./augment */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/augment.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "augment", function() { return _augment__WEBPACK_IMPORTED_MODULE_80__["default"]; }); /* harmony import */ var _clone__WEBPACK_IMPORTED_MODULE_81__ = __webpack_require__(/*! ./clone */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/clone.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "clone", function() { return _clone__WEBPACK_IMPORTED_MODULE_81__["default"]; }); /* harmony import */ var _debounce__WEBPACK_IMPORTED_MODULE_82__ = __webpack_require__(/*! ./debounce */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/debounce.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "debounce", function() { return _debounce__WEBPACK_IMPORTED_MODULE_82__["default"]; }); /* harmony import */ var _memoize__WEBPACK_IMPORTED_MODULE_83__ = __webpack_require__(/*! ./memoize */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/memoize.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "memoize", function() { return _memoize__WEBPACK_IMPORTED_MODULE_83__["default"]; }); /* harmony import */ var _deep_mix__WEBPACK_IMPORTED_MODULE_84__ = __webpack_require__(/*! ./deep-mix */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/deep-mix.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "deepMix", function() { return _deep_mix__WEBPACK_IMPORTED_MODULE_84__["default"]; }); /* harmony import */ var _each__WEBPACK_IMPORTED_MODULE_85__ = __webpack_require__(/*! ./each */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/each.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "each", function() { return _each__WEBPACK_IMPORTED_MODULE_85__["default"]; }); /* harmony import */ var _extend__WEBPACK_IMPORTED_MODULE_86__ = __webpack_require__(/*! ./extend */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/extend.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "extend", function() { return _extend__WEBPACK_IMPORTED_MODULE_86__["default"]; }); /* harmony import */ var _index_of__WEBPACK_IMPORTED_MODULE_87__ = __webpack_require__(/*! ./index-of */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/index-of.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "indexOf", function() { return _index_of__WEBPACK_IMPORTED_MODULE_87__["default"]; }); /* harmony import */ var _is_empty__WEBPACK_IMPORTED_MODULE_88__ = __webpack_require__(/*! ./is-empty */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/is-empty.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "isEmpty", function() { return _is_empty__WEBPACK_IMPORTED_MODULE_88__["default"]; }); /* harmony import */ var _is_equal__WEBPACK_IMPORTED_MODULE_89__ = __webpack_require__(/*! ./is-equal */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/is-equal.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "isEqual", function() { return _is_equal__WEBPACK_IMPORTED_MODULE_89__["default"]; }); /* harmony import */ var _is_equal_with__WEBPACK_IMPORTED_MODULE_90__ = __webpack_require__(/*! ./is-equal-with */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/is-equal-with.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "isEqualWith", function() { return _is_equal_with__WEBPACK_IMPORTED_MODULE_90__["default"]; }); /* harmony import */ var _map__WEBPACK_IMPORTED_MODULE_91__ = __webpack_require__(/*! ./map */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/map.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "map", function() { return _map__WEBPACK_IMPORTED_MODULE_91__["default"]; }); /* harmony import */ var _map_values__WEBPACK_IMPORTED_MODULE_92__ = __webpack_require__(/*! ./map-values */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/map-values.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "mapValues", function() { return _map_values__WEBPACK_IMPORTED_MODULE_92__["default"]; }); /* harmony import */ var _mix__WEBPACK_IMPORTED_MODULE_93__ = __webpack_require__(/*! ./mix */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/mix.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "mix", function() { return _mix__WEBPACK_IMPORTED_MODULE_93__["default"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "assign", function() { return _mix__WEBPACK_IMPORTED_MODULE_93__["default"]; }); /* harmony import */ var _get__WEBPACK_IMPORTED_MODULE_94__ = __webpack_require__(/*! ./get */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/get.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "get", function() { return _get__WEBPACK_IMPORTED_MODULE_94__["default"]; }); /* harmony import */ var _set__WEBPACK_IMPORTED_MODULE_95__ = __webpack_require__(/*! ./set */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/set.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "set", function() { return _set__WEBPACK_IMPORTED_MODULE_95__["default"]; }); /* harmony import */ var _pick__WEBPACK_IMPORTED_MODULE_96__ = __webpack_require__(/*! ./pick */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/pick.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "pick", function() { return _pick__WEBPACK_IMPORTED_MODULE_96__["default"]; }); /* harmony import */ var _throttle__WEBPACK_IMPORTED_MODULE_97__ = __webpack_require__(/*! ./throttle */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/throttle.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "throttle", function() { return _throttle__WEBPACK_IMPORTED_MODULE_97__["default"]; }); /* harmony import */ var _to_array__WEBPACK_IMPORTED_MODULE_98__ = __webpack_require__(/*! ./to-array */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/to-array.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "toArray", function() { return _to_array__WEBPACK_IMPORTED_MODULE_98__["default"]; }); /* harmony import */ var _to_string__WEBPACK_IMPORTED_MODULE_99__ = __webpack_require__(/*! ./to-string */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/to-string.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "toString", function() { return _to_string__WEBPACK_IMPORTED_MODULE_99__["default"]; }); /* harmony import */ var _unique_id__WEBPACK_IMPORTED_MODULE_100__ = __webpack_require__(/*! ./unique-id */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/unique-id.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "uniqueId", function() { return _unique_id__WEBPACK_IMPORTED_MODULE_100__["default"]; }); /* harmony import */ var _noop__WEBPACK_IMPORTED_MODULE_101__ = __webpack_require__(/*! ./noop */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/noop.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "noop", function() { return _noop__WEBPACK_IMPORTED_MODULE_101__["default"]; }); /* harmony import */ var _identity__WEBPACK_IMPORTED_MODULE_102__ = __webpack_require__(/*! ./identity */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/identity.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "identity", function() { return _identity__WEBPACK_IMPORTED_MODULE_102__["default"]; }); /* harmony import */ var _size__WEBPACK_IMPORTED_MODULE_103__ = __webpack_require__(/*! ./size */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/size.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "size", function() { return _size__WEBPACK_IMPORTED_MODULE_103__["default"]; }); /* harmony import */ var _cache__WEBPACK_IMPORTED_MODULE_104__ = __webpack_require__(/*! ./cache */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/cache.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Cache", function() { return _cache__WEBPACK_IMPORTED_MODULE_104__["default"]; }); // array // event // format // math // object // string // type // other // 不知道为什么,需要把这个 export,不然 ts 会报类型错误 /***/ }), /***/ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/is-arguments.js": /*!***********************************************************************!*\ !*** ./node_modules/_@antv_util@2.0.9@@antv/util/esm/is-arguments.js ***! \***********************************************************************/ /*! exports provided: default */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony import */ var _is_type__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./is-type */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/is-type.js"); /** * 是否是参数类型 * * @param {Object} value 测试的值 * @return {Boolean} */ var isArguments = function (value) { return Object(_is_type__WEBPACK_IMPORTED_MODULE_0__["default"])(value, 'Arguments'); }; /* harmony default export */ __webpack_exports__["default"] = (isArguments); /***/ }), /***/ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/is-array-like.js": /*!************************************************************************!*\ !*** ./node_modules/_@antv_util@2.0.9@@antv/util/esm/is-array-like.js ***! \************************************************************************/ /*! exports provided: default */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); var isArrayLike = function (value) { /** * isArrayLike([1, 2, 3]) => true * isArrayLike(document.body.children) => true * isArrayLike('abc') => true * isArrayLike(Function) => false */ return value !== null && typeof value !== 'function' && isFinite(value.length); }; /* harmony default export */ __webpack_exports__["default"] = (isArrayLike); /***/ }), /***/ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/is-array.js": /*!*******************************************************************!*\ !*** ./node_modules/_@antv_util@2.0.9@@antv/util/esm/is-array.js ***! \*******************************************************************/ /*! exports provided: default */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony import */ var _is_type__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./is-type */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/is-type.js"); /* harmony default export */ __webpack_exports__["default"] = (function (value) { return Array.isArray ? Array.isArray(value) : Object(_is_type__WEBPACK_IMPORTED_MODULE_0__["default"])(value, 'Array'); }); /***/ }), /***/ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/is-boolean.js": /*!*********************************************************************!*\ !*** ./node_modules/_@antv_util@2.0.9@@antv/util/esm/is-boolean.js ***! \*********************************************************************/ /*! exports provided: default */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony import */ var _is_type__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./is-type */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/is-type.js"); /** * 是否是布尔类型 * * @param {Object} value 测试的值 * @return {Boolean} */ var isBoolean = function (value) { return Object(_is_type__WEBPACK_IMPORTED_MODULE_0__["default"])(value, 'Boolean'); }; /* harmony default export */ __webpack_exports__["default"] = (isBoolean); /***/ }), /***/ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/is-date.js": /*!******************************************************************!*\ !*** ./node_modules/_@antv_util@2.0.9@@antv/util/esm/is-date.js ***! \******************************************************************/ /*! exports provided: default */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony import */ var _is_type__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./is-type */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/is-type.js"); var isDate = function (value) { return Object(_is_type__WEBPACK_IMPORTED_MODULE_0__["default"])(value, 'Date'); }; /* harmony default export */ __webpack_exports__["default"] = (isDate); /***/ }), /***/ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/is-decimal.js": /*!*********************************************************************!*\ !*** ./node_modules/_@antv_util@2.0.9@@antv/util/esm/is-decimal.js ***! \*********************************************************************/ /*! exports provided: default */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony import */ var _is_number__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./is-number */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/is-number.js"); var isDecimal = function (num) { return Object(_is_number__WEBPACK_IMPORTED_MODULE_0__["default"])(num) && num % 1 !== 0; }; /* harmony default export */ __webpack_exports__["default"] = (isDecimal); /***/ }), /***/ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/is-element.js": /*!*********************************************************************!*\ !*** ./node_modules/_@antv_util@2.0.9@@antv/util/esm/is-element.js ***! \*********************************************************************/ /*! exports provided: default */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /** * 判断是否HTML元素 * @return {Boolean} 是否HTML元素 */ var isElement = function (o) { return o instanceof Element || o instanceof HTMLDocument; }; /* harmony default export */ __webpack_exports__["default"] = (isElement); /***/ }), /***/ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/is-empty.js": /*!*******************************************************************!*\ !*** ./node_modules/_@antv_util@2.0.9@@antv/util/esm/is-empty.js ***! \*******************************************************************/ /*! exports provided: default */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony import */ var _is_nil__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./is-nil */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/is-nil.js"); /* harmony import */ var _is_array_like__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./is-array-like */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/is-array-like.js"); /* harmony import */ var _get_type__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./get-type */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/get-type.js"); /* harmony import */ var _is_prototype__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./is-prototype */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/is-prototype.js"); var hasOwnProperty = Object.prototype.hasOwnProperty; function isEmpty(value) { /** * isEmpty(null) => true * isEmpty() => true * isEmpty(true) => true * isEmpty(1) => true * isEmpty([1, 2, 3]) => false * isEmpty('abc') => false * isEmpty({ a: 1 }) => false */ if (Object(_is_nil__WEBPACK_IMPORTED_MODULE_0__["default"])(value)) { return true; } if (Object(_is_array_like__WEBPACK_IMPORTED_MODULE_1__["default"])(value)) { return !value.length; } var type = Object(_get_type__WEBPACK_IMPORTED_MODULE_2__["default"])(value); if (type === 'Map' || type === 'Set') { return !value.size; } if (Object(_is_prototype__WEBPACK_IMPORTED_MODULE_3__["default"])(value)) { return !Object.keys(value).length; } for (var key in value) { if (hasOwnProperty.call(value, key)) { return false; } } return true; } /* harmony default export */ __webpack_exports__["default"] = (isEmpty); /***/ }), /***/ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/is-equal-with.js": /*!************************************************************************!*\ !*** ./node_modules/_@antv_util@2.0.9@@antv/util/esm/is-equal-with.js ***! \************************************************************************/ /*! exports provided: default */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony import */ var _is_function__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./is-function */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/is-function.js"); /* harmony import */ var _is_equal__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./is-equal */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/is-equal.js"); /** * @param {*} value The value to compare. * @param {*} other The other value to compare. * @param {Function} [fn] The function to customize comparisons. * @returns {boolean} Returns `true` if the values are equivalent, else `false`. * @example * * function isGreeting(value) { * return /^h(?:i|ello)$/.test(value); * } * * function customizer(objValue, othValue) { * if (isGreeting(objValue) && isGreeting(othValue)) { * return true; * } * } * * var array = ['hello', 'goodbye']; * var other = ['hi', 'goodbye']; * * isEqualWith(array, other, customizer); // => true */ /* harmony default export */ __webpack_exports__["default"] = (function (value, other, fn) { if (!Object(_is_function__WEBPACK_IMPORTED_MODULE_0__["default"])(fn)) { return Object(_is_equal__WEBPACK_IMPORTED_MODULE_1__["default"])(value, other); } return !!fn(value, other); }); /***/ }), /***/ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/is-equal.js": /*!*******************************************************************!*\ !*** ./node_modules/_@antv_util@2.0.9@@antv/util/esm/is-equal.js ***! \*******************************************************************/ /*! exports provided: default */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony import */ var _is_object_like__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./is-object-like */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/is-object-like.js"); /* harmony import */ var _is_array_like__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./is-array-like */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/is-array-like.js"); /* harmony import */ var _is_string__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./is-string */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/is-string.js"); var isEqual = function (value, other) { if (value === other) { return true; } if (!value || !other) { return false; } if (Object(_is_string__WEBPACK_IMPORTED_MODULE_2__["default"])(value) || Object(_is_string__WEBPACK_IMPORTED_MODULE_2__["default"])(other)) { return false; } if (Object(_is_array_like__WEBPACK_IMPORTED_MODULE_1__["default"])(value) || Object(_is_array_like__WEBPACK_IMPORTED_MODULE_1__["default"])(other)) { if (value.length !== other.length) { return false; } var rst = true; for (var i = 0; i < value.length; i++) { rst = isEqual(value[i], other[i]); if (!rst) { break; } } return rst; } if (Object(_is_object_like__WEBPACK_IMPORTED_MODULE_0__["default"])(value) || Object(_is_object_like__WEBPACK_IMPORTED_MODULE_0__["default"])(other)) { var valueKeys = Object.keys(value); var otherKeys = Object.keys(other); if (valueKeys.length !== otherKeys.length) { return false; } var rst = true; for (var i = 0; i < valueKeys.length; i++) { rst = isEqual(value[valueKeys[i]], other[valueKeys[i]]); if (!rst) { break; } } return rst; } return false; }; /* harmony default export */ __webpack_exports__["default"] = (isEqual); /***/ }), /***/ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/is-error.js": /*!*******************************************************************!*\ !*** ./node_modules/_@antv_util@2.0.9@@antv/util/esm/is-error.js ***! \*******************************************************************/ /*! exports provided: default */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony import */ var _is_type__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./is-type */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/is-type.js"); /** * 是否是参数类型 * * @param {Object} value 测试的值 * @return {Boolean} */ var isError = function (value) { return Object(_is_type__WEBPACK_IMPORTED_MODULE_0__["default"])(value, 'Error'); }; /* harmony default export */ __webpack_exports__["default"] = (isError); /***/ }), /***/ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/is-even.js": /*!******************************************************************!*\ !*** ./node_modules/_@antv_util@2.0.9@@antv/util/esm/is-even.js ***! \******************************************************************/ /*! exports provided: default */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony import */ var _is_number__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./is-number */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/is-number.js"); var isEven = function (num) { return Object(_is_number__WEBPACK_IMPORTED_MODULE_0__["default"])(num) && num % 2 === 0; }; /* harmony default export */ __webpack_exports__["default"] = (isEven); /***/ }), /***/ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/is-finite.js": /*!********************************************************************!*\ !*** ./node_modules/_@antv_util@2.0.9@@antv/util/esm/is-finite.js ***! \********************************************************************/ /*! exports provided: default */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony import */ var _is_number__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./is-number */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/is-number.js"); /** * 判断是否为有限数 * @return {Boolean} */ /* harmony default export */ __webpack_exports__["default"] = (function (value) { return Object(_is_number__WEBPACK_IMPORTED_MODULE_0__["default"])(value) && isFinite(value); }); /***/ }), /***/ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/is-function.js": /*!**********************************************************************!*\ !*** ./node_modules/_@antv_util@2.0.9@@antv/util/esm/is-function.js ***! \**********************************************************************/ /*! exports provided: default */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony import */ var _is_type__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./is-type */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/is-type.js"); /** * 是否为函数 * @param {*} fn 对象 * @return {Boolean} 是否函数 */ /* harmony default export */ __webpack_exports__["default"] = (function (value) { return Object(_is_type__WEBPACK_IMPORTED_MODULE_0__["default"])(value, 'Function'); }); /***/ }), /***/ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/is-integer.js": /*!*********************************************************************!*\ !*** ./node_modules/_@antv_util@2.0.9@@antv/util/esm/is-integer.js ***! \*********************************************************************/ /*! exports provided: default */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony import */ var _is_number__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./is-number */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/is-number.js"); var isInteger = Number.isInteger ? Number.isInteger : function (num) { return Object(_is_number__WEBPACK_IMPORTED_MODULE_0__["default"])(num) && num % 1 === 0; }; /* harmony default export */ __webpack_exports__["default"] = (isInteger); /***/ }), /***/ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/is-match.js": /*!*******************************************************************!*\ !*** ./node_modules/_@antv_util@2.0.9@@antv/util/esm/is-match.js ***! \*******************************************************************/ /*! exports provided: default */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony import */ var _is_nil__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./is-nil */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/is-nil.js"); /* harmony import */ var _keys__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./keys */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/keys.js"); function isMatch(obj, attrs) { var _keys = Object(_keys__WEBPACK_IMPORTED_MODULE_1__["default"])(attrs); var length = _keys.length; if (Object(_is_nil__WEBPACK_IMPORTED_MODULE_0__["default"])(obj)) return !length; for (var i = 0; i < length; i += 1) { var key = _keys[i]; if (attrs[key] !== obj[key] || !(key in obj)) { return false; } } return true; } /* harmony default export */ __webpack_exports__["default"] = (isMatch); /***/ }), /***/ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/is-negative.js": /*!**********************************************************************!*\ !*** ./node_modules/_@antv_util@2.0.9@@antv/util/esm/is-negative.js ***! \**********************************************************************/ /*! exports provided: default */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony import */ var _is_number__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./is-number */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/is-number.js"); var isNegative = function (num) { return Object(_is_number__WEBPACK_IMPORTED_MODULE_0__["default"])(num) && num < 0; }; /* harmony default export */ __webpack_exports__["default"] = (isNegative); /***/ }), /***/ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/is-nil.js": /*!*****************************************************************!*\ !*** ./node_modules/_@antv_util@2.0.9@@antv/util/esm/is-nil.js ***! \*****************************************************************/ /*! exports provided: default */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); // isFinite, var isNil = function (value) { /** * isNil(null) => true * isNil() => true */ return value === null || value === undefined; }; /* harmony default export */ __webpack_exports__["default"] = (isNil); /***/ }), /***/ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/is-null.js": /*!******************************************************************!*\ !*** ./node_modules/_@antv_util@2.0.9@@antv/util/esm/is-null.js ***! \******************************************************************/ /*! exports provided: default */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); var isNull = function (value) { return value === null; }; /* harmony default export */ __webpack_exports__["default"] = (isNull); /***/ }), /***/ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/is-number-equal.js": /*!**************************************************************************!*\ !*** ./node_modules/_@antv_util@2.0.9@@antv/util/esm/is-number-equal.js ***! \**************************************************************************/ /*! exports provided: default */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return isNumberEqual; }); var PRECISION = 0.00001; // numbers less than this is considered as 0 function isNumberEqual(a, b, precision) { if (precision === void 0) { precision = PRECISION; } return Math.abs(a - b) < precision; } ; /***/ }), /***/ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/is-number.js": /*!********************************************************************!*\ !*** ./node_modules/_@antv_util@2.0.9@@antv/util/esm/is-number.js ***! \********************************************************************/ /*! exports provided: default */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony import */ var _is_type__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./is-type */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/is-type.js"); /** * 判断是否数字 * @return {Boolean} 是否数字 */ var isNumber = function (value) { return Object(_is_type__WEBPACK_IMPORTED_MODULE_0__["default"])(value, 'Number'); }; /* harmony default export */ __webpack_exports__["default"] = (isNumber); /***/ }), /***/ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/is-object-like.js": /*!*************************************************************************!*\ !*** ./node_modules/_@antv_util@2.0.9@@antv/util/esm/is-object-like.js ***! \*************************************************************************/ /*! exports provided: default */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); var isObjectLike = function (value) { /** * isObjectLike({}) => true * isObjectLike([1, 2, 3]) => true * isObjectLike(Function) => false * isObjectLike(null) => false */ return typeof value === 'object' && value !== null; }; /* harmony default export */ __webpack_exports__["default"] = (isObjectLike); /***/ }), /***/ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/is-object.js": /*!********************************************************************!*\ !*** ./node_modules/_@antv_util@2.0.9@@antv/util/esm/is-object.js ***! \********************************************************************/ /*! exports provided: default */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony default export */ __webpack_exports__["default"] = (function (value) { /** * isObject({}) => true * isObject([1, 2, 3]) => true * isObject(Function) => true * isObject(null) => false */ var type = typeof value; return value !== null && type === 'object' || type === 'function'; }); /***/ }), /***/ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/is-odd.js": /*!*****************************************************************!*\ !*** ./node_modules/_@antv_util@2.0.9@@antv/util/esm/is-odd.js ***! \*****************************************************************/ /*! exports provided: default */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony import */ var _is_number__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./is-number */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/is-number.js"); var isOdd = function (num) { return Object(_is_number__WEBPACK_IMPORTED_MODULE_0__["default"])(num) && num % 2 !== 0; }; /* harmony default export */ __webpack_exports__["default"] = (isOdd); /***/ }), /***/ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/is-plain-object.js": /*!**************************************************************************!*\ !*** ./node_modules/_@antv_util@2.0.9@@antv/util/esm/is-plain-object.js ***! \**************************************************************************/ /*! exports provided: default */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony import */ var _is_object_like__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./is-object-like */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/is-object-like.js"); /* harmony import */ var _is_type__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./is-type */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/is-type.js"); var isPlainObject = function (value) { /** * isObjectLike(new Foo) => false * isObjectLike([1, 2, 3]) => false * isObjectLike({ x: 0, y: 0 }) => true * isObjectLike(Object.create(null)) => true */ if (!Object(_is_object_like__WEBPACK_IMPORTED_MODULE_0__["default"])(value) || !Object(_is_type__WEBPACK_IMPORTED_MODULE_1__["default"])(value, 'Object')) { return false; } if (Object.getPrototypeOf(value) === null) { return true; } var proto = value; while (Object.getPrototypeOf(proto) !== null) { proto = Object.getPrototypeOf(proto); } return Object.getPrototypeOf(value) === proto; }; /* harmony default export */ __webpack_exports__["default"] = (isPlainObject); /***/ }), /***/ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/is-positive.js": /*!**********************************************************************!*\ !*** ./node_modules/_@antv_util@2.0.9@@antv/util/esm/is-positive.js ***! \**********************************************************************/ /*! exports provided: default */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony import */ var _is_number__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./is-number */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/is-number.js"); var isPositive = function (num) { return Object(_is_number__WEBPACK_IMPORTED_MODULE_0__["default"])(num) && num > 0; }; /* harmony default export */ __webpack_exports__["default"] = (isPositive); /***/ }), /***/ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/is-prototype.js": /*!***********************************************************************!*\ !*** ./node_modules/_@antv_util@2.0.9@@antv/util/esm/is-prototype.js ***! \***********************************************************************/ /*! exports provided: default */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); var objectProto = Object.prototype; var isPrototype = function (value) { var Ctor = value && value.constructor; var proto = typeof Ctor === 'function' && Ctor.prototype || objectProto; return value === proto; }; /* harmony default export */ __webpack_exports__["default"] = (isPrototype); /***/ }), /***/ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/is-reg-exp.js": /*!*********************************************************************!*\ !*** ./node_modules/_@antv_util@2.0.9@@antv/util/esm/is-reg-exp.js ***! \*********************************************************************/ /*! exports provided: default */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony import */ var _is_type__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./is-type */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/is-type.js"); var isRegExp = function (str) { return Object(_is_type__WEBPACK_IMPORTED_MODULE_0__["default"])(str, 'RegExp'); }; /* harmony default export */ __webpack_exports__["default"] = (isRegExp); /***/ }), /***/ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/is-string.js": /*!********************************************************************!*\ !*** ./node_modules/_@antv_util@2.0.9@@antv/util/esm/is-string.js ***! \********************************************************************/ /*! exports provided: default */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony import */ var _is_type__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./is-type */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/is-type.js"); /* harmony default export */ __webpack_exports__["default"] = (function (str) { return Object(_is_type__WEBPACK_IMPORTED_MODULE_0__["default"])(str, 'String'); }); /***/ }), /***/ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/is-type.js": /*!******************************************************************!*\ !*** ./node_modules/_@antv_util@2.0.9@@antv/util/esm/is-type.js ***! \******************************************************************/ /*! exports provided: default */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); var toString = {}.toString; var isType = function (value, type) { return toString.call(value) === '[object ' + type + ']'; }; /* harmony default export */ __webpack_exports__["default"] = (isType); /***/ }), /***/ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/is-undefined.js": /*!***********************************************************************!*\ !*** ./node_modules/_@antv_util@2.0.9@@antv/util/esm/is-undefined.js ***! \***********************************************************************/ /*! exports provided: default */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); var isUndefined = function (value) { return value === undefined; }; /* harmony default export */ __webpack_exports__["default"] = (isUndefined); /***/ }), /***/ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/keys.js": /*!***************************************************************!*\ !*** ./node_modules/_@antv_util@2.0.9@@antv/util/esm/keys.js ***! \***************************************************************/ /*! exports provided: default */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony import */ var _each__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./each */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/each.js"); /* harmony import */ var _is_function__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./is-function */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/is-function.js"); var keys = Object.keys ? function (obj) { return Object.keys(obj); } : function (obj) { var result = []; Object(_each__WEBPACK_IMPORTED_MODULE_0__["default"])(obj, function (value, key) { if (!(Object(_is_function__WEBPACK_IMPORTED_MODULE_1__["default"])(obj) && key === 'prototype')) { result.push(key); } }); return result; }; /* harmony default export */ __webpack_exports__["default"] = (keys); /***/ }), /***/ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/last.js": /*!***************************************************************!*\ !*** ./node_modules/_@antv_util@2.0.9@@antv/util/esm/last.js ***! \***************************************************************/ /*! exports provided: default */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return last; }); /* harmony import */ var _is_array_like__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./is-array-like */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/is-array-like.js"); function last(o) { if (Object(_is_array_like__WEBPACK_IMPORTED_MODULE_0__["default"])(o)) { var arr = o; return arr[arr.length - 1]; } return undefined; } /***/ }), /***/ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/lower-case.js": /*!*********************************************************************!*\ !*** ./node_modules/_@antv_util@2.0.9@@antv/util/esm/lower-case.js ***! \*********************************************************************/ /*! exports provided: default */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony import */ var _to_string__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./to-string */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/to-string.js"); var lowerCase = function (str) { return Object(_to_string__WEBPACK_IMPORTED_MODULE_0__["default"])(str).toLowerCase(); }; /* harmony default export */ __webpack_exports__["default"] = (lowerCase); /***/ }), /***/ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/lower-first.js": /*!**********************************************************************!*\ !*** ./node_modules/_@antv_util@2.0.9@@antv/util/esm/lower-first.js ***! \**********************************************************************/ /*! exports provided: default */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony import */ var _to_string__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./to-string */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/to-string.js"); var lowerFirst = function (value) { var str = Object(_to_string__WEBPACK_IMPORTED_MODULE_0__["default"])(value); return str.charAt(0).toLowerCase() + str.substring(1); }; /* harmony default export */ __webpack_exports__["default"] = (lowerFirst); /***/ }), /***/ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/map-values.js": /*!*********************************************************************!*\ !*** ./node_modules/_@antv_util@2.0.9@@antv/util/esm/map-values.js ***! \*********************************************************************/ /*! exports provided: default */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony import */ var _is_nil__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./is-nil */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/is-nil.js"); /* harmony import */ var _is_object__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./is-object */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/is-object.js"); var identity = function (v) { return v; }; /* harmony default export */ __webpack_exports__["default"] = (function (object, func) { if (func === void 0) { func = identity; } var r = {}; if (Object(_is_object__WEBPACK_IMPORTED_MODULE_1__["default"])(object) && !Object(_is_nil__WEBPACK_IMPORTED_MODULE_0__["default"])(object)) { Object.keys(object).forEach(function (key) { // @ts-ignore r[key] = func(object[key], key); }); } return r; }); /***/ }), /***/ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/map.js": /*!**************************************************************!*\ !*** ./node_modules/_@antv_util@2.0.9@@antv/util/esm/map.js ***! \**************************************************************/ /*! exports provided: default */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony import */ var _is_array_like__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./is-array-like */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/is-array-like.js"); var map = function (arr, func) { if (!Object(_is_array_like__WEBPACK_IMPORTED_MODULE_0__["default"])(arr)) { // @ts-ignore return arr; } var result = []; for (var index = 0; index < arr.length; index++) { var value = arr[index]; result.push(func(value, index)); } return result; }; /* harmony default export */ __webpack_exports__["default"] = (map); /***/ }), /***/ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/max-by.js": /*!*****************************************************************!*\ !*** ./node_modules/_@antv_util@2.0.9@@antv/util/esm/max-by.js ***! \*****************************************************************/ /*! exports provided: default */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony import */ var _each__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./each */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/each.js"); /* harmony import */ var _is_array__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./is-array */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/is-array.js"); /* harmony import */ var _is_function__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./is-function */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/is-function.js"); /** * @param {Array} arr The array to iterate over. * @param {Function} [fn] The iteratee invoked per element. * @return {*} Returns the maximum value. * @example * * var objects = [{ 'n': 1 }, { 'n': 2 }]; * * maxBy(objects, function(o) { return o.n; }); * // => { 'n': 2 } * * maxBy(objects, 'n'); * // => { 'n': 2 } */ /* harmony default export */ __webpack_exports__["default"] = (function (arr, fn) { if (!Object(_is_array__WEBPACK_IMPORTED_MODULE_1__["default"])(arr)) { return undefined; } var max = arr[0]; var maxData; if (Object(_is_function__WEBPACK_IMPORTED_MODULE_2__["default"])(fn)) { maxData = fn(arr[0]); } else { maxData = arr[0][fn]; } var data; Object(_each__WEBPACK_IMPORTED_MODULE_0__["default"])(arr, function (val) { if (Object(_is_function__WEBPACK_IMPORTED_MODULE_2__["default"])(fn)) { data = fn(val); } else { data = val[fn]; } if (data > maxData) { max = val; maxData = data; } }); return max; }); /***/ }), /***/ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/memoize.js": /*!******************************************************************!*\ !*** ./node_modules/_@antv_util@2.0.9@@antv/util/esm/memoize.js ***! \******************************************************************/ /*! exports provided: default */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony import */ var _is_function__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./is-function */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/is-function.js"); /** * _.memoize(calColor); * _.memoize(calColor, (...args) => args[0]); * @param f * @param resolver */ /* harmony default export */ __webpack_exports__["default"] = (function (f, resolver) { if (!Object(_is_function__WEBPACK_IMPORTED_MODULE_0__["default"])(f)) { throw new TypeError('Expected a function'); } var memoized = function () { var args = []; for (var _i = 0; _i < arguments.length; _i++) { args[_i] = arguments[_i]; } // 使用方法构造 key,如果不存在 resolver,则直接取第一个参数作为 key var key = resolver ? resolver.apply(this, args) : args[0]; var cache = memoized.cache; if (cache.has(key)) { return cache.get(key); } var result = f.apply(this, args); // 缓存起来 cache.set(key, result); return result; }; memoized.cache = new Map(); return memoized; }); /***/ }), /***/ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/min-by.js": /*!*****************************************************************!*\ !*** ./node_modules/_@antv_util@2.0.9@@antv/util/esm/min-by.js ***! \*****************************************************************/ /*! exports provided: default */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony import */ var _each__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./each */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/each.js"); /* harmony import */ var _is_array__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./is-array */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/is-array.js"); /* harmony import */ var _is_function__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./is-function */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/is-function.js"); /** * @param {Array} arr The array to iterate over. * @param {Function} [fn] The iteratee invoked per element. * @return {*} Returns the minimum value. * @example * * var objects = [{ 'n': 1 }, { 'n': 2 }]; * * minBy(objects, function(o) { return o.n; }); * // => { 'n': 1 } * * minBy(objects, 'n'); * // => { 'n': 1 } */ /* harmony default export */ __webpack_exports__["default"] = (function (arr, fn) { if (!Object(_is_array__WEBPACK_IMPORTED_MODULE_1__["default"])(arr)) { return undefined; } var min = arr[0]; var minData; if (Object(_is_function__WEBPACK_IMPORTED_MODULE_2__["default"])(fn)) { minData = fn(arr[0]); } else { minData = arr[0][fn]; } var data; Object(_each__WEBPACK_IMPORTED_MODULE_0__["default"])(arr, function (val) { if (Object(_is_function__WEBPACK_IMPORTED_MODULE_2__["default"])(fn)) { data = fn(val); } else { data = val[fn]; } if (data < minData) { min = val; minData = data; } }); return min; }); /***/ }), /***/ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/mix.js": /*!**************************************************************!*\ !*** ./node_modules/_@antv_util@2.0.9@@antv/util/esm/mix.js ***! \**************************************************************/ /*! exports provided: default */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return mix; }); // FIXME: Mutable param should be forbidden in static lang. function _mix(dist, obj) { for (var key in obj) { if (obj.hasOwnProperty(key) && key !== 'constructor' && obj[key] !== undefined) { dist[key] = obj[key]; } } } function mix(dist, src1, src2, src3) { if (src1) _mix(dist, src1); if (src2) _mix(dist, src2); if (src3) _mix(dist, src3); return dist; } /***/ }), /***/ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/mod.js": /*!**************************************************************!*\ !*** ./node_modules/_@antv_util@2.0.9@@antv/util/esm/mod.js ***! \**************************************************************/ /*! exports provided: default */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); var mod = function (n, m) { return (n % m + m) % m; }; /* harmony default export */ __webpack_exports__["default"] = (mod); /***/ }), /***/ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/noop.js": /*!***************************************************************!*\ !*** ./node_modules/_@antv_util@2.0.9@@antv/util/esm/noop.js ***! \***************************************************************/ /*! exports provided: default */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony default export */ __webpack_exports__["default"] = (function () {}); /***/ }), /***/ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/number2color.js": /*!***********************************************************************!*\ !*** ./node_modules/_@antv_util@2.0.9@@antv/util/esm/number2color.js ***! \***********************************************************************/ /*! exports provided: default */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); var numColorCache = {}; function numberToColor(num) { // 增加缓存 var color = numColorCache[num]; if (!color) { var str = num.toString(16); for (var i = str.length; i < 6; i++) { str = '0' + str; } color = '#' + str; numColorCache[num] = color; } return color; } /* harmony default export */ __webpack_exports__["default"] = (numberToColor); /***/ }), /***/ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/parse-radius.js": /*!***********************************************************************!*\ !*** ./node_modules/_@antv_util@2.0.9@@antv/util/esm/parse-radius.js ***! \***********************************************************************/ /*! exports provided: default */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony import */ var _is_array__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./is-array */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/is-array.js"); function parseRadius(radius) { var r1 = 0, r2 = 0, r3 = 0, r4 = 0; if (Object(_is_array__WEBPACK_IMPORTED_MODULE_0__["default"])(radius)) { if (radius.length === 1) { r1 = r2 = r3 = r4 = radius[0]; } else if (radius.length === 2) { r1 = r3 = radius[0]; r2 = r4 = radius[1]; } else if (radius.length === 3) { r1 = radius[0]; r2 = r4 = radius[1]; r3 = radius[2]; } else { r1 = radius[0]; r2 = radius[1]; r3 = radius[2]; r4 = radius[3]; } } else { r1 = r2 = r3 = r4 = radius; } return { r1: r1, r2: r2, r3: r3, r4: r4 }; } /* harmony default export */ __webpack_exports__["default"] = (parseRadius); /***/ }), /***/ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/pick.js": /*!***************************************************************!*\ !*** ./node_modules/_@antv_util@2.0.9@@antv/util/esm/pick.js ***! \***************************************************************/ /*! exports provided: default */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony import */ var _each__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./each */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/each.js"); /* harmony import */ var _is_plain_object__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./is-plain-object */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/is-plain-object.js"); var hasOwnProperty = Object.prototype.hasOwnProperty; /* harmony default export */ __webpack_exports__["default"] = (function (object, keys) { if (object === null || !Object(_is_plain_object__WEBPACK_IMPORTED_MODULE_1__["default"])(object)) { return {}; } var result = {}; Object(_each__WEBPACK_IMPORTED_MODULE_0__["default"])(keys, function (key) { if (hasOwnProperty.call(object, key)) { result[key] = object[key]; } }); return result; }); /***/ }), /***/ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/pull-at.js": /*!******************************************************************!*\ !*** ./node_modules/_@antv_util@2.0.9@@antv/util/esm/pull-at.js ***! \******************************************************************/ /*! exports provided: default */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony import */ var _is_array_like__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./is-array-like */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/is-array-like.js"); var splice = Array.prototype.splice; var pullAt = function pullAt(arr, indexes) { if (!Object(_is_array_like__WEBPACK_IMPORTED_MODULE_0__["default"])(arr)) { return []; } var length = arr ? indexes.length : 0; var last = length - 1; while (length--) { var previous = void 0; var index = indexes[length]; if (length === last || index !== previous) { previous = index; splice.call(arr, index, 1); } } return arr; }; /* harmony default export */ __webpack_exports__["default"] = (pullAt); /***/ }), /***/ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/pull.js": /*!***************************************************************!*\ !*** ./node_modules/_@antv_util@2.0.9@@antv/util/esm/pull.js ***! \***************************************************************/ /*! exports provided: default */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); var arrPrototype = Array.prototype; var splice = arrPrototype.splice; var indexOf = arrPrototype.indexOf; var pull = function (arr) { var values = []; for (var _i = 1; _i < arguments.length; _i++) { values[_i - 1] = arguments[_i]; } for (var i = 0; i < values.length; i++) { var value = values[i]; var fromIndex = -1; while ((fromIndex = indexOf.call(arr, value)) > -1) { splice.call(arr, fromIndex, 1); } } return arr; }; /* harmony default export */ __webpack_exports__["default"] = (pull); /***/ }), /***/ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/reduce.js": /*!*****************************************************************!*\ !*** ./node_modules/_@antv_util@2.0.9@@antv/util/esm/reduce.js ***! \*****************************************************************/ /*! exports provided: default */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony import */ var _each__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./each */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/each.js"); /* harmony import */ var _is_array__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./is-array */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/is-array.js"); /* harmony import */ var _is_plain_object__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./is-plain-object */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/is-plain-object.js"); var reduce = function (arr, fn, init) { if (!Object(_is_array__WEBPACK_IMPORTED_MODULE_1__["default"])(arr) && !Object(_is_plain_object__WEBPACK_IMPORTED_MODULE_2__["default"])(arr)) { return arr; } var result = init; Object(_each__WEBPACK_IMPORTED_MODULE_0__["default"])(arr, function (data, i) { result = fn(result, data, i); }); return result; }; /* harmony default export */ __webpack_exports__["default"] = (reduce); /***/ }), /***/ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/remove.js": /*!*****************************************************************!*\ !*** ./node_modules/_@antv_util@2.0.9@@antv/util/esm/remove.js ***! \*****************************************************************/ /*! exports provided: default */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony import */ var _is_array_like__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./is-array-like */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/is-array-like.js"); /* harmony import */ var _pull_at__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./pull-at */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/pull-at.js"); var remove = function (arr, predicate) { /** * const arr = [1, 2, 3, 4] * const evens = remove(arr, n => n % 2 == 0) * console.log(arr) // => [1, 3] * console.log(evens) // => [2, 4] */ var result = []; if (!Object(_is_array_like__WEBPACK_IMPORTED_MODULE_0__["default"])(arr)) { return result; } var i = -1; var indexes = []; var length = arr.length; while (++i < length) { var value = arr[i]; if (predicate(value, i, arr)) { result.push(value); indexes.push(i); } } Object(_pull_at__WEBPACK_IMPORTED_MODULE_1__["default"])(arr, indexes); return result; }; /* harmony default export */ __webpack_exports__["default"] = (remove); /***/ }), /***/ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/request-animation-frame.js": /*!**********************************************************************************!*\ !*** ./node_modules/_@antv_util@2.0.9@@antv/util/esm/request-animation-frame.js ***! \**********************************************************************************/ /*! exports provided: default */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return requestAnimationFrame; }); function requestAnimationFrame(fn) { var method = window.requestAnimationFrame || window.webkitRequestAnimationFrame || // @ts-ignore window.mozRequestAnimationFrame || // @ts-ignore window.msRequestAnimationFrame || function (f) { return setTimeout(f, 16); }; return method(fn); } ; /***/ }), /***/ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/set.js": /*!**************************************************************!*\ !*** ./node_modules/_@antv_util@2.0.9@@antv/util/esm/set.js ***! \**************************************************************/ /*! exports provided: default */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony import */ var _is_object__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./is-object */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/is-object.js"); /* harmony import */ var _is_string__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./is-string */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/is-string.js"); /* harmony import */ var _is_number__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./is-number */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/is-number.js"); /** * https://github.com/developit/dlv/blob/master/index.js * @param obj * @param path * @param value */ /* harmony default export */ __webpack_exports__["default"] = (function (obj, path, value) { var o = obj; var keyArr = Object(_is_string__WEBPACK_IMPORTED_MODULE_1__["default"])(path) ? path.split('.') : path; keyArr.forEach(function (key, idx) { // 不是最后一个 if (idx < keyArr.length - 1) { if (!Object(_is_object__WEBPACK_IMPORTED_MODULE_0__["default"])(o[key])) { o[key] = Object(_is_number__WEBPACK_IMPORTED_MODULE_2__["default"])(keyArr[idx + 1]) ? [] : {}; } o = o[key]; } else { o[key] = value; } }); return obj; }); /***/ }), /***/ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/size.js": /*!***************************************************************!*\ !*** ./node_modules/_@antv_util@2.0.9@@antv/util/esm/size.js ***! \***************************************************************/ /*! exports provided: default */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return size; }); /* harmony import */ var _is_nil__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./is-nil */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/is-nil.js"); /* harmony import */ var _is_array_like__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./is-array-like */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/is-array-like.js"); function size(o) { if (Object(_is_nil__WEBPACK_IMPORTED_MODULE_0__["default"])(o)) { return 0; } if (Object(_is_array_like__WEBPACK_IMPORTED_MODULE_1__["default"])(o)) { return o.length; } return Object.keys(o).length; } /***/ }), /***/ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/some.js": /*!***************************************************************!*\ !*** ./node_modules/_@antv_util@2.0.9@@antv/util/esm/some.js ***! \***************************************************************/ /*! exports provided: default */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /** * 只要有一个满足条件就返回 true * @param arr * @param func */ var some = function (arr, func) { for (var i = 0; i < arr.length; i++) { if (func(arr[i], i)) return true; } return false; }; /* harmony default export */ __webpack_exports__["default"] = (some); /***/ }), /***/ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/sort-by.js": /*!******************************************************************!*\ !*** ./node_modules/_@antv_util@2.0.9@@antv/util/esm/sort-by.js ***! \******************************************************************/ /*! exports provided: default */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony import */ var _is_array__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./is-array */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/is-array.js"); /* harmony import */ var _is_string__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./is-string */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/is-string.js"); /* harmony import */ var _is_function__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./is-function */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/is-function.js"); function sortBy(arr, key) { var comparer; if (Object(_is_function__WEBPACK_IMPORTED_MODULE_2__["default"])(key)) { comparer = function (a, b) { return key(a) - key(b); }; } else { var keys_1 = []; if (Object(_is_string__WEBPACK_IMPORTED_MODULE_1__["default"])(key)) { keys_1.push(key); } else if (Object(_is_array__WEBPACK_IMPORTED_MODULE_0__["default"])(key)) { keys_1 = key; } comparer = function (a, b) { for (var i = 0; i < keys_1.length; i += 1) { var prop = keys_1[i]; if (a[prop] > b[prop]) { return 1; } if (a[prop] < b[prop]) { return -1; } } return 0; }; } arr.sort(comparer); return arr; } /* harmony default export */ __webpack_exports__["default"] = (sortBy); /***/ }), /***/ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/starts-with.js": /*!**********************************************************************!*\ !*** ./node_modules/_@antv_util@2.0.9@@antv/util/esm/starts-with.js ***! \**********************************************************************/ /*! exports provided: default */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony import */ var _is_array__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./is-array */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/is-array.js"); /* harmony import */ var _is_string__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./is-string */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/is-string.js"); function startsWith(arr, e) { return Object(_is_array__WEBPACK_IMPORTED_MODULE_0__["default"])(arr) || Object(_is_string__WEBPACK_IMPORTED_MODULE_1__["default"])(arr) ? arr[0] === e : false; } /* harmony default export */ __webpack_exports__["default"] = (startsWith); /***/ }), /***/ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/substitute.js": /*!*********************************************************************!*\ !*** ./node_modules/_@antv_util@2.0.9@@antv/util/esm/substitute.js ***! \*********************************************************************/ /*! exports provided: default */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); function substitute(str, o) { if (!str || !o) { return str; } return str.replace(/\\?\{([^{}]+)\}/g, function (match, name) { if (match.charAt(0) === '\\') { return match.slice(1); } return o[name] === undefined ? '' : o[name]; }); } /* harmony default export */ __webpack_exports__["default"] = (substitute); /***/ }), /***/ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/throttle.js": /*!*******************************************************************!*\ !*** ./node_modules/_@antv_util@2.0.9@@antv/util/esm/throttle.js ***! \*******************************************************************/ /*! exports provided: default */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony default export */ __webpack_exports__["default"] = (function (func, wait, options) { var timeout, context, args, result; var previous = 0; if (!options) options = {}; var later = function () { previous = options.leading === false ? 0 : Date.now(); timeout = null; result = func.apply(context, args); if (!timeout) context = args = null; }; var throttled = function () { var now = Date.now(); if (!previous && options.leading === false) previous = now; var remaining = wait - (now - previous); context = this; args = arguments; if (remaining <= 0 || remaining > wait) { if (timeout) { clearTimeout(timeout); timeout = null; } previous = now; result = func.apply(context, args); if (!timeout) context = args = null; } else if (!timeout && options.trailing !== false) { timeout = setTimeout(later, remaining); } return result; }; throttled.cancel = function () { clearTimeout(timeout); previous = 0; timeout = context = args = null; }; return throttled; }); /***/ }), /***/ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/to-array.js": /*!*******************************************************************!*\ !*** ./node_modules/_@antv_util@2.0.9@@antv/util/esm/to-array.js ***! \*******************************************************************/ /*! exports provided: default */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony import */ var _is_array_like__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./is-array-like */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/is-array-like.js"); /* harmony default export */ __webpack_exports__["default"] = (function (value) { return Object(_is_array_like__WEBPACK_IMPORTED_MODULE_0__["default"])(value) ? Array.prototype.slice.call(value) : []; }); /***/ }), /***/ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/to-degree.js": /*!********************************************************************!*\ !*** ./node_modules/_@antv_util@2.0.9@@antv/util/esm/to-degree.js ***! \********************************************************************/ /*! exports provided: default */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); var DEGREE = 180 / Math.PI; var toDegree = function (radian) { return DEGREE * radian; }; /* harmony default export */ __webpack_exports__["default"] = (toDegree); /***/ }), /***/ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/to-integer.js": /*!*********************************************************************!*\ !*** ./node_modules/_@antv_util@2.0.9@@antv/util/esm/to-integer.js ***! \*********************************************************************/ /*! exports provided: default */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony default export */ __webpack_exports__["default"] = (parseInt); /***/ }), /***/ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/to-radian.js": /*!********************************************************************!*\ !*** ./node_modules/_@antv_util@2.0.9@@antv/util/esm/to-radian.js ***! \********************************************************************/ /*! exports provided: default */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); var RADIAN = Math.PI / 180; var toRadian = function (degree) { return RADIAN * degree; }; /* harmony default export */ __webpack_exports__["default"] = (toRadian); /***/ }), /***/ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/to-string.js": /*!********************************************************************!*\ !*** ./node_modules/_@antv_util@2.0.9@@antv/util/esm/to-string.js ***! \********************************************************************/ /*! exports provided: default */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony import */ var _is_nil__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./is-nil */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/is-nil.js"); /* harmony default export */ __webpack_exports__["default"] = (function (value) { if (Object(_is_nil__WEBPACK_IMPORTED_MODULE_0__["default"])(value)) return ''; return value.toString(); }); /***/ }), /***/ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/union.js": /*!****************************************************************!*\ !*** ./node_modules/_@antv_util@2.0.9@@antv/util/esm/union.js ***! \****************************************************************/ /*! exports provided: default */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony import */ var _uniq__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./uniq */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/uniq.js"); var union = function () { var sources = []; for (var _i = 0; _i < arguments.length; _i++) { sources[_i] = arguments[_i]; } return Object(_uniq__WEBPACK_IMPORTED_MODULE_0__["default"])([].concat.apply([], sources)); }; /* harmony default export */ __webpack_exports__["default"] = (union); /***/ }), /***/ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/uniq.js": /*!***************************************************************!*\ !*** ./node_modules/_@antv_util@2.0.9@@antv/util/esm/uniq.js ***! \***************************************************************/ /*! exports provided: default */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony import */ var _contains__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./contains */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/contains.js"); /* harmony import */ var _each__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./each */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/each.js"); var uniq = function (arr) { var resultArr = []; Object(_each__WEBPACK_IMPORTED_MODULE_1__["default"])(arr, function (item) { if (!Object(_contains__WEBPACK_IMPORTED_MODULE_0__["default"])(resultArr, item)) { resultArr.push(item); } }); return resultArr; }; /* harmony default export */ __webpack_exports__["default"] = (uniq); /***/ }), /***/ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/unique-id.js": /*!********************************************************************!*\ !*** ./node_modules/_@antv_util@2.0.9@@antv/util/esm/unique-id.js ***! \********************************************************************/ /*! exports provided: default */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); var map = {}; /* harmony default export */ __webpack_exports__["default"] = (function (prefix) { prefix = prefix || 'g'; if (!map[prefix]) { map[prefix] = 1; } else { map[prefix] += 1; } return prefix + map[prefix]; }); /***/ }), /***/ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/upper-case.js": /*!*********************************************************************!*\ !*** ./node_modules/_@antv_util@2.0.9@@antv/util/esm/upper-case.js ***! \*********************************************************************/ /*! exports provided: default */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony import */ var _to_string__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./to-string */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/to-string.js"); var upperCase = function (str) { return Object(_to_string__WEBPACK_IMPORTED_MODULE_0__["default"])(str).toUpperCase(); }; /* harmony default export */ __webpack_exports__["default"] = (upperCase); /***/ }), /***/ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/upper-first.js": /*!**********************************************************************!*\ !*** ./node_modules/_@antv_util@2.0.9@@antv/util/esm/upper-first.js ***! \**********************************************************************/ /*! exports provided: default */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony import */ var _to_string__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./to-string */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/to-string.js"); var upperFirst = function (value) { var str = Object(_to_string__WEBPACK_IMPORTED_MODULE_0__["default"])(value); return str.charAt(0).toUpperCase() + str.substring(1); }; /* harmony default export */ __webpack_exports__["default"] = (upperFirst); /***/ }), /***/ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/values-of-key.js": /*!************************************************************************!*\ !*** ./node_modules/_@antv_util@2.0.9@@antv/util/esm/values-of-key.js ***! \************************************************************************/ /*! exports provided: default */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony import */ var _is_array__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./is-array */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/is-array.js"); /* harmony import */ var _is_nil__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./is-nil */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/is-nil.js"); /* harmony default export */ __webpack_exports__["default"] = (function (data, name) { var rst = []; var tmpMap = {}; for (var i = 0; i < data.length; i++) { var obj = data[i]; var value = obj[name]; if (!Object(_is_nil__WEBPACK_IMPORTED_MODULE_1__["default"])(value)) { // flatten if (!Object(_is_array__WEBPACK_IMPORTED_MODULE_0__["default"])(value)) { value = [value]; } for (var j = 0; j < value.length; j++) { var val = value[j]; // unique if (!tmpMap[val]) { rst.push(val); tmpMap[val] = true; } } } } return rst; }); /***/ }), /***/ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/values.js": /*!*****************************************************************!*\ !*** ./node_modules/_@antv_util@2.0.9@@antv/util/esm/values.js ***! \*****************************************************************/ /*! exports provided: default */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony import */ var _each__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./each */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/each.js"); /* harmony import */ var _is_function__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./is-function */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/is-function.js"); // @ts-ignore var values = Object.values ? function (obj) { return Object.values(obj); } : function (obj) { var result = []; Object(_each__WEBPACK_IMPORTED_MODULE_0__["default"])(obj, function (value, key) { if (!(Object(_is_function__WEBPACK_IMPORTED_MODULE_1__["default"])(obj) && key === 'prototype')) { result.push(value); } }); return result; }; /* harmony default export */ __webpack_exports__["default"] = (values); /***/ }), /***/ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/wrap-behavior.js": /*!************************************************************************!*\ !*** ./node_modules/_@antv_util@2.0.9@@antv/util/esm/wrap-behavior.js ***! \************************************************************************/ /*! exports provided: default */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /** * 封装事件,便于使用上下文this,和便于解除事件时使用 * @protected * @param {Object} obj 对象 * @param {String} action 事件名称 * @return {Function} 返回事件处理函数 */ function wrapBehavior(obj, action) { if (obj['_wrap_' + action]) { return obj['_wrap_' + action]; } var method = function (e) { obj[action](e); }; obj['_wrap_' + action] = method; return method; } /* harmony default export */ __webpack_exports__["default"] = (wrapBehavior); /***/ }), /***/ "./node_modules/_@antv_util@2.0.9@@antv/util/lib/clear-animation-frame.js": /*!********************************************************************************!*\ !*** ./node_modules/_@antv_util@2.0.9@@antv/util/lib/clear-animation-frame.js ***! \********************************************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); function cancelAnimationFrame(handler) { var method = window.cancelAnimationFrame || window.webkitCancelAnimationFrame || // @ts-ignore window.mozCancelAnimationFrame || // @ts-ignore window.msCancelAnimationFrame || clearTimeout; method(handler); } exports.default = cancelAnimationFrame; ; /***/ }), /***/ "./node_modules/_@antv_util@2.0.9@@antv/util/lib/each.js": /*!***************************************************************!*\ !*** ./node_modules/_@antv_util@2.0.9@@antv/util/lib/each.js ***! \***************************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var is_array_1 = __webpack_require__(/*! ./is-array */ "./node_modules/_@antv_util@2.0.9@@antv/util/lib/is-array.js"); var is_object_1 = __webpack_require__(/*! ./is-object */ "./node_modules/_@antv_util@2.0.9@@antv/util/lib/is-object.js"); function each(elements, func) { if (!elements) { return; } var rst; if (is_array_1.default(elements)) { for (var i = 0, len = elements.length; i < len; i++) { rst = func(elements[i], i); if (rst === false) { break; } } } else if (is_object_1.default(elements)) { for (var k in elements) { if (elements.hasOwnProperty(k)) { rst = func(elements[k], k); if (rst === false) { break; } } } } } exports.default = each; /***/ }), /***/ "./node_modules/_@antv_util@2.0.9@@antv/util/lib/is-array.js": /*!*******************************************************************!*\ !*** ./node_modules/_@antv_util@2.0.9@@antv/util/lib/is-array.js ***! \*******************************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var is_type_1 = __webpack_require__(/*! ./is-type */ "./node_modules/_@antv_util@2.0.9@@antv/util/lib/is-type.js"); exports.default = function (value) { return Array.isArray ? Array.isArray(value) : is_type_1.default(value, 'Array'); }; /***/ }), /***/ "./node_modules/_@antv_util@2.0.9@@antv/util/lib/is-function.js": /*!**********************************************************************!*\ !*** ./node_modules/_@antv_util@2.0.9@@antv/util/lib/is-function.js ***! \**********************************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); /** * 是否为函数 * @param {*} fn 对象 * @return {Boolean} 是否函数 */ var is_type_1 = __webpack_require__(/*! ./is-type */ "./node_modules/_@antv_util@2.0.9@@antv/util/lib/is-type.js"); exports.default = function (value) { return is_type_1.default(value, 'Function'); }; /***/ }), /***/ "./node_modules/_@antv_util@2.0.9@@antv/util/lib/is-nil.js": /*!*****************************************************************!*\ !*** ./node_modules/_@antv_util@2.0.9@@antv/util/lib/is-nil.js ***! \*****************************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); // isFinite, var isNil = function (value) { /** * isNil(null) => true * isNil() => true */ return value === null || value === undefined; }; exports.default = isNil; /***/ }), /***/ "./node_modules/_@antv_util@2.0.9@@antv/util/lib/is-number-equal.js": /*!**************************************************************************!*\ !*** ./node_modules/_@antv_util@2.0.9@@antv/util/lib/is-number-equal.js ***! \**************************************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var PRECISION = 0.00001; // numbers less than this is considered as 0 function isNumberEqual(a, b, precision) { if (precision === void 0) { precision = PRECISION; } return Math.abs(a - b) < precision; } exports.default = isNumberEqual; ; /***/ }), /***/ "./node_modules/_@antv_util@2.0.9@@antv/util/lib/is-object.js": /*!********************************************************************!*\ !*** ./node_modules/_@antv_util@2.0.9@@antv/util/lib/is-object.js ***! \********************************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = function (value) { /** * isObject({}) => true * isObject([1, 2, 3]) => true * isObject(Function) => true * isObject(null) => false */ var type = typeof value; return value !== null && type === 'object' || type === 'function'; }; /***/ }), /***/ "./node_modules/_@antv_util@2.0.9@@antv/util/lib/is-string.js": /*!********************************************************************!*\ !*** ./node_modules/_@antv_util@2.0.9@@antv/util/lib/is-string.js ***! \********************************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var is_type_1 = __webpack_require__(/*! ./is-type */ "./node_modules/_@antv_util@2.0.9@@antv/util/lib/is-type.js"); exports.default = function (str) { return is_type_1.default(str, 'String'); }; /***/ }), /***/ "./node_modules/_@antv_util@2.0.9@@antv/util/lib/is-type.js": /*!******************************************************************!*\ !*** ./node_modules/_@antv_util@2.0.9@@antv/util/lib/is-type.js ***! \******************************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var toString = {}.toString; var isType = function (value, type) { return toString.call(value) === '[object ' + type + ']'; }; exports.default = isType; /***/ }), /***/ "./node_modules/_@antv_util@2.0.9@@antv/util/lib/mix.js": /*!**************************************************************!*\ !*** ./node_modules/_@antv_util@2.0.9@@antv/util/lib/mix.js ***! \**************************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); // FIXME: Mutable param should be forbidden in static lang. function _mix(dist, obj) { for (var key in obj) { if (obj.hasOwnProperty(key) && key !== 'constructor' && obj[key] !== undefined) { dist[key] = obj[key]; } } } function mix(dist, src1, src2, src3) { if (src1) _mix(dist, src1); if (src2) _mix(dist, src2); if (src3) _mix(dist, src3); return dist; } exports.default = mix; /***/ }), /***/ "./node_modules/_@antv_util@2.0.9@@antv/util/lib/mod.js": /*!**************************************************************!*\ !*** ./node_modules/_@antv_util@2.0.9@@antv/util/lib/mod.js ***! \**************************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var mod = function (n, m) { return (n % m + m) % m; }; exports.default = mod; /***/ }), /***/ "./node_modules/_@antv_util@2.0.9@@antv/util/lib/request-animation-frame.js": /*!**********************************************************************************!*\ !*** ./node_modules/_@antv_util@2.0.9@@antv/util/lib/request-animation-frame.js ***! \**********************************************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); function requestAnimationFrame(fn) { var method = window.requestAnimationFrame || window.webkitRequestAnimationFrame || // @ts-ignore window.mozRequestAnimationFrame || // @ts-ignore window.msRequestAnimationFrame || function (f) { return setTimeout(f, 16); }; return method(fn); } exports.default = requestAnimationFrame; ; /***/ }), /***/ "./node_modules/_@antv_util@2.0.9@@antv/util/lib/to-radian.js": /*!********************************************************************!*\ !*** ./node_modules/_@antv_util@2.0.9@@antv/util/lib/to-radian.js ***! \********************************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var RADIAN = Math.PI / 180; var toRadian = function (degree) { return RADIAN * degree; }; exports.default = toRadian; /***/ }), /***/ "./node_modules/_@antv_util@2.0.9@@antv/util/lib/to-string.js": /*!********************************************************************!*\ !*** ./node_modules/_@antv_util@2.0.9@@antv/util/lib/to-string.js ***! \********************************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var is_nil_1 = __webpack_require__(/*! ./is-nil */ "./node_modules/_@antv_util@2.0.9@@antv/util/lib/is-nil.js"); exports.default = function (value) { if (is_nil_1.default(value)) return ''; return value.toString(); }; /***/ }), /***/ "./node_modules/_@antv_util@2.0.9@@antv/util/lib/upper-first.js": /*!**********************************************************************!*\ !*** ./node_modules/_@antv_util@2.0.9@@antv/util/lib/upper-first.js ***! \**********************************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var to_string_1 = __webpack_require__(/*! ./to-string */ "./node_modules/_@antv_util@2.0.9@@antv/util/lib/to-string.js"); var upperFirst = function (value) { var str = to_string_1.default(value); return str.charAt(0).toUpperCase() + str.substring(1); }; exports.default = upperFirst; /***/ }), /***/ "./node_modules/_d3-color@1.4.1@d3-color/src/color.js": /*!************************************************************!*\ !*** ./node_modules/_d3-color@1.4.1@d3-color/src/color.js ***! \************************************************************/ /*! exports provided: Color, darker, brighter, default, rgbConvert, rgb, Rgb, hslConvert, hsl */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Color", function() { return Color; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "darker", function() { return darker; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "brighter", function() { return brighter; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return color; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "rgbConvert", function() { return rgbConvert; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "rgb", function() { return rgb; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Rgb", function() { return Rgb; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "hslConvert", function() { return hslConvert; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "hsl", function() { return hsl; }); /* harmony import */ var _define_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./define.js */ "./node_modules/_d3-color@1.4.1@d3-color/src/define.js"); function Color() {} var darker = 0.7; var brighter = 1 / darker; var reI = "\\s*([+-]?\\d+)\\s*", reN = "\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)\\s*", reP = "\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)%\\s*", reHex = /^#([0-9a-f]{3,8})$/, reRgbInteger = new RegExp("^rgb\\(" + [reI, reI, reI] + "\\)$"), reRgbPercent = new RegExp("^rgb\\(" + [reP, reP, reP] + "\\)$"), reRgbaInteger = new RegExp("^rgba\\(" + [reI, reI, reI, reN] + "\\)$"), reRgbaPercent = new RegExp("^rgba\\(" + [reP, reP, reP, reN] + "\\)$"), reHslPercent = new RegExp("^hsl\\(" + [reN, reP, reP] + "\\)$"), reHslaPercent = new RegExp("^hsla\\(" + [reN, reP, reP, reN] + "\\)$"); var named = { aliceblue: 0xf0f8ff, antiquewhite: 0xfaebd7, aqua: 0x00ffff, aquamarine: 0x7fffd4, azure: 0xf0ffff, beige: 0xf5f5dc, bisque: 0xffe4c4, black: 0x000000, blanchedalmond: 0xffebcd, blue: 0x0000ff, blueviolet: 0x8a2be2, brown: 0xa52a2a, burlywood: 0xdeb887, cadetblue: 0x5f9ea0, chartreuse: 0x7fff00, chocolate: 0xd2691e, coral: 0xff7f50, cornflowerblue: 0x6495ed, cornsilk: 0xfff8dc, crimson: 0xdc143c, cyan: 0x00ffff, darkblue: 0x00008b, darkcyan: 0x008b8b, darkgoldenrod: 0xb8860b, darkgray: 0xa9a9a9, darkgreen: 0x006400, darkgrey: 0xa9a9a9, darkkhaki: 0xbdb76b, darkmagenta: 0x8b008b, darkolivegreen: 0x556b2f, darkorange: 0xff8c00, darkorchid: 0x9932cc, darkred: 0x8b0000, darksalmon: 0xe9967a, darkseagreen: 0x8fbc8f, darkslateblue: 0x483d8b, darkslategray: 0x2f4f4f, darkslategrey: 0x2f4f4f, darkturquoise: 0x00ced1, darkviolet: 0x9400d3, deeppink: 0xff1493, deepskyblue: 0x00bfff, dimgray: 0x696969, dimgrey: 0x696969, dodgerblue: 0x1e90ff, firebrick: 0xb22222, floralwhite: 0xfffaf0, forestgreen: 0x228b22, fuchsia: 0xff00ff, gainsboro: 0xdcdcdc, ghostwhite: 0xf8f8ff, gold: 0xffd700, goldenrod: 0xdaa520, gray: 0x808080, green: 0x008000, greenyellow: 0xadff2f, grey: 0x808080, honeydew: 0xf0fff0, hotpink: 0xff69b4, indianred: 0xcd5c5c, indigo: 0x4b0082, ivory: 0xfffff0, khaki: 0xf0e68c, lavender: 0xe6e6fa, lavenderblush: 0xfff0f5, lawngreen: 0x7cfc00, lemonchiffon: 0xfffacd, lightblue: 0xadd8e6, lightcoral: 0xf08080, lightcyan: 0xe0ffff, lightgoldenrodyellow: 0xfafad2, lightgray: 0xd3d3d3, lightgreen: 0x90ee90, lightgrey: 0xd3d3d3, lightpink: 0xffb6c1, lightsalmon: 0xffa07a, lightseagreen: 0x20b2aa, lightskyblue: 0x87cefa, lightslategray: 0x778899, lightslategrey: 0x778899, lightsteelblue: 0xb0c4de, lightyellow: 0xffffe0, lime: 0x00ff00, limegreen: 0x32cd32, linen: 0xfaf0e6, magenta: 0xff00ff, maroon: 0x800000, mediumaquamarine: 0x66cdaa, mediumblue: 0x0000cd, mediumorchid: 0xba55d3, mediumpurple: 0x9370db, mediumseagreen: 0x3cb371, mediumslateblue: 0x7b68ee, mediumspringgreen: 0x00fa9a, mediumturquoise: 0x48d1cc, mediumvioletred: 0xc71585, midnightblue: 0x191970, mintcream: 0xf5fffa, mistyrose: 0xffe4e1, moccasin: 0xffe4b5, navajowhite: 0xffdead, navy: 0x000080, oldlace: 0xfdf5e6, olive: 0x808000, olivedrab: 0x6b8e23, orange: 0xffa500, orangered: 0xff4500, orchid: 0xda70d6, palegoldenrod: 0xeee8aa, palegreen: 0x98fb98, paleturquoise: 0xafeeee, palevioletred: 0xdb7093, papayawhip: 0xffefd5, peachpuff: 0xffdab9, peru: 0xcd853f, pink: 0xffc0cb, plum: 0xdda0dd, powderblue: 0xb0e0e6, purple: 0x800080, rebeccapurple: 0x663399, red: 0xff0000, rosybrown: 0xbc8f8f, royalblue: 0x4169e1, saddlebrown: 0x8b4513, salmon: 0xfa8072, sandybrown: 0xf4a460, seagreen: 0x2e8b57, seashell: 0xfff5ee, sienna: 0xa0522d, silver: 0xc0c0c0, skyblue: 0x87ceeb, slateblue: 0x6a5acd, slategray: 0x708090, slategrey: 0x708090, snow: 0xfffafa, springgreen: 0x00ff7f, steelblue: 0x4682b4, tan: 0xd2b48c, teal: 0x008080, thistle: 0xd8bfd8, tomato: 0xff6347, turquoise: 0x40e0d0, violet: 0xee82ee, wheat: 0xf5deb3, white: 0xffffff, whitesmoke: 0xf5f5f5, yellow: 0xffff00, yellowgreen: 0x9acd32 }; Object(_define_js__WEBPACK_IMPORTED_MODULE_0__["default"])(Color, color, { copy: function (channels) { return Object.assign(new this.constructor(), this, channels); }, displayable: function () { return this.rgb().displayable(); }, hex: color_formatHex, // Deprecated! Use color.formatHex. formatHex: color_formatHex, formatHsl: color_formatHsl, formatRgb: color_formatRgb, toString: color_formatRgb }); function color_formatHex() { return this.rgb().formatHex(); } function color_formatHsl() { return hslConvert(this).formatHsl(); } function color_formatRgb() { return this.rgb().formatRgb(); } function color(format) { var m, l; format = (format + "").trim().toLowerCase(); return (m = reHex.exec(format)) ? (l = m[1].length, m = parseInt(m[1], 16), l === 6 ? rgbn(m) // #ff0000 : l === 3 ? new Rgb(m >> 8 & 0xf | m >> 4 & 0xf0, m >> 4 & 0xf | m & 0xf0, (m & 0xf) << 4 | m & 0xf, 1) // #f00 : l === 8 ? rgba(m >> 24 & 0xff, m >> 16 & 0xff, m >> 8 & 0xff, (m & 0xff) / 0xff) // #ff000000 : l === 4 ? rgba(m >> 12 & 0xf | m >> 8 & 0xf0, m >> 8 & 0xf | m >> 4 & 0xf0, m >> 4 & 0xf | m & 0xf0, ((m & 0xf) << 4 | m & 0xf) / 0xff) // #f000 : null // invalid hex ) : (m = reRgbInteger.exec(format)) ? new Rgb(m[1], m[2], m[3], 1) // rgb(255, 0, 0) : (m = reRgbPercent.exec(format)) ? new Rgb(m[1] * 255 / 100, m[2] * 255 / 100, m[3] * 255 / 100, 1) // rgb(100%, 0%, 0%) : (m = reRgbaInteger.exec(format)) ? rgba(m[1], m[2], m[3], m[4]) // rgba(255, 0, 0, 1) : (m = reRgbaPercent.exec(format)) ? rgba(m[1] * 255 / 100, m[2] * 255 / 100, m[3] * 255 / 100, m[4]) // rgb(100%, 0%, 0%, 1) : (m = reHslPercent.exec(format)) ? hsla(m[1], m[2] / 100, m[3] / 100, 1) // hsl(120, 50%, 50%) : (m = reHslaPercent.exec(format)) ? hsla(m[1], m[2] / 100, m[3] / 100, m[4]) // hsla(120, 50%, 50%, 1) : named.hasOwnProperty(format) ? rgbn(named[format]) // eslint-disable-line no-prototype-builtins : format === "transparent" ? new Rgb(NaN, NaN, NaN, 0) : null; } function rgbn(n) { return new Rgb(n >> 16 & 0xff, n >> 8 & 0xff, n & 0xff, 1); } function rgba(r, g, b, a) { if (a <= 0) r = g = b = NaN; return new Rgb(r, g, b, a); } function rgbConvert(o) { if (!(o instanceof Color)) o = color(o); if (!o) return new Rgb(); o = o.rgb(); return new Rgb(o.r, o.g, o.b, o.opacity); } function rgb(r, g, b, opacity) { return arguments.length === 1 ? rgbConvert(r) : new Rgb(r, g, b, opacity == null ? 1 : opacity); } function Rgb(r, g, b, opacity) { this.r = +r; this.g = +g; this.b = +b; this.opacity = +opacity; } Object(_define_js__WEBPACK_IMPORTED_MODULE_0__["default"])(Rgb, rgb, Object(_define_js__WEBPACK_IMPORTED_MODULE_0__["extend"])(Color, { brighter: function (k) { k = k == null ? brighter : Math.pow(brighter, k); return new Rgb(this.r * k, this.g * k, this.b * k, this.opacity); }, darker: function (k) { k = k == null ? darker : Math.pow(darker, k); return new Rgb(this.r * k, this.g * k, this.b * k, this.opacity); }, rgb: function () { return this; }, displayable: function () { return -0.5 <= this.r && this.r < 255.5 && -0.5 <= this.g && this.g < 255.5 && -0.5 <= this.b && this.b < 255.5 && 0 <= this.opacity && this.opacity <= 1; }, hex: rgb_formatHex, // Deprecated! Use color.formatHex. formatHex: rgb_formatHex, formatRgb: rgb_formatRgb, toString: rgb_formatRgb })); function rgb_formatHex() { return "#" + hex(this.r) + hex(this.g) + hex(this.b); } function rgb_formatRgb() { var a = this.opacity; a = isNaN(a) ? 1 : Math.max(0, Math.min(1, a)); return (a === 1 ? "rgb(" : "rgba(") + Math.max(0, Math.min(255, Math.round(this.r) || 0)) + ", " + Math.max(0, Math.min(255, Math.round(this.g) || 0)) + ", " + Math.max(0, Math.min(255, Math.round(this.b) || 0)) + (a === 1 ? ")" : ", " + a + ")"); } function hex(value) { value = Math.max(0, Math.min(255, Math.round(value) || 0)); return (value < 16 ? "0" : "") + value.toString(16); } function hsla(h, s, l, a) { if (a <= 0) h = s = l = NaN;else if (l <= 0 || l >= 1) h = s = NaN;else if (s <= 0) h = NaN; return new Hsl(h, s, l, a); } function hslConvert(o) { if (o instanceof Hsl) return new Hsl(o.h, o.s, o.l, o.opacity); if (!(o instanceof Color)) o = color(o); if (!o) return new Hsl(); if (o instanceof Hsl) return o; o = o.rgb(); var r = o.r / 255, g = o.g / 255, b = o.b / 255, min = Math.min(r, g, b), max = Math.max(r, g, b), h = NaN, s = max - min, l = (max + min) / 2; if (s) { if (r === max) h = (g - b) / s + (g < b) * 6;else if (g === max) h = (b - r) / s + 2;else h = (r - g) / s + 4; s /= l < 0.5 ? max + min : 2 - max - min; h *= 60; } else { s = l > 0 && l < 1 ? 0 : h; } return new Hsl(h, s, l, o.opacity); } function hsl(h, s, l, opacity) { return arguments.length === 1 ? hslConvert(h) : new Hsl(h, s, l, opacity == null ? 1 : opacity); } function Hsl(h, s, l, opacity) { this.h = +h; this.s = +s; this.l = +l; this.opacity = +opacity; } Object(_define_js__WEBPACK_IMPORTED_MODULE_0__["default"])(Hsl, hsl, Object(_define_js__WEBPACK_IMPORTED_MODULE_0__["extend"])(Color, { brighter: function (k) { k = k == null ? brighter : Math.pow(brighter, k); return new Hsl(this.h, this.s, this.l * k, this.opacity); }, darker: function (k) { k = k == null ? darker : Math.pow(darker, k); return new Hsl(this.h, this.s, this.l * k, this.opacity); }, rgb: function () { var h = this.h % 360 + (this.h < 0) * 360, s = isNaN(h) || isNaN(this.s) ? 0 : this.s, l = this.l, m2 = l + (l < 0.5 ? l : 1 - l) * s, m1 = 2 * l - m2; return new Rgb(hsl2rgb(h >= 240 ? h - 240 : h + 120, m1, m2), hsl2rgb(h, m1, m2), hsl2rgb(h < 120 ? h + 240 : h - 120, m1, m2), this.opacity); }, displayable: function () { return (0 <= this.s && this.s <= 1 || isNaN(this.s)) && 0 <= this.l && this.l <= 1 && 0 <= this.opacity && this.opacity <= 1; }, formatHsl: function () { var a = this.opacity; a = isNaN(a) ? 1 : Math.max(0, Math.min(1, a)); return (a === 1 ? "hsl(" : "hsla(") + (this.h || 0) + ", " + (this.s || 0) * 100 + "%, " + (this.l || 0) * 100 + "%" + (a === 1 ? ")" : ", " + a + ")"); } })); /* From FvD 13.37, CSS Color Module Level 3 */ function hsl2rgb(h, m1, m2) { return (h < 60 ? m1 + (m2 - m1) * h / 60 : h < 180 ? m2 : h < 240 ? m1 + (m2 - m1) * (240 - h) / 60 : m1) * 255; } /***/ }), /***/ "./node_modules/_d3-color@1.4.1@d3-color/src/cubehelix.js": /*!****************************************************************!*\ !*** ./node_modules/_d3-color@1.4.1@d3-color/src/cubehelix.js ***! \****************************************************************/ /*! exports provided: default, Cubehelix */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return cubehelix; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Cubehelix", function() { return Cubehelix; }); /* harmony import */ var _define_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./define.js */ "./node_modules/_d3-color@1.4.1@d3-color/src/define.js"); /* harmony import */ var _color_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./color.js */ "./node_modules/_d3-color@1.4.1@d3-color/src/color.js"); /* harmony import */ var _math_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./math.js */ "./node_modules/_d3-color@1.4.1@d3-color/src/math.js"); var A = -0.14861, B = +1.78277, C = -0.29227, D = -0.90649, E = +1.97294, ED = E * D, EB = E * B, BC_DA = B * C - D * A; function cubehelixConvert(o) { if (o instanceof Cubehelix) return new Cubehelix(o.h, o.s, o.l, o.opacity); if (!(o instanceof _color_js__WEBPACK_IMPORTED_MODULE_1__["Rgb"])) o = Object(_color_js__WEBPACK_IMPORTED_MODULE_1__["rgbConvert"])(o); var r = o.r / 255, g = o.g / 255, b = o.b / 255, l = (BC_DA * b + ED * r - EB * g) / (BC_DA + ED - EB), bl = b - l, k = (E * (g - l) - C * bl) / D, s = Math.sqrt(k * k + bl * bl) / (E * l * (1 - l)), // NaN if l=0 or l=1 h = s ? Math.atan2(k, bl) * _math_js__WEBPACK_IMPORTED_MODULE_2__["rad2deg"] - 120 : NaN; return new Cubehelix(h < 0 ? h + 360 : h, s, l, o.opacity); } function cubehelix(h, s, l, opacity) { return arguments.length === 1 ? cubehelixConvert(h) : new Cubehelix(h, s, l, opacity == null ? 1 : opacity); } function Cubehelix(h, s, l, opacity) { this.h = +h; this.s = +s; this.l = +l; this.opacity = +opacity; } Object(_define_js__WEBPACK_IMPORTED_MODULE_0__["default"])(Cubehelix, cubehelix, Object(_define_js__WEBPACK_IMPORTED_MODULE_0__["extend"])(_color_js__WEBPACK_IMPORTED_MODULE_1__["Color"], { brighter: function (k) { k = k == null ? _color_js__WEBPACK_IMPORTED_MODULE_1__["brighter"] : Math.pow(_color_js__WEBPACK_IMPORTED_MODULE_1__["brighter"], k); return new Cubehelix(this.h, this.s, this.l * k, this.opacity); }, darker: function (k) { k = k == null ? _color_js__WEBPACK_IMPORTED_MODULE_1__["darker"] : Math.pow(_color_js__WEBPACK_IMPORTED_MODULE_1__["darker"], k); return new Cubehelix(this.h, this.s, this.l * k, this.opacity); }, rgb: function () { var h = isNaN(this.h) ? 0 : (this.h + 120) * _math_js__WEBPACK_IMPORTED_MODULE_2__["deg2rad"], l = +this.l, a = isNaN(this.s) ? 0 : this.s * l * (1 - l), cosh = Math.cos(h), sinh = Math.sin(h); return new _color_js__WEBPACK_IMPORTED_MODULE_1__["Rgb"](255 * (l + a * (A * cosh + B * sinh)), 255 * (l + a * (C * cosh + D * sinh)), 255 * (l + a * (E * cosh)), this.opacity); } })); /***/ }), /***/ "./node_modules/_d3-color@1.4.1@d3-color/src/define.js": /*!*************************************************************!*\ !*** ./node_modules/_d3-color@1.4.1@d3-color/src/define.js ***! \*************************************************************/ /*! exports provided: default, extend */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "extend", function() { return extend; }); /* harmony default export */ __webpack_exports__["default"] = (function (constructor, factory, prototype) { constructor.prototype = factory.prototype = prototype; prototype.constructor = constructor; }); function extend(parent, definition) { var prototype = Object.create(parent.prototype); for (var key in definition) prototype[key] = definition[key]; return prototype; } /***/ }), /***/ "./node_modules/_d3-color@1.4.1@d3-color/src/index.js": /*!************************************************************!*\ !*** ./node_modules/_d3-color@1.4.1@d3-color/src/index.js ***! \************************************************************/ /*! exports provided: color, rgb, hsl, lab, hcl, lch, gray, cubehelix */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony import */ var _color_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./color.js */ "./node_modules/_d3-color@1.4.1@d3-color/src/color.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "color", function() { return _color_js__WEBPACK_IMPORTED_MODULE_0__["default"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "rgb", function() { return _color_js__WEBPACK_IMPORTED_MODULE_0__["rgb"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "hsl", function() { return _color_js__WEBPACK_IMPORTED_MODULE_0__["hsl"]; }); /* harmony import */ var _lab_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./lab.js */ "./node_modules/_d3-color@1.4.1@d3-color/src/lab.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "lab", function() { return _lab_js__WEBPACK_IMPORTED_MODULE_1__["default"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "hcl", function() { return _lab_js__WEBPACK_IMPORTED_MODULE_1__["hcl"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "lch", function() { return _lab_js__WEBPACK_IMPORTED_MODULE_1__["lch"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "gray", function() { return _lab_js__WEBPACK_IMPORTED_MODULE_1__["gray"]; }); /* harmony import */ var _cubehelix_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./cubehelix.js */ "./node_modules/_d3-color@1.4.1@d3-color/src/cubehelix.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "cubehelix", function() { return _cubehelix_js__WEBPACK_IMPORTED_MODULE_2__["default"]; }); /***/ }), /***/ "./node_modules/_d3-color@1.4.1@d3-color/src/lab.js": /*!**********************************************************!*\ !*** ./node_modules/_d3-color@1.4.1@d3-color/src/lab.js ***! \**********************************************************/ /*! exports provided: gray, default, Lab, lch, hcl, Hcl */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "gray", function() { return gray; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return lab; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Lab", function() { return Lab; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "lch", function() { return lch; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "hcl", function() { return hcl; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Hcl", function() { return Hcl; }); /* harmony import */ var _define_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./define.js */ "./node_modules/_d3-color@1.4.1@d3-color/src/define.js"); /* harmony import */ var _color_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./color.js */ "./node_modules/_d3-color@1.4.1@d3-color/src/color.js"); /* harmony import */ var _math_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./math.js */ "./node_modules/_d3-color@1.4.1@d3-color/src/math.js"); // https://observablehq.com/@mbostock/lab-and-rgb var K = 18, Xn = 0.96422, Yn = 1, Zn = 0.82521, t0 = 4 / 29, t1 = 6 / 29, t2 = 3 * t1 * t1, t3 = t1 * t1 * t1; function labConvert(o) { if (o instanceof Lab) return new Lab(o.l, o.a, o.b, o.opacity); if (o instanceof Hcl) return hcl2lab(o); if (!(o instanceof _color_js__WEBPACK_IMPORTED_MODULE_1__["Rgb"])) o = Object(_color_js__WEBPACK_IMPORTED_MODULE_1__["rgbConvert"])(o); var r = rgb2lrgb(o.r), g = rgb2lrgb(o.g), b = rgb2lrgb(o.b), y = xyz2lab((0.2225045 * r + 0.7168786 * g + 0.0606169 * b) / Yn), x, z; if (r === g && g === b) x = z = y;else { x = xyz2lab((0.4360747 * r + 0.3850649 * g + 0.1430804 * b) / Xn); z = xyz2lab((0.0139322 * r + 0.0971045 * g + 0.7141733 * b) / Zn); } return new Lab(116 * y - 16, 500 * (x - y), 200 * (y - z), o.opacity); } function gray(l, opacity) { return new Lab(l, 0, 0, opacity == null ? 1 : opacity); } function lab(l, a, b, opacity) { return arguments.length === 1 ? labConvert(l) : new Lab(l, a, b, opacity == null ? 1 : opacity); } function Lab(l, a, b, opacity) { this.l = +l; this.a = +a; this.b = +b; this.opacity = +opacity; } Object(_define_js__WEBPACK_IMPORTED_MODULE_0__["default"])(Lab, lab, Object(_define_js__WEBPACK_IMPORTED_MODULE_0__["extend"])(_color_js__WEBPACK_IMPORTED_MODULE_1__["Color"], { brighter: function (k) { return new Lab(this.l + K * (k == null ? 1 : k), this.a, this.b, this.opacity); }, darker: function (k) { return new Lab(this.l - K * (k == null ? 1 : k), this.a, this.b, this.opacity); }, rgb: function () { var y = (this.l + 16) / 116, x = isNaN(this.a) ? y : y + this.a / 500, z = isNaN(this.b) ? y : y - this.b / 200; x = Xn * lab2xyz(x); y = Yn * lab2xyz(y); z = Zn * lab2xyz(z); return new _color_js__WEBPACK_IMPORTED_MODULE_1__["Rgb"](lrgb2rgb(3.1338561 * x - 1.6168667 * y - 0.4906146 * z), lrgb2rgb(-0.9787684 * x + 1.9161415 * y + 0.0334540 * z), lrgb2rgb(0.0719453 * x - 0.2289914 * y + 1.4052427 * z), this.opacity); } })); function xyz2lab(t) { return t > t3 ? Math.pow(t, 1 / 3) : t / t2 + t0; } function lab2xyz(t) { return t > t1 ? t * t * t : t2 * (t - t0); } function lrgb2rgb(x) { return 255 * (x <= 0.0031308 ? 12.92 * x : 1.055 * Math.pow(x, 1 / 2.4) - 0.055); } function rgb2lrgb(x) { return (x /= 255) <= 0.04045 ? x / 12.92 : Math.pow((x + 0.055) / 1.055, 2.4); } function hclConvert(o) { if (o instanceof Hcl) return new Hcl(o.h, o.c, o.l, o.opacity); if (!(o instanceof Lab)) o = labConvert(o); if (o.a === 0 && o.b === 0) return new Hcl(NaN, 0 < o.l && o.l < 100 ? 0 : NaN, o.l, o.opacity); var h = Math.atan2(o.b, o.a) * _math_js__WEBPACK_IMPORTED_MODULE_2__["rad2deg"]; return new Hcl(h < 0 ? h + 360 : h, Math.sqrt(o.a * o.a + o.b * o.b), o.l, o.opacity); } function lch(l, c, h, opacity) { return arguments.length === 1 ? hclConvert(l) : new Hcl(h, c, l, opacity == null ? 1 : opacity); } function hcl(h, c, l, opacity) { return arguments.length === 1 ? hclConvert(h) : new Hcl(h, c, l, opacity == null ? 1 : opacity); } function Hcl(h, c, l, opacity) { this.h = +h; this.c = +c; this.l = +l; this.opacity = +opacity; } function hcl2lab(o) { if (isNaN(o.h)) return new Lab(o.l, 0, 0, o.opacity); var h = o.h * _math_js__WEBPACK_IMPORTED_MODULE_2__["deg2rad"]; return new Lab(o.l, Math.cos(h) * o.c, Math.sin(h) * o.c, o.opacity); } Object(_define_js__WEBPACK_IMPORTED_MODULE_0__["default"])(Hcl, hcl, Object(_define_js__WEBPACK_IMPORTED_MODULE_0__["extend"])(_color_js__WEBPACK_IMPORTED_MODULE_1__["Color"], { brighter: function (k) { return new Hcl(this.h, this.c, this.l + K * (k == null ? 1 : k), this.opacity); }, darker: function (k) { return new Hcl(this.h, this.c, this.l - K * (k == null ? 1 : k), this.opacity); }, rgb: function () { return hcl2lab(this).rgb(); } })); /***/ }), /***/ "./node_modules/_d3-color@1.4.1@d3-color/src/math.js": /*!***********************************************************!*\ !*** ./node_modules/_d3-color@1.4.1@d3-color/src/math.js ***! \***********************************************************/ /*! exports provided: deg2rad, rad2deg */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "deg2rad", function() { return deg2rad; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "rad2deg", function() { return rad2deg; }); var deg2rad = Math.PI / 180; var rad2deg = 180 / Math.PI; /***/ }), /***/ "./node_modules/_d3-ease@1.0.6@d3-ease/src/back.js": /*!*********************************************************!*\ !*** ./node_modules/_d3-ease@1.0.6@d3-ease/src/back.js ***! \*********************************************************/ /*! exports provided: backIn, backOut, backInOut */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "backIn", function() { return backIn; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "backOut", function() { return backOut; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "backInOut", function() { return backInOut; }); var overshoot = 1.70158; var backIn = function custom(s) { s = +s; function backIn(t) { return t * t * ((s + 1) * t - s); } backIn.overshoot = custom; return backIn; }(overshoot); var backOut = function custom(s) { s = +s; function backOut(t) { return --t * t * ((s + 1) * t + s) + 1; } backOut.overshoot = custom; return backOut; }(overshoot); var backInOut = function custom(s) { s = +s; function backInOut(t) { return ((t *= 2) < 1 ? t * t * ((s + 1) * t - s) : (t -= 2) * t * ((s + 1) * t + s) + 2) / 2; } backInOut.overshoot = custom; return backInOut; }(overshoot); /***/ }), /***/ "./node_modules/_d3-ease@1.0.6@d3-ease/src/bounce.js": /*!***********************************************************!*\ !*** ./node_modules/_d3-ease@1.0.6@d3-ease/src/bounce.js ***! \***********************************************************/ /*! exports provided: bounceIn, bounceOut, bounceInOut */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "bounceIn", function() { return bounceIn; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "bounceOut", function() { return bounceOut; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "bounceInOut", function() { return bounceInOut; }); var b1 = 4 / 11, b2 = 6 / 11, b3 = 8 / 11, b4 = 3 / 4, b5 = 9 / 11, b6 = 10 / 11, b7 = 15 / 16, b8 = 21 / 22, b9 = 63 / 64, b0 = 1 / b1 / b1; function bounceIn(t) { return 1 - bounceOut(1 - t); } function bounceOut(t) { return (t = +t) < b1 ? b0 * t * t : t < b3 ? b0 * (t -= b2) * t + b4 : t < b6 ? b0 * (t -= b5) * t + b7 : b0 * (t -= b8) * t + b9; } function bounceInOut(t) { return ((t *= 2) <= 1 ? 1 - bounceOut(1 - t) : bounceOut(t - 1) + 1) / 2; } /***/ }), /***/ "./node_modules/_d3-ease@1.0.6@d3-ease/src/circle.js": /*!***********************************************************!*\ !*** ./node_modules/_d3-ease@1.0.6@d3-ease/src/circle.js ***! \***********************************************************/ /*! exports provided: circleIn, circleOut, circleInOut */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "circleIn", function() { return circleIn; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "circleOut", function() { return circleOut; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "circleInOut", function() { return circleInOut; }); function circleIn(t) { return 1 - Math.sqrt(1 - t * t); } function circleOut(t) { return Math.sqrt(1 - --t * t); } function circleInOut(t) { return ((t *= 2) <= 1 ? 1 - Math.sqrt(1 - t * t) : Math.sqrt(1 - (t -= 2) * t) + 1) / 2; } /***/ }), /***/ "./node_modules/_d3-ease@1.0.6@d3-ease/src/cubic.js": /*!**********************************************************!*\ !*** ./node_modules/_d3-ease@1.0.6@d3-ease/src/cubic.js ***! \**********************************************************/ /*! exports provided: cubicIn, cubicOut, cubicInOut */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "cubicIn", function() { return cubicIn; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "cubicOut", function() { return cubicOut; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "cubicInOut", function() { return cubicInOut; }); function cubicIn(t) { return t * t * t; } function cubicOut(t) { return --t * t * t + 1; } function cubicInOut(t) { return ((t *= 2) <= 1 ? t * t * t : (t -= 2) * t * t + 2) / 2; } /***/ }), /***/ "./node_modules/_d3-ease@1.0.6@d3-ease/src/elastic.js": /*!************************************************************!*\ !*** ./node_modules/_d3-ease@1.0.6@d3-ease/src/elastic.js ***! \************************************************************/ /*! exports provided: elasticIn, elasticOut, elasticInOut */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "elasticIn", function() { return elasticIn; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "elasticOut", function() { return elasticOut; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "elasticInOut", function() { return elasticInOut; }); var tau = 2 * Math.PI, amplitude = 1, period = 0.3; var elasticIn = function custom(a, p) { var s = Math.asin(1 / (a = Math.max(1, a))) * (p /= tau); function elasticIn(t) { return a * Math.pow(2, 10 * --t) * Math.sin((s - t) / p); } elasticIn.amplitude = function (a) { return custom(a, p * tau); }; elasticIn.period = function (p) { return custom(a, p); }; return elasticIn; }(amplitude, period); var elasticOut = function custom(a, p) { var s = Math.asin(1 / (a = Math.max(1, a))) * (p /= tau); function elasticOut(t) { return 1 - a * Math.pow(2, -10 * (t = +t)) * Math.sin((t + s) / p); } elasticOut.amplitude = function (a) { return custom(a, p * tau); }; elasticOut.period = function (p) { return custom(a, p); }; return elasticOut; }(amplitude, period); var elasticInOut = function custom(a, p) { var s = Math.asin(1 / (a = Math.max(1, a))) * (p /= tau); function elasticInOut(t) { return ((t = t * 2 - 1) < 0 ? a * Math.pow(2, 10 * t) * Math.sin((s - t) / p) : 2 - a * Math.pow(2, -10 * t) * Math.sin((s + t) / p)) / 2; } elasticInOut.amplitude = function (a) { return custom(a, p * tau); }; elasticInOut.period = function (p) { return custom(a, p); }; return elasticInOut; }(amplitude, period); /***/ }), /***/ "./node_modules/_d3-ease@1.0.6@d3-ease/src/exp.js": /*!********************************************************!*\ !*** ./node_modules/_d3-ease@1.0.6@d3-ease/src/exp.js ***! \********************************************************/ /*! exports provided: expIn, expOut, expInOut */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "expIn", function() { return expIn; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "expOut", function() { return expOut; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "expInOut", function() { return expInOut; }); function expIn(t) { return Math.pow(2, 10 * t - 10); } function expOut(t) { return 1 - Math.pow(2, -10 * t); } function expInOut(t) { return ((t *= 2) <= 1 ? Math.pow(2, 10 * t - 10) : 2 - Math.pow(2, 10 - 10 * t)) / 2; } /***/ }), /***/ "./node_modules/_d3-ease@1.0.6@d3-ease/src/index.js": /*!**********************************************************!*\ !*** ./node_modules/_d3-ease@1.0.6@d3-ease/src/index.js ***! \**********************************************************/ /*! exports provided: easeLinear, easeQuad, easeQuadIn, easeQuadOut, easeQuadInOut, easeCubic, easeCubicIn, easeCubicOut, easeCubicInOut, easePoly, easePolyIn, easePolyOut, easePolyInOut, easeSin, easeSinIn, easeSinOut, easeSinInOut, easeExp, easeExpIn, easeExpOut, easeExpInOut, easeCircle, easeCircleIn, easeCircleOut, easeCircleInOut, easeBounce, easeBounceIn, easeBounceOut, easeBounceInOut, easeBack, easeBackIn, easeBackOut, easeBackInOut, easeElastic, easeElasticIn, easeElasticOut, easeElasticInOut */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony import */ var _linear_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./linear.js */ "./node_modules/_d3-ease@1.0.6@d3-ease/src/linear.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "easeLinear", function() { return _linear_js__WEBPACK_IMPORTED_MODULE_0__["linear"]; }); /* harmony import */ var _quad_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./quad.js */ "./node_modules/_d3-ease@1.0.6@d3-ease/src/quad.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "easeQuad", function() { return _quad_js__WEBPACK_IMPORTED_MODULE_1__["quadInOut"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "easeQuadIn", function() { return _quad_js__WEBPACK_IMPORTED_MODULE_1__["quadIn"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "easeQuadOut", function() { return _quad_js__WEBPACK_IMPORTED_MODULE_1__["quadOut"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "easeQuadInOut", function() { return _quad_js__WEBPACK_IMPORTED_MODULE_1__["quadInOut"]; }); /* harmony import */ var _cubic_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./cubic.js */ "./node_modules/_d3-ease@1.0.6@d3-ease/src/cubic.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "easeCubic", function() { return _cubic_js__WEBPACK_IMPORTED_MODULE_2__["cubicInOut"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "easeCubicIn", function() { return _cubic_js__WEBPACK_IMPORTED_MODULE_2__["cubicIn"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "easeCubicOut", function() { return _cubic_js__WEBPACK_IMPORTED_MODULE_2__["cubicOut"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "easeCubicInOut", function() { return _cubic_js__WEBPACK_IMPORTED_MODULE_2__["cubicInOut"]; }); /* harmony import */ var _poly_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./poly.js */ "./node_modules/_d3-ease@1.0.6@d3-ease/src/poly.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "easePoly", function() { return _poly_js__WEBPACK_IMPORTED_MODULE_3__["polyInOut"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "easePolyIn", function() { return _poly_js__WEBPACK_IMPORTED_MODULE_3__["polyIn"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "easePolyOut", function() { return _poly_js__WEBPACK_IMPORTED_MODULE_3__["polyOut"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "easePolyInOut", function() { return _poly_js__WEBPACK_IMPORTED_MODULE_3__["polyInOut"]; }); /* harmony import */ var _sin_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./sin.js */ "./node_modules/_d3-ease@1.0.6@d3-ease/src/sin.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "easeSin", function() { return _sin_js__WEBPACK_IMPORTED_MODULE_4__["sinInOut"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "easeSinIn", function() { return _sin_js__WEBPACK_IMPORTED_MODULE_4__["sinIn"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "easeSinOut", function() { return _sin_js__WEBPACK_IMPORTED_MODULE_4__["sinOut"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "easeSinInOut", function() { return _sin_js__WEBPACK_IMPORTED_MODULE_4__["sinInOut"]; }); /* harmony import */ var _exp_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./exp.js */ "./node_modules/_d3-ease@1.0.6@d3-ease/src/exp.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "easeExp", function() { return _exp_js__WEBPACK_IMPORTED_MODULE_5__["expInOut"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "easeExpIn", function() { return _exp_js__WEBPACK_IMPORTED_MODULE_5__["expIn"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "easeExpOut", function() { return _exp_js__WEBPACK_IMPORTED_MODULE_5__["expOut"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "easeExpInOut", function() { return _exp_js__WEBPACK_IMPORTED_MODULE_5__["expInOut"]; }); /* harmony import */ var _circle_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./circle.js */ "./node_modules/_d3-ease@1.0.6@d3-ease/src/circle.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "easeCircle", function() { return _circle_js__WEBPACK_IMPORTED_MODULE_6__["circleInOut"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "easeCircleIn", function() { return _circle_js__WEBPACK_IMPORTED_MODULE_6__["circleIn"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "easeCircleOut", function() { return _circle_js__WEBPACK_IMPORTED_MODULE_6__["circleOut"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "easeCircleInOut", function() { return _circle_js__WEBPACK_IMPORTED_MODULE_6__["circleInOut"]; }); /* harmony import */ var _bounce_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./bounce.js */ "./node_modules/_d3-ease@1.0.6@d3-ease/src/bounce.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "easeBounce", function() { return _bounce_js__WEBPACK_IMPORTED_MODULE_7__["bounceOut"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "easeBounceIn", function() { return _bounce_js__WEBPACK_IMPORTED_MODULE_7__["bounceIn"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "easeBounceOut", function() { return _bounce_js__WEBPACK_IMPORTED_MODULE_7__["bounceOut"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "easeBounceInOut", function() { return _bounce_js__WEBPACK_IMPORTED_MODULE_7__["bounceInOut"]; }); /* harmony import */ var _back_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./back.js */ "./node_modules/_d3-ease@1.0.6@d3-ease/src/back.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "easeBack", function() { return _back_js__WEBPACK_IMPORTED_MODULE_8__["backInOut"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "easeBackIn", function() { return _back_js__WEBPACK_IMPORTED_MODULE_8__["backIn"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "easeBackOut", function() { return _back_js__WEBPACK_IMPORTED_MODULE_8__["backOut"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "easeBackInOut", function() { return _back_js__WEBPACK_IMPORTED_MODULE_8__["backInOut"]; }); /* harmony import */ var _elastic_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./elastic.js */ "./node_modules/_d3-ease@1.0.6@d3-ease/src/elastic.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "easeElastic", function() { return _elastic_js__WEBPACK_IMPORTED_MODULE_9__["elasticOut"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "easeElasticIn", function() { return _elastic_js__WEBPACK_IMPORTED_MODULE_9__["elasticIn"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "easeElasticOut", function() { return _elastic_js__WEBPACK_IMPORTED_MODULE_9__["elasticOut"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "easeElasticInOut", function() { return _elastic_js__WEBPACK_IMPORTED_MODULE_9__["elasticInOut"]; }); /***/ }), /***/ "./node_modules/_d3-ease@1.0.6@d3-ease/src/linear.js": /*!***********************************************************!*\ !*** ./node_modules/_d3-ease@1.0.6@d3-ease/src/linear.js ***! \***********************************************************/ /*! exports provided: linear */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "linear", function() { return linear; }); function linear(t) { return +t; } /***/ }), /***/ "./node_modules/_d3-ease@1.0.6@d3-ease/src/poly.js": /*!*********************************************************!*\ !*** ./node_modules/_d3-ease@1.0.6@d3-ease/src/poly.js ***! \*********************************************************/ /*! exports provided: polyIn, polyOut, polyInOut */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "polyIn", function() { return polyIn; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "polyOut", function() { return polyOut; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "polyInOut", function() { return polyInOut; }); var exponent = 3; var polyIn = function custom(e) { e = +e; function polyIn(t) { return Math.pow(t, e); } polyIn.exponent = custom; return polyIn; }(exponent); var polyOut = function custom(e) { e = +e; function polyOut(t) { return 1 - Math.pow(1 - t, e); } polyOut.exponent = custom; return polyOut; }(exponent); var polyInOut = function custom(e) { e = +e; function polyInOut(t) { return ((t *= 2) <= 1 ? Math.pow(t, e) : 2 - Math.pow(2 - t, e)) / 2; } polyInOut.exponent = custom; return polyInOut; }(exponent); /***/ }), /***/ "./node_modules/_d3-ease@1.0.6@d3-ease/src/quad.js": /*!*********************************************************!*\ !*** ./node_modules/_d3-ease@1.0.6@d3-ease/src/quad.js ***! \*********************************************************/ /*! exports provided: quadIn, quadOut, quadInOut */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "quadIn", function() { return quadIn; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "quadOut", function() { return quadOut; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "quadInOut", function() { return quadInOut; }); function quadIn(t) { return t * t; } function quadOut(t) { return t * (2 - t); } function quadInOut(t) { return ((t *= 2) <= 1 ? t * t : --t * (2 - t) + 1) / 2; } /***/ }), /***/ "./node_modules/_d3-ease@1.0.6@d3-ease/src/sin.js": /*!********************************************************!*\ !*** ./node_modules/_d3-ease@1.0.6@d3-ease/src/sin.js ***! \********************************************************/ /*! exports provided: sinIn, sinOut, sinInOut */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "sinIn", function() { return sinIn; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "sinOut", function() { return sinOut; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "sinInOut", function() { return sinInOut; }); var pi = Math.PI, halfPi = pi / 2; function sinIn(t) { return 1 - Math.cos(t * halfPi); } function sinOut(t) { return Math.sin(t * halfPi); } function sinInOut(t) { return (1 - Math.cos(pi * t)) / 2; } /***/ }), /***/ "./node_modules/_d3-interpolate@1.4.0@d3-interpolate/src/array.js": /*!************************************************************************!*\ !*** ./node_modules/_d3-interpolate@1.4.0@d3-interpolate/src/array.js ***! \************************************************************************/ /*! exports provided: default, genericArray */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "genericArray", function() { return genericArray; }); /* harmony import */ var _value_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./value.js */ "./node_modules/_d3-interpolate@1.4.0@d3-interpolate/src/value.js"); /* harmony import */ var _numberArray_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./numberArray.js */ "./node_modules/_d3-interpolate@1.4.0@d3-interpolate/src/numberArray.js"); /* harmony default export */ __webpack_exports__["default"] = (function (a, b) { return (Object(_numberArray_js__WEBPACK_IMPORTED_MODULE_1__["isNumberArray"])(b) ? _numberArray_js__WEBPACK_IMPORTED_MODULE_1__["default"] : genericArray)(a, b); }); function genericArray(a, b) { var nb = b ? b.length : 0, na = a ? Math.min(nb, a.length) : 0, x = new Array(na), c = new Array(nb), i; for (i = 0; i < na; ++i) x[i] = Object(_value_js__WEBPACK_IMPORTED_MODULE_0__["default"])(a[i], b[i]); for (; i < nb; ++i) c[i] = b[i]; return function (t) { for (i = 0; i < na; ++i) c[i] = x[i](t); return c; }; } /***/ }), /***/ "./node_modules/_d3-interpolate@1.4.0@d3-interpolate/src/basis.js": /*!************************************************************************!*\ !*** ./node_modules/_d3-interpolate@1.4.0@d3-interpolate/src/basis.js ***! \************************************************************************/ /*! exports provided: basis, default */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "basis", function() { return basis; }); function basis(t1, v0, v1, v2, v3) { var t2 = t1 * t1, t3 = t2 * t1; return ((1 - 3 * t1 + 3 * t2 - t3) * v0 + (4 - 6 * t2 + 3 * t3) * v1 + (1 + 3 * t1 + 3 * t2 - 3 * t3) * v2 + t3 * v3) / 6; } /* harmony default export */ __webpack_exports__["default"] = (function (values) { var n = values.length - 1; return function (t) { var i = t <= 0 ? t = 0 : t >= 1 ? (t = 1, n - 1) : Math.floor(t * n), v1 = values[i], v2 = values[i + 1], v0 = i > 0 ? values[i - 1] : 2 * v1 - v2, v3 = i < n - 1 ? values[i + 2] : 2 * v2 - v1; return basis((t - i / n) * n, v0, v1, v2, v3); }; }); /***/ }), /***/ "./node_modules/_d3-interpolate@1.4.0@d3-interpolate/src/basisClosed.js": /*!******************************************************************************!*\ !*** ./node_modules/_d3-interpolate@1.4.0@d3-interpolate/src/basisClosed.js ***! \******************************************************************************/ /*! exports provided: default */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony import */ var _basis_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./basis.js */ "./node_modules/_d3-interpolate@1.4.0@d3-interpolate/src/basis.js"); /* harmony default export */ __webpack_exports__["default"] = (function (values) { var n = values.length; return function (t) { var i = Math.floor(((t %= 1) < 0 ? ++t : t) * n), v0 = values[(i + n - 1) % n], v1 = values[i % n], v2 = values[(i + 1) % n], v3 = values[(i + 2) % n]; return Object(_basis_js__WEBPACK_IMPORTED_MODULE_0__["basis"])((t - i / n) * n, v0, v1, v2, v3); }; }); /***/ }), /***/ "./node_modules/_d3-interpolate@1.4.0@d3-interpolate/src/color.js": /*!************************************************************************!*\ !*** ./node_modules/_d3-interpolate@1.4.0@d3-interpolate/src/color.js ***! \************************************************************************/ /*! exports provided: hue, gamma, default */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "hue", function() { return hue; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "gamma", function() { return gamma; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return nogamma; }); /* harmony import */ var _constant_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./constant.js */ "./node_modules/_d3-interpolate@1.4.0@d3-interpolate/src/constant.js"); function linear(a, d) { return function (t) { return a + t * d; }; } function exponential(a, b, y) { return a = Math.pow(a, y), b = Math.pow(b, y) - a, y = 1 / y, function (t) { return Math.pow(a + t * b, y); }; } function hue(a, b) { var d = b - a; return d ? linear(a, d > 180 || d < -180 ? d - 360 * Math.round(d / 360) : d) : Object(_constant_js__WEBPACK_IMPORTED_MODULE_0__["default"])(isNaN(a) ? b : a); } function gamma(y) { return (y = +y) === 1 ? nogamma : function (a, b) { return b - a ? exponential(a, b, y) : Object(_constant_js__WEBPACK_IMPORTED_MODULE_0__["default"])(isNaN(a) ? b : a); }; } function nogamma(a, b) { var d = b - a; return d ? linear(a, d) : Object(_constant_js__WEBPACK_IMPORTED_MODULE_0__["default"])(isNaN(a) ? b : a); } /***/ }), /***/ "./node_modules/_d3-interpolate@1.4.0@d3-interpolate/src/constant.js": /*!***************************************************************************!*\ !*** ./node_modules/_d3-interpolate@1.4.0@d3-interpolate/src/constant.js ***! \***************************************************************************/ /*! exports provided: default */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony default export */ __webpack_exports__["default"] = (function (x) { return function () { return x; }; }); /***/ }), /***/ "./node_modules/_d3-interpolate@1.4.0@d3-interpolate/src/cubehelix.js": /*!****************************************************************************!*\ !*** ./node_modules/_d3-interpolate@1.4.0@d3-interpolate/src/cubehelix.js ***! \****************************************************************************/ /*! exports provided: default, cubehelixLong */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "cubehelixLong", function() { return cubehelixLong; }); /* harmony import */ var d3_color__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! d3-color */ "./node_modules/_d3-color@1.4.1@d3-color/src/index.js"); /* harmony import */ var _color_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./color.js */ "./node_modules/_d3-interpolate@1.4.0@d3-interpolate/src/color.js"); function cubehelix(hue) { return function cubehelixGamma(y) { y = +y; function cubehelix(start, end) { var h = hue((start = Object(d3_color__WEBPACK_IMPORTED_MODULE_0__["cubehelix"])(start)).h, (end = Object(d3_color__WEBPACK_IMPORTED_MODULE_0__["cubehelix"])(end)).h), s = Object(_color_js__WEBPACK_IMPORTED_MODULE_1__["default"])(start.s, end.s), l = Object(_color_js__WEBPACK_IMPORTED_MODULE_1__["default"])(start.l, end.l), opacity = Object(_color_js__WEBPACK_IMPORTED_MODULE_1__["default"])(start.opacity, end.opacity); return function (t) { start.h = h(t); start.s = s(t); start.l = l(Math.pow(t, y)); start.opacity = opacity(t); return start + ""; }; } cubehelix.gamma = cubehelixGamma; return cubehelix; }(1); } /* harmony default export */ __webpack_exports__["default"] = (cubehelix(_color_js__WEBPACK_IMPORTED_MODULE_1__["hue"])); var cubehelixLong = cubehelix(_color_js__WEBPACK_IMPORTED_MODULE_1__["default"]); /***/ }), /***/ "./node_modules/_d3-interpolate@1.4.0@d3-interpolate/src/date.js": /*!***********************************************************************!*\ !*** ./node_modules/_d3-interpolate@1.4.0@d3-interpolate/src/date.js ***! \***********************************************************************/ /*! exports provided: default */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony default export */ __webpack_exports__["default"] = (function (a, b) { var d = new Date(); return a = +a, b = +b, function (t) { return d.setTime(a * (1 - t) + b * t), d; }; }); /***/ }), /***/ "./node_modules/_d3-interpolate@1.4.0@d3-interpolate/src/discrete.js": /*!***************************************************************************!*\ !*** ./node_modules/_d3-interpolate@1.4.0@d3-interpolate/src/discrete.js ***! \***************************************************************************/ /*! exports provided: default */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony default export */ __webpack_exports__["default"] = (function (range) { var n = range.length; return function (t) { return range[Math.max(0, Math.min(n - 1, Math.floor(t * n)))]; }; }); /***/ }), /***/ "./node_modules/_d3-interpolate@1.4.0@d3-interpolate/src/hcl.js": /*!**********************************************************************!*\ !*** ./node_modules/_d3-interpolate@1.4.0@d3-interpolate/src/hcl.js ***! \**********************************************************************/ /*! exports provided: default, hclLong */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "hclLong", function() { return hclLong; }); /* harmony import */ var d3_color__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! d3-color */ "./node_modules/_d3-color@1.4.1@d3-color/src/index.js"); /* harmony import */ var _color_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./color.js */ "./node_modules/_d3-interpolate@1.4.0@d3-interpolate/src/color.js"); function hcl(hue) { return function (start, end) { var h = hue((start = Object(d3_color__WEBPACK_IMPORTED_MODULE_0__["hcl"])(start)).h, (end = Object(d3_color__WEBPACK_IMPORTED_MODULE_0__["hcl"])(end)).h), c = Object(_color_js__WEBPACK_IMPORTED_MODULE_1__["default"])(start.c, end.c), l = Object(_color_js__WEBPACK_IMPORTED_MODULE_1__["default"])(start.l, end.l), opacity = Object(_color_js__WEBPACK_IMPORTED_MODULE_1__["default"])(start.opacity, end.opacity); return function (t) { start.h = h(t); start.c = c(t); start.l = l(t); start.opacity = opacity(t); return start + ""; }; }; } /* harmony default export */ __webpack_exports__["default"] = (hcl(_color_js__WEBPACK_IMPORTED_MODULE_1__["hue"])); var hclLong = hcl(_color_js__WEBPACK_IMPORTED_MODULE_1__["default"]); /***/ }), /***/ "./node_modules/_d3-interpolate@1.4.0@d3-interpolate/src/hsl.js": /*!**********************************************************************!*\ !*** ./node_modules/_d3-interpolate@1.4.0@d3-interpolate/src/hsl.js ***! \**********************************************************************/ /*! exports provided: default, hslLong */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "hslLong", function() { return hslLong; }); /* harmony import */ var d3_color__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! d3-color */ "./node_modules/_d3-color@1.4.1@d3-color/src/index.js"); /* harmony import */ var _color_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./color.js */ "./node_modules/_d3-interpolate@1.4.0@d3-interpolate/src/color.js"); function hsl(hue) { return function (start, end) { var h = hue((start = Object(d3_color__WEBPACK_IMPORTED_MODULE_0__["hsl"])(start)).h, (end = Object(d3_color__WEBPACK_IMPORTED_MODULE_0__["hsl"])(end)).h), s = Object(_color_js__WEBPACK_IMPORTED_MODULE_1__["default"])(start.s, end.s), l = Object(_color_js__WEBPACK_IMPORTED_MODULE_1__["default"])(start.l, end.l), opacity = Object(_color_js__WEBPACK_IMPORTED_MODULE_1__["default"])(start.opacity, end.opacity); return function (t) { start.h = h(t); start.s = s(t); start.l = l(t); start.opacity = opacity(t); return start + ""; }; }; } /* harmony default export */ __webpack_exports__["default"] = (hsl(_color_js__WEBPACK_IMPORTED_MODULE_1__["hue"])); var hslLong = hsl(_color_js__WEBPACK_IMPORTED_MODULE_1__["default"]); /***/ }), /***/ "./node_modules/_d3-interpolate@1.4.0@d3-interpolate/src/hue.js": /*!**********************************************************************!*\ !*** ./node_modules/_d3-interpolate@1.4.0@d3-interpolate/src/hue.js ***! \**********************************************************************/ /*! exports provided: default */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony import */ var _color_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./color.js */ "./node_modules/_d3-interpolate@1.4.0@d3-interpolate/src/color.js"); /* harmony default export */ __webpack_exports__["default"] = (function (a, b) { var i = Object(_color_js__WEBPACK_IMPORTED_MODULE_0__["hue"])(+a, +b); return function (t) { var x = i(t); return x - 360 * Math.floor(x / 360); }; }); /***/ }), /***/ "./node_modules/_d3-interpolate@1.4.0@d3-interpolate/src/index.js": /*!************************************************************************!*\ !*** ./node_modules/_d3-interpolate@1.4.0@d3-interpolate/src/index.js ***! \************************************************************************/ /*! exports provided: interpolate, interpolateArray, interpolateBasis, interpolateBasisClosed, interpolateDate, interpolateDiscrete, interpolateHue, interpolateNumber, interpolateNumberArray, interpolateObject, interpolateRound, interpolateString, interpolateTransformCss, interpolateTransformSvg, interpolateZoom, interpolateRgb, interpolateRgbBasis, interpolateRgbBasisClosed, interpolateHsl, interpolateHslLong, interpolateLab, interpolateHcl, interpolateHclLong, interpolateCubehelix, interpolateCubehelixLong, piecewise, quantize */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony import */ var _value_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./value.js */ "./node_modules/_d3-interpolate@1.4.0@d3-interpolate/src/value.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "interpolate", function() { return _value_js__WEBPACK_IMPORTED_MODULE_0__["default"]; }); /* harmony import */ var _array_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./array.js */ "./node_modules/_d3-interpolate@1.4.0@d3-interpolate/src/array.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "interpolateArray", function() { return _array_js__WEBPACK_IMPORTED_MODULE_1__["default"]; }); /* harmony import */ var _basis_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./basis.js */ "./node_modules/_d3-interpolate@1.4.0@d3-interpolate/src/basis.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "interpolateBasis", function() { return _basis_js__WEBPACK_IMPORTED_MODULE_2__["default"]; }); /* harmony import */ var _basisClosed_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./basisClosed.js */ "./node_modules/_d3-interpolate@1.4.0@d3-interpolate/src/basisClosed.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "interpolateBasisClosed", function() { return _basisClosed_js__WEBPACK_IMPORTED_MODULE_3__["default"]; }); /* harmony import */ var _date_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./date.js */ "./node_modules/_d3-interpolate@1.4.0@d3-interpolate/src/date.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "interpolateDate", function() { return _date_js__WEBPACK_IMPORTED_MODULE_4__["default"]; }); /* harmony import */ var _discrete_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./discrete.js */ "./node_modules/_d3-interpolate@1.4.0@d3-interpolate/src/discrete.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "interpolateDiscrete", function() { return _discrete_js__WEBPACK_IMPORTED_MODULE_5__["default"]; }); /* harmony import */ var _hue_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./hue.js */ "./node_modules/_d3-interpolate@1.4.0@d3-interpolate/src/hue.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "interpolateHue", function() { return _hue_js__WEBPACK_IMPORTED_MODULE_6__["default"]; }); /* harmony import */ var _number_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./number.js */ "./node_modules/_d3-interpolate@1.4.0@d3-interpolate/src/number.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "interpolateNumber", function() { return _number_js__WEBPACK_IMPORTED_MODULE_7__["default"]; }); /* harmony import */ var _numberArray_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./numberArray.js */ "./node_modules/_d3-interpolate@1.4.0@d3-interpolate/src/numberArray.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "interpolateNumberArray", function() { return _numberArray_js__WEBPACK_IMPORTED_MODULE_8__["default"]; }); /* harmony import */ var _object_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./object.js */ "./node_modules/_d3-interpolate@1.4.0@d3-interpolate/src/object.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "interpolateObject", function() { return _object_js__WEBPACK_IMPORTED_MODULE_9__["default"]; }); /* harmony import */ var _round_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./round.js */ "./node_modules/_d3-interpolate@1.4.0@d3-interpolate/src/round.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "interpolateRound", function() { return _round_js__WEBPACK_IMPORTED_MODULE_10__["default"]; }); /* harmony import */ var _string_js__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./string.js */ "./node_modules/_d3-interpolate@1.4.0@d3-interpolate/src/string.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "interpolateString", function() { return _string_js__WEBPACK_IMPORTED_MODULE_11__["default"]; }); /* harmony import */ var _transform_index_js__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./transform/index.js */ "./node_modules/_d3-interpolate@1.4.0@d3-interpolate/src/transform/index.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "interpolateTransformCss", function() { return _transform_index_js__WEBPACK_IMPORTED_MODULE_12__["interpolateTransformCss"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "interpolateTransformSvg", function() { return _transform_index_js__WEBPACK_IMPORTED_MODULE_12__["interpolateTransformSvg"]; }); /* harmony import */ var _zoom_js__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./zoom.js */ "./node_modules/_d3-interpolate@1.4.0@d3-interpolate/src/zoom.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "interpolateZoom", function() { return _zoom_js__WEBPACK_IMPORTED_MODULE_13__["default"]; }); /* harmony import */ var _rgb_js__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./rgb.js */ "./node_modules/_d3-interpolate@1.4.0@d3-interpolate/src/rgb.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "interpolateRgb", function() { return _rgb_js__WEBPACK_IMPORTED_MODULE_14__["default"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "interpolateRgbBasis", function() { return _rgb_js__WEBPACK_IMPORTED_MODULE_14__["rgbBasis"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "interpolateRgbBasisClosed", function() { return _rgb_js__WEBPACK_IMPORTED_MODULE_14__["rgbBasisClosed"]; }); /* harmony import */ var _hsl_js__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./hsl.js */ "./node_modules/_d3-interpolate@1.4.0@d3-interpolate/src/hsl.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "interpolateHsl", function() { return _hsl_js__WEBPACK_IMPORTED_MODULE_15__["default"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "interpolateHslLong", function() { return _hsl_js__WEBPACK_IMPORTED_MODULE_15__["hslLong"]; }); /* harmony import */ var _lab_js__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./lab.js */ "./node_modules/_d3-interpolate@1.4.0@d3-interpolate/src/lab.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "interpolateLab", function() { return _lab_js__WEBPACK_IMPORTED_MODULE_16__["default"]; }); /* harmony import */ var _hcl_js__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ./hcl.js */ "./node_modules/_d3-interpolate@1.4.0@d3-interpolate/src/hcl.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "interpolateHcl", function() { return _hcl_js__WEBPACK_IMPORTED_MODULE_17__["default"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "interpolateHclLong", function() { return _hcl_js__WEBPACK_IMPORTED_MODULE_17__["hclLong"]; }); /* harmony import */ var _cubehelix_js__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ./cubehelix.js */ "./node_modules/_d3-interpolate@1.4.0@d3-interpolate/src/cubehelix.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "interpolateCubehelix", function() { return _cubehelix_js__WEBPACK_IMPORTED_MODULE_18__["default"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "interpolateCubehelixLong", function() { return _cubehelix_js__WEBPACK_IMPORTED_MODULE_18__["cubehelixLong"]; }); /* harmony import */ var _piecewise_js__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! ./piecewise.js */ "./node_modules/_d3-interpolate@1.4.0@d3-interpolate/src/piecewise.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "piecewise", function() { return _piecewise_js__WEBPACK_IMPORTED_MODULE_19__["default"]; }); /* harmony import */ var _quantize_js__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(/*! ./quantize.js */ "./node_modules/_d3-interpolate@1.4.0@d3-interpolate/src/quantize.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "quantize", function() { return _quantize_js__WEBPACK_IMPORTED_MODULE_20__["default"]; }); /***/ }), /***/ "./node_modules/_d3-interpolate@1.4.0@d3-interpolate/src/lab.js": /*!**********************************************************************!*\ !*** ./node_modules/_d3-interpolate@1.4.0@d3-interpolate/src/lab.js ***! \**********************************************************************/ /*! exports provided: default */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return lab; }); /* harmony import */ var d3_color__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! d3-color */ "./node_modules/_d3-color@1.4.1@d3-color/src/index.js"); /* harmony import */ var _color_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./color.js */ "./node_modules/_d3-interpolate@1.4.0@d3-interpolate/src/color.js"); function lab(start, end) { var l = Object(_color_js__WEBPACK_IMPORTED_MODULE_1__["default"])((start = Object(d3_color__WEBPACK_IMPORTED_MODULE_0__["lab"])(start)).l, (end = Object(d3_color__WEBPACK_IMPORTED_MODULE_0__["lab"])(end)).l), a = Object(_color_js__WEBPACK_IMPORTED_MODULE_1__["default"])(start.a, end.a), b = Object(_color_js__WEBPACK_IMPORTED_MODULE_1__["default"])(start.b, end.b), opacity = Object(_color_js__WEBPACK_IMPORTED_MODULE_1__["default"])(start.opacity, end.opacity); return function (t) { start.l = l(t); start.a = a(t); start.b = b(t); start.opacity = opacity(t); return start + ""; }; } /***/ }), /***/ "./node_modules/_d3-interpolate@1.4.0@d3-interpolate/src/number.js": /*!*************************************************************************!*\ !*** ./node_modules/_d3-interpolate@1.4.0@d3-interpolate/src/number.js ***! \*************************************************************************/ /*! exports provided: default */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony default export */ __webpack_exports__["default"] = (function (a, b) { return a = +a, b = +b, function (t) { return a * (1 - t) + b * t; }; }); /***/ }), /***/ "./node_modules/_d3-interpolate@1.4.0@d3-interpolate/src/numberArray.js": /*!******************************************************************************!*\ !*** ./node_modules/_d3-interpolate@1.4.0@d3-interpolate/src/numberArray.js ***! \******************************************************************************/ /*! exports provided: default, isNumberArray */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isNumberArray", function() { return isNumberArray; }); /* harmony default export */ __webpack_exports__["default"] = (function (a, b) { if (!b) b = []; var n = a ? Math.min(b.length, a.length) : 0, c = b.slice(), i; return function (t) { for (i = 0; i < n; ++i) c[i] = a[i] * (1 - t) + b[i] * t; return c; }; }); function isNumberArray(x) { return ArrayBuffer.isView(x) && !(x instanceof DataView); } /***/ }), /***/ "./node_modules/_d3-interpolate@1.4.0@d3-interpolate/src/object.js": /*!*************************************************************************!*\ !*** ./node_modules/_d3-interpolate@1.4.0@d3-interpolate/src/object.js ***! \*************************************************************************/ /*! exports provided: default */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony import */ var _value_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./value.js */ "./node_modules/_d3-interpolate@1.4.0@d3-interpolate/src/value.js"); /* harmony default export */ __webpack_exports__["default"] = (function (a, b) { var i = {}, c = {}, k; if (a === null || typeof a !== "object") a = {}; if (b === null || typeof b !== "object") b = {}; for (k in b) { if (k in a) { i[k] = Object(_value_js__WEBPACK_IMPORTED_MODULE_0__["default"])(a[k], b[k]); } else { c[k] = b[k]; } } return function (t) { for (k in i) c[k] = i[k](t); return c; }; }); /***/ }), /***/ "./node_modules/_d3-interpolate@1.4.0@d3-interpolate/src/piecewise.js": /*!****************************************************************************!*\ !*** ./node_modules/_d3-interpolate@1.4.0@d3-interpolate/src/piecewise.js ***! \****************************************************************************/ /*! exports provided: default */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return piecewise; }); function piecewise(interpolate, values) { var i = 0, n = values.length - 1, v = values[0], I = new Array(n < 0 ? 0 : n); while (i < n) I[i] = interpolate(v, v = values[++i]); return function (t) { var i = Math.max(0, Math.min(n - 1, Math.floor(t *= n))); return I[i](t - i); }; } /***/ }), /***/ "./node_modules/_d3-interpolate@1.4.0@d3-interpolate/src/quantize.js": /*!***************************************************************************!*\ !*** ./node_modules/_d3-interpolate@1.4.0@d3-interpolate/src/quantize.js ***! \***************************************************************************/ /*! exports provided: default */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony default export */ __webpack_exports__["default"] = (function (interpolator, n) { var samples = new Array(n); for (var i = 0; i < n; ++i) samples[i] = interpolator(i / (n - 1)); return samples; }); /***/ }), /***/ "./node_modules/_d3-interpolate@1.4.0@d3-interpolate/src/rgb.js": /*!**********************************************************************!*\ !*** ./node_modules/_d3-interpolate@1.4.0@d3-interpolate/src/rgb.js ***! \**********************************************************************/ /*! exports provided: default, rgbBasis, rgbBasisClosed */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "rgbBasis", function() { return rgbBasis; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "rgbBasisClosed", function() { return rgbBasisClosed; }); /* harmony import */ var d3_color__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! d3-color */ "./node_modules/_d3-color@1.4.1@d3-color/src/index.js"); /* harmony import */ var _basis_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./basis.js */ "./node_modules/_d3-interpolate@1.4.0@d3-interpolate/src/basis.js"); /* harmony import */ var _basisClosed_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./basisClosed.js */ "./node_modules/_d3-interpolate@1.4.0@d3-interpolate/src/basisClosed.js"); /* harmony import */ var _color_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./color.js */ "./node_modules/_d3-interpolate@1.4.0@d3-interpolate/src/color.js"); /* harmony default export */ __webpack_exports__["default"] = ((function rgbGamma(y) { var color = Object(_color_js__WEBPACK_IMPORTED_MODULE_3__["gamma"])(y); function rgb(start, end) { var r = color((start = Object(d3_color__WEBPACK_IMPORTED_MODULE_0__["rgb"])(start)).r, (end = Object(d3_color__WEBPACK_IMPORTED_MODULE_0__["rgb"])(end)).r), g = color(start.g, end.g), b = color(start.b, end.b), opacity = Object(_color_js__WEBPACK_IMPORTED_MODULE_3__["default"])(start.opacity, end.opacity); return function (t) { start.r = r(t); start.g = g(t); start.b = b(t); start.opacity = opacity(t); return start + ""; }; } rgb.gamma = rgbGamma; return rgb; })(1)); function rgbSpline(spline) { return function (colors) { var n = colors.length, r = new Array(n), g = new Array(n), b = new Array(n), i, color; for (i = 0; i < n; ++i) { color = Object(d3_color__WEBPACK_IMPORTED_MODULE_0__["rgb"])(colors[i]); r[i] = color.r || 0; g[i] = color.g || 0; b[i] = color.b || 0; } r = spline(r); g = spline(g); b = spline(b); color.opacity = 1; return function (t) { color.r = r(t); color.g = g(t); color.b = b(t); return color + ""; }; }; } var rgbBasis = rgbSpline(_basis_js__WEBPACK_IMPORTED_MODULE_1__["default"]); var rgbBasisClosed = rgbSpline(_basisClosed_js__WEBPACK_IMPORTED_MODULE_2__["default"]); /***/ }), /***/ "./node_modules/_d3-interpolate@1.4.0@d3-interpolate/src/round.js": /*!************************************************************************!*\ !*** ./node_modules/_d3-interpolate@1.4.0@d3-interpolate/src/round.js ***! \************************************************************************/ /*! exports provided: default */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony default export */ __webpack_exports__["default"] = (function (a, b) { return a = +a, b = +b, function (t) { return Math.round(a * (1 - t) + b * t); }; }); /***/ }), /***/ "./node_modules/_d3-interpolate@1.4.0@d3-interpolate/src/string.js": /*!*************************************************************************!*\ !*** ./node_modules/_d3-interpolate@1.4.0@d3-interpolate/src/string.js ***! \*************************************************************************/ /*! exports provided: default */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony import */ var _number_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./number.js */ "./node_modules/_d3-interpolate@1.4.0@d3-interpolate/src/number.js"); var reA = /[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g, reB = new RegExp(reA.source, "g"); function zero(b) { return function () { return b; }; } function one(b) { return function (t) { return b(t) + ""; }; } /* harmony default export */ __webpack_exports__["default"] = (function (a, b) { var bi = reA.lastIndex = reB.lastIndex = 0, // scan index for next number in b am, // current match in a bm, // current match in b bs, // string preceding current number in b, if any i = -1, // index in s s = [], // string constants and placeholders q = []; // number interpolators // Coerce inputs to strings. a = a + "", b = b + ""; // Interpolate pairs of numbers in a & b. while ((am = reA.exec(a)) && (bm = reB.exec(b))) { if ((bs = bm.index) > bi) { // a string precedes the next number in b bs = b.slice(bi, bs); if (s[i]) s[i] += bs; // coalesce with previous string else s[++i] = bs; } if ((am = am[0]) === (bm = bm[0])) { // numbers in a & b match if (s[i]) s[i] += bm; // coalesce with previous string else s[++i] = bm; } else { // interpolate non-matching numbers s[++i] = null; q.push({ i: i, x: Object(_number_js__WEBPACK_IMPORTED_MODULE_0__["default"])(am, bm) }); } bi = reB.lastIndex; } // Add remains of b. if (bi < b.length) { bs = b.slice(bi); if (s[i]) s[i] += bs; // coalesce with previous string else s[++i] = bs; } // Special optimization for only a single match. // Otherwise, interpolate each of the numbers and rejoin the string. return s.length < 2 ? q[0] ? one(q[0].x) : zero(b) : (b = q.length, function (t) { for (var i = 0, o; i < b; ++i) s[(o = q[i]).i] = o.x(t); return s.join(""); }); }); /***/ }), /***/ "./node_modules/_d3-interpolate@1.4.0@d3-interpolate/src/transform/decompose.js": /*!**************************************************************************************!*\ !*** ./node_modules/_d3-interpolate@1.4.0@d3-interpolate/src/transform/decompose.js ***! \**************************************************************************************/ /*! exports provided: identity, default */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "identity", function() { return identity; }); var degrees = 180 / Math.PI; var identity = { translateX: 0, translateY: 0, rotate: 0, skewX: 0, scaleX: 1, scaleY: 1 }; /* harmony default export */ __webpack_exports__["default"] = (function (a, b, c, d, e, f) { var scaleX, scaleY, skewX; if (scaleX = Math.sqrt(a * a + b * b)) a /= scaleX, b /= scaleX; if (skewX = a * c + b * d) c -= a * skewX, d -= b * skewX; if (scaleY = Math.sqrt(c * c + d * d)) c /= scaleY, d /= scaleY, skewX /= scaleY; if (a * d < b * c) a = -a, b = -b, skewX = -skewX, scaleX = -scaleX; return { translateX: e, translateY: f, rotate: Math.atan2(b, a) * degrees, skewX: Math.atan(skewX) * degrees, scaleX: scaleX, scaleY: scaleY }; }); /***/ }), /***/ "./node_modules/_d3-interpolate@1.4.0@d3-interpolate/src/transform/index.js": /*!**********************************************************************************!*\ !*** ./node_modules/_d3-interpolate@1.4.0@d3-interpolate/src/transform/index.js ***! \**********************************************************************************/ /*! exports provided: interpolateTransformCss, interpolateTransformSvg */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "interpolateTransformCss", function() { return interpolateTransformCss; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "interpolateTransformSvg", function() { return interpolateTransformSvg; }); /* harmony import */ var _number_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../number.js */ "./node_modules/_d3-interpolate@1.4.0@d3-interpolate/src/number.js"); /* harmony import */ var _parse_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./parse.js */ "./node_modules/_d3-interpolate@1.4.0@d3-interpolate/src/transform/parse.js"); function interpolateTransform(parse, pxComma, pxParen, degParen) { function pop(s) { return s.length ? s.pop() + " " : ""; } function translate(xa, ya, xb, yb, s, q) { if (xa !== xb || ya !== yb) { var i = s.push("translate(", null, pxComma, null, pxParen); q.push({ i: i - 4, x: Object(_number_js__WEBPACK_IMPORTED_MODULE_0__["default"])(xa, xb) }, { i: i - 2, x: Object(_number_js__WEBPACK_IMPORTED_MODULE_0__["default"])(ya, yb) }); } else if (xb || yb) { s.push("translate(" + xb + pxComma + yb + pxParen); } } function rotate(a, b, s, q) { if (a !== b) { if (a - b > 180) b += 360;else if (b - a > 180) a += 360; // shortest path q.push({ i: s.push(pop(s) + "rotate(", null, degParen) - 2, x: Object(_number_js__WEBPACK_IMPORTED_MODULE_0__["default"])(a, b) }); } else if (b) { s.push(pop(s) + "rotate(" + b + degParen); } } function skewX(a, b, s, q) { if (a !== b) { q.push({ i: s.push(pop(s) + "skewX(", null, degParen) - 2, x: Object(_number_js__WEBPACK_IMPORTED_MODULE_0__["default"])(a, b) }); } else if (b) { s.push(pop(s) + "skewX(" + b + degParen); } } function scale(xa, ya, xb, yb, s, q) { if (xa !== xb || ya !== yb) { var i = s.push(pop(s) + "scale(", null, ",", null, ")"); q.push({ i: i - 4, x: Object(_number_js__WEBPACK_IMPORTED_MODULE_0__["default"])(xa, xb) }, { i: i - 2, x: Object(_number_js__WEBPACK_IMPORTED_MODULE_0__["default"])(ya, yb) }); } else if (xb !== 1 || yb !== 1) { s.push(pop(s) + "scale(" + xb + "," + yb + ")"); } } return function (a, b) { var s = [], // string constants and placeholders q = []; // number interpolators a = parse(a), b = parse(b); translate(a.translateX, a.translateY, b.translateX, b.translateY, s, q); rotate(a.rotate, b.rotate, s, q); skewX(a.skewX, b.skewX, s, q); scale(a.scaleX, a.scaleY, b.scaleX, b.scaleY, s, q); a = b = null; // gc return function (t) { var i = -1, n = q.length, o; while (++i < n) s[(o = q[i]).i] = o.x(t); return s.join(""); }; }; } var interpolateTransformCss = interpolateTransform(_parse_js__WEBPACK_IMPORTED_MODULE_1__["parseCss"], "px, ", "px)", "deg)"); var interpolateTransformSvg = interpolateTransform(_parse_js__WEBPACK_IMPORTED_MODULE_1__["parseSvg"], ", ", ")", ")"); /***/ }), /***/ "./node_modules/_d3-interpolate@1.4.0@d3-interpolate/src/transform/parse.js": /*!**********************************************************************************!*\ !*** ./node_modules/_d3-interpolate@1.4.0@d3-interpolate/src/transform/parse.js ***! \**********************************************************************************/ /*! exports provided: parseCss, parseSvg */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "parseCss", function() { return parseCss; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "parseSvg", function() { return parseSvg; }); /* harmony import */ var _decompose_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./decompose.js */ "./node_modules/_d3-interpolate@1.4.0@d3-interpolate/src/transform/decompose.js"); var cssNode, cssRoot, cssView, svgNode; function parseCss(value) { if (value === "none") return _decompose_js__WEBPACK_IMPORTED_MODULE_0__["identity"]; if (!cssNode) cssNode = document.createElement("DIV"), cssRoot = document.documentElement, cssView = document.defaultView; cssNode.style.transform = value; value = cssView.getComputedStyle(cssRoot.appendChild(cssNode), null).getPropertyValue("transform"); cssRoot.removeChild(cssNode); value = value.slice(7, -1).split(","); return Object(_decompose_js__WEBPACK_IMPORTED_MODULE_0__["default"])(+value[0], +value[1], +value[2], +value[3], +value[4], +value[5]); } function parseSvg(value) { if (value == null) return _decompose_js__WEBPACK_IMPORTED_MODULE_0__["identity"]; if (!svgNode) svgNode = document.createElementNS("http://www.w3.org/2000/svg", "g"); svgNode.setAttribute("transform", value); if (!(value = svgNode.transform.baseVal.consolidate())) return _decompose_js__WEBPACK_IMPORTED_MODULE_0__["identity"]; value = value.matrix; return Object(_decompose_js__WEBPACK_IMPORTED_MODULE_0__["default"])(value.a, value.b, value.c, value.d, value.e, value.f); } /***/ }), /***/ "./node_modules/_d3-interpolate@1.4.0@d3-interpolate/src/value.js": /*!************************************************************************!*\ !*** ./node_modules/_d3-interpolate@1.4.0@d3-interpolate/src/value.js ***! \************************************************************************/ /*! exports provided: default */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony import */ var d3_color__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! d3-color */ "./node_modules/_d3-color@1.4.1@d3-color/src/index.js"); /* harmony import */ var _rgb_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./rgb.js */ "./node_modules/_d3-interpolate@1.4.0@d3-interpolate/src/rgb.js"); /* harmony import */ var _array_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./array.js */ "./node_modules/_d3-interpolate@1.4.0@d3-interpolate/src/array.js"); /* harmony import */ var _date_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./date.js */ "./node_modules/_d3-interpolate@1.4.0@d3-interpolate/src/date.js"); /* harmony import */ var _number_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./number.js */ "./node_modules/_d3-interpolate@1.4.0@d3-interpolate/src/number.js"); /* harmony import */ var _object_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./object.js */ "./node_modules/_d3-interpolate@1.4.0@d3-interpolate/src/object.js"); /* harmony import */ var _string_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./string.js */ "./node_modules/_d3-interpolate@1.4.0@d3-interpolate/src/string.js"); /* harmony import */ var _constant_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./constant.js */ "./node_modules/_d3-interpolate@1.4.0@d3-interpolate/src/constant.js"); /* harmony import */ var _numberArray_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./numberArray.js */ "./node_modules/_d3-interpolate@1.4.0@d3-interpolate/src/numberArray.js"); /* harmony default export */ __webpack_exports__["default"] = (function (a, b) { var t = typeof b, c; return b == null || t === "boolean" ? Object(_constant_js__WEBPACK_IMPORTED_MODULE_7__["default"])(b) : (t === "number" ? _number_js__WEBPACK_IMPORTED_MODULE_4__["default"] : t === "string" ? (c = Object(d3_color__WEBPACK_IMPORTED_MODULE_0__["color"])(b)) ? (b = c, _rgb_js__WEBPACK_IMPORTED_MODULE_1__["default"]) : _string_js__WEBPACK_IMPORTED_MODULE_6__["default"] : b instanceof d3_color__WEBPACK_IMPORTED_MODULE_0__["color"] ? _rgb_js__WEBPACK_IMPORTED_MODULE_1__["default"] : b instanceof Date ? _date_js__WEBPACK_IMPORTED_MODULE_3__["default"] : Object(_numberArray_js__WEBPACK_IMPORTED_MODULE_8__["isNumberArray"])(b) ? _numberArray_js__WEBPACK_IMPORTED_MODULE_8__["default"] : Array.isArray(b) ? _array_js__WEBPACK_IMPORTED_MODULE_2__["genericArray"] : typeof b.valueOf !== "function" && typeof b.toString !== "function" || isNaN(b) ? _object_js__WEBPACK_IMPORTED_MODULE_5__["default"] : _number_js__WEBPACK_IMPORTED_MODULE_4__["default"])(a, b); }); /***/ }), /***/ "./node_modules/_d3-interpolate@1.4.0@d3-interpolate/src/zoom.js": /*!***********************************************************************!*\ !*** ./node_modules/_d3-interpolate@1.4.0@d3-interpolate/src/zoom.js ***! \***********************************************************************/ /*! exports provided: default */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); var rho = Math.SQRT2, rho2 = 2, rho4 = 4, epsilon2 = 1e-12; function cosh(x) { return ((x = Math.exp(x)) + 1 / x) / 2; } function sinh(x) { return ((x = Math.exp(x)) - 1 / x) / 2; } function tanh(x) { return ((x = Math.exp(2 * x)) - 1) / (x + 1); } // p0 = [ux0, uy0, w0] // p1 = [ux1, uy1, w1] /* harmony default export */ __webpack_exports__["default"] = (function (p0, p1) { var ux0 = p0[0], uy0 = p0[1], w0 = p0[2], ux1 = p1[0], uy1 = p1[1], w1 = p1[2], dx = ux1 - ux0, dy = uy1 - uy0, d2 = dx * dx + dy * dy, i, S; // Special case for u0 ≅ u1. if (d2 < epsilon2) { S = Math.log(w1 / w0) / rho; i = function (t) { return [ux0 + t * dx, uy0 + t * dy, w0 * Math.exp(rho * t * S)]; }; } // General case. else { var d1 = Math.sqrt(d2), b0 = (w1 * w1 - w0 * w0 + rho4 * d2) / (2 * w0 * rho2 * d1), b1 = (w1 * w1 - w0 * w0 - rho4 * d2) / (2 * w1 * rho2 * d1), r0 = Math.log(Math.sqrt(b0 * b0 + 1) - b0), r1 = Math.log(Math.sqrt(b1 * b1 + 1) - b1); S = (r1 - r0) / rho; i = function (t) { var s = t * S, coshr0 = cosh(r0), u = w0 / (rho2 * d1) * (coshr0 * tanh(rho * s + r0) - sinh(r0)); return [ux0 + u * dx, uy0 + u * dy, w0 * coshr0 / cosh(rho * s + r0)]; }; } i.duration = S * 1000; return i; }); /***/ }), /***/ "./node_modules/_d3-timer@1.0.10@d3-timer/src/index.js": /*!*************************************************************!*\ !*** ./node_modules/_d3-timer@1.0.10@d3-timer/src/index.js ***! \*************************************************************/ /*! exports provided: now, timer, timerFlush, timeout, interval */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony import */ var _timer_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./timer.js */ "./node_modules/_d3-timer@1.0.10@d3-timer/src/timer.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "now", function() { return _timer_js__WEBPACK_IMPORTED_MODULE_0__["now"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "timer", function() { return _timer_js__WEBPACK_IMPORTED_MODULE_0__["timer"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "timerFlush", function() { return _timer_js__WEBPACK_IMPORTED_MODULE_0__["timerFlush"]; }); /* harmony import */ var _timeout_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./timeout.js */ "./node_modules/_d3-timer@1.0.10@d3-timer/src/timeout.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "timeout", function() { return _timeout_js__WEBPACK_IMPORTED_MODULE_1__["default"]; }); /* harmony import */ var _interval_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./interval.js */ "./node_modules/_d3-timer@1.0.10@d3-timer/src/interval.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "interval", function() { return _interval_js__WEBPACK_IMPORTED_MODULE_2__["default"]; }); /***/ }), /***/ "./node_modules/_d3-timer@1.0.10@d3-timer/src/interval.js": /*!****************************************************************!*\ !*** ./node_modules/_d3-timer@1.0.10@d3-timer/src/interval.js ***! \****************************************************************/ /*! exports provided: default */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony import */ var _timer_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./timer.js */ "./node_modules/_d3-timer@1.0.10@d3-timer/src/timer.js"); /* harmony default export */ __webpack_exports__["default"] = (function (callback, delay, time) { var t = new _timer_js__WEBPACK_IMPORTED_MODULE_0__["Timer"](), total = delay; if (delay == null) return t.restart(callback, delay, time), t; delay = +delay, time = time == null ? Object(_timer_js__WEBPACK_IMPORTED_MODULE_0__["now"])() : +time; t.restart(function tick(elapsed) { elapsed += total; t.restart(tick, total += delay, time); callback(elapsed); }, delay, time); return t; }); /***/ }), /***/ "./node_modules/_d3-timer@1.0.10@d3-timer/src/timeout.js": /*!***************************************************************!*\ !*** ./node_modules/_d3-timer@1.0.10@d3-timer/src/timeout.js ***! \***************************************************************/ /*! exports provided: default */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony import */ var _timer_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./timer.js */ "./node_modules/_d3-timer@1.0.10@d3-timer/src/timer.js"); /* harmony default export */ __webpack_exports__["default"] = (function (callback, delay, time) { var t = new _timer_js__WEBPACK_IMPORTED_MODULE_0__["Timer"](); delay = delay == null ? 0 : +delay; t.restart(function (elapsed) { t.stop(); callback(elapsed + delay); }, delay, time); return t; }); /***/ }), /***/ "./node_modules/_d3-timer@1.0.10@d3-timer/src/timer.js": /*!*************************************************************!*\ !*** ./node_modules/_d3-timer@1.0.10@d3-timer/src/timer.js ***! \*************************************************************/ /*! exports provided: now, Timer, timer, timerFlush */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "now", function() { return now; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Timer", function() { return Timer; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "timer", function() { return timer; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "timerFlush", function() { return timerFlush; }); var frame = 0, // is an animation frame pending? timeout = 0, // is a timeout pending? interval = 0, // are any timers active? pokeDelay = 1000, // how frequently we check for clock skew taskHead, taskTail, clockLast = 0, clockNow = 0, clockSkew = 0, clock = typeof performance === "object" && performance.now ? performance : Date, setFrame = typeof window === "object" && window.requestAnimationFrame ? window.requestAnimationFrame.bind(window) : function (f) { setTimeout(f, 17); }; function now() { return clockNow || (setFrame(clearNow), clockNow = clock.now() + clockSkew); } function clearNow() { clockNow = 0; } function Timer() { this._call = this._time = this._next = null; } Timer.prototype = timer.prototype = { constructor: Timer, restart: function (callback, delay, time) { if (typeof callback !== "function") throw new TypeError("callback is not a function"); time = (time == null ? now() : +time) + (delay == null ? 0 : +delay); if (!this._next && taskTail !== this) { if (taskTail) taskTail._next = this;else taskHead = this; taskTail = this; } this._call = callback; this._time = time; sleep(); }, stop: function () { if (this._call) { this._call = null; this._time = Infinity; sleep(); } } }; function timer(callback, delay, time) { var t = new Timer(); t.restart(callback, delay, time); return t; } function timerFlush() { now(); // Get the current time, if not already set. ++frame; // Pretend we’ve set an alarm, if we haven’t already. var t = taskHead, e; while (t) { if ((e = clockNow - t._time) >= 0) t._call.call(null, e); t = t._next; } --frame; } function wake() { clockNow = (clockLast = clock.now()) + clockSkew; frame = timeout = 0; try { timerFlush(); } finally { frame = 0; nap(); clockNow = 0; } } function poke() { var now = clock.now(), delay = now - clockLast; if (delay > pokeDelay) clockSkew -= delay, clockLast = now; } function nap() { var t0, t1 = taskHead, t2, time = Infinity; while (t1) { if (t1._call) { if (time > t1._time) time = t1._time; t0 = t1, t1 = t1._next; } else { t2 = t1._next, t1._next = null; t1 = t0 ? t0._next = t2 : taskHead = t2; } } taskTail = t0; sleep(time); } function sleep(time) { if (frame) return; // Soonest alarm already set, or will be. if (timeout) timeout = clearTimeout(timeout); var delay = time - clockNow; // Strictly less than if we recomputed clockNow. if (delay > 24) { if (time < Infinity) timeout = setTimeout(wake, time - clock.now() - clockSkew); if (interval) interval = clearInterval(interval); } else { if (!interval) clockLast = clock.now(), interval = setInterval(poke, pokeDelay); frame = 1, setFrame(wake); } } /***/ }), /***/ "./node_modules/_detect-browser@5.1.0@detect-browser/index.js": /*!********************************************************************!*\ !*** ./node_modules/_detect-browser@5.1.0@detect-browser/index.js ***! \********************************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /* WEBPACK VAR INJECTION */(function(process) { var __spreadArrays = this && this.__spreadArrays || function () { for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length; for (var r = Array(s), k = 0, i = 0; i < il; i++) for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) r[k] = a[j]; return r; }; Object.defineProperty(exports, "__esModule", { value: true }); var BrowserInfo = /** @class */ function () { function BrowserInfo(name, version, os) { this.name = name; this.version = version; this.os = os; this.type = 'browser'; } return BrowserInfo; }(); exports.BrowserInfo = BrowserInfo; var NodeInfo = /** @class */ function () { function NodeInfo(version) { this.version = version; this.type = 'node'; this.name = 'node'; this.os = process.platform; } return NodeInfo; }(); exports.NodeInfo = NodeInfo; var SearchBotDeviceInfo = /** @class */ function () { function SearchBotDeviceInfo(name, version, os, bot) { this.name = name; this.version = version; this.os = os; this.bot = bot; this.type = 'bot-device'; } return SearchBotDeviceInfo; }(); exports.SearchBotDeviceInfo = SearchBotDeviceInfo; var BotInfo = /** @class */ function () { function BotInfo() { this.type = 'bot'; this.bot = true; // NOTE: deprecated test name instead this.name = 'bot'; this.version = null; this.os = null; } return BotInfo; }(); exports.BotInfo = BotInfo; var ReactNativeInfo = /** @class */ function () { function ReactNativeInfo() { this.type = 'react-native'; this.name = 'react-native'; this.version = null; this.os = null; } return ReactNativeInfo; }(); exports.ReactNativeInfo = ReactNativeInfo; ; // tslint:disable-next-line:max-line-length var SEARCHBOX_UA_REGEX = /alexa|bot|crawl(er|ing)|facebookexternalhit|feedburner|google web preview|nagios|postrank|pingdom|slurp|spider|yahoo!|yandex/; var SEARCHBOT_OS_REGEX = /(nuhk|Googlebot|Yammybot|Openbot|Slurp|MSNBot|Ask\ Jeeves\/Teoma|ia_archiver)/; var REQUIRED_VERSION_PARTS = 3; var userAgentRules = [['aol', /AOLShield\/([0-9\._]+)/], ['edge', /Edge\/([0-9\._]+)/], ['edge-ios', /EdgiOS\/([0-9\._]+)/], ['yandexbrowser', /YaBrowser\/([0-9\._]+)/], ['kakaotalk', /KAKAOTALK\s([0-9\.]+)/], ['samsung', /SamsungBrowser\/([0-9\.]+)/], ['silk', /\bSilk\/([0-9._-]+)\b/], ['miui', /MiuiBrowser\/([0-9\.]+)$/], ['beaker', /BeakerBrowser\/([0-9\.]+)/], ['edge-chromium', /Edg\/([0-9\.]+)/], ['chromium-webview', /(?!Chrom.*OPR)wv\).*Chrom(?:e|ium)\/([0-9\.]+)(:?\s|$)/], ['chrome', /(?!Chrom.*OPR)Chrom(?:e|ium)\/([0-9\.]+)(:?\s|$)/], ['phantomjs', /PhantomJS\/([0-9\.]+)(:?\s|$)/], ['crios', /CriOS\/([0-9\.]+)(:?\s|$)/], ['firefox', /Firefox\/([0-9\.]+)(?:\s|$)/], ['fxios', /FxiOS\/([0-9\.]+)/], ['opera-mini', /Opera Mini.*Version\/([0-9\.]+)/], ['opera', /Opera\/([0-9\.]+)(?:\s|$)/], ['opera', /OPR\/([0-9\.]+)(:?\s|$)/], ['ie', /Trident\/7\.0.*rv\:([0-9\.]+).*\).*Gecko$/], ['ie', /MSIE\s([0-9\.]+);.*Trident\/[4-7].0/], ['ie', /MSIE\s(7\.0)/], ['bb10', /BB10;\sTouch.*Version\/([0-9\.]+)/], ['android', /Android\s([0-9\.]+)/], ['ios', /Version\/([0-9\._]+).*Mobile.*Safari.*/], ['safari', /Version\/([0-9\._]+).*Safari/], ['facebook', /FBAV\/([0-9\.]+)/], ['instagram', /Instagram\s([0-9\.]+)/], ['ios-webview', /AppleWebKit\/([0-9\.]+).*Mobile/], ['ios-webview', /AppleWebKit\/([0-9\.]+).*Gecko\)$/], ['searchbot', SEARCHBOX_UA_REGEX]]; var operatingSystemRules = [['iOS', /iP(hone|od|ad)/], ['Android OS', /Android/], ['BlackBerry OS', /BlackBerry|BB10/], ['Windows Mobile', /IEMobile/], ['Amazon OS', /Kindle/], ['Windows 3.11', /Win16/], ['Windows 95', /(Windows 95)|(Win95)|(Windows_95)/], ['Windows 98', /(Windows 98)|(Win98)/], ['Windows 2000', /(Windows NT 5.0)|(Windows 2000)/], ['Windows XP', /(Windows NT 5.1)|(Windows XP)/], ['Windows Server 2003', /(Windows NT 5.2)/], ['Windows Vista', /(Windows NT 6.0)/], ['Windows 7', /(Windows NT 6.1)/], ['Windows 8', /(Windows NT 6.2)/], ['Windows 8.1', /(Windows NT 6.3)/], ['Windows 10', /(Windows NT 10.0)/], ['Windows ME', /Windows ME/], ['Open BSD', /OpenBSD/], ['Sun OS', /SunOS/], ['Chrome OS', /CrOS/], ['Linux', /(Linux)|(X11)/], ['Mac OS', /(Mac_PowerPC)|(Macintosh)/], ['QNX', /QNX/], ['BeOS', /BeOS/], ['OS/2', /OS\/2/]]; function detect(userAgent) { if (!!userAgent) { return parseUserAgent(userAgent); } if (typeof document === 'undefined' && typeof navigator !== 'undefined' && navigator.product === 'ReactNative') { return new ReactNativeInfo(); } if (typeof navigator !== 'undefined') { return parseUserAgent(navigator.userAgent); } return getNodeVersion(); } exports.detect = detect; function matchUserAgent(ua) { // opted for using reduce here rather than Array#first with a regex.test call // this is primarily because using the reduce we only perform the regex // execution once rather than once for the test and for the exec again below // probably something that needs to be benchmarked though return ua !== '' && userAgentRules.reduce(function (matched, _a) { var browser = _a[0], regex = _a[1]; if (matched) { return matched; } var uaMatch = regex.exec(ua); return !!uaMatch && [browser, uaMatch]; }, false); } function browserName(ua) { var data = matchUserAgent(ua); return data ? data[0] : null; } exports.browserName = browserName; function parseUserAgent(ua) { var matchedRule = matchUserAgent(ua); if (!matchedRule) { return null; } var name = matchedRule[0], match = matchedRule[1]; if (name === 'searchbot') { return new BotInfo(); } var versionParts = match[1] && match[1].split(/[._]/).slice(0, 3); if (versionParts) { if (versionParts.length < REQUIRED_VERSION_PARTS) { versionParts = __spreadArrays(versionParts, createVersionParts(REQUIRED_VERSION_PARTS - versionParts.length)); } } else { versionParts = []; } var version = versionParts.join('.'); var os = detectOS(ua); var searchBotMatch = SEARCHBOT_OS_REGEX.exec(ua); if (searchBotMatch && searchBotMatch[1]) { return new SearchBotDeviceInfo(name, version, os, searchBotMatch[1]); } return new BrowserInfo(name, versionParts.join('.'), os); } exports.parseUserAgent = parseUserAgent; function detectOS(ua) { for (var ii = 0, count = operatingSystemRules.length; ii < count; ii++) { var _a = operatingSystemRules[ii], os = _a[0], regex = _a[1]; var match = regex.exec(ua); if (match) { return os; } } return null; } exports.detectOS = detectOS; function getNodeVersion() { var isNode = typeof process !== 'undefined' && process.version; return isNode ? new NodeInfo(process.version.slice(1)) : null; } exports.getNodeVersion = getNodeVersion; function createVersionParts(count) { var output = []; for (var ii = 0; ii < count; ii++) { output.push('0'); } return output; } /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../_process@0.11.10@process/browser.js */ "./node_modules/_process@0.11.10@process/browser.js"))) /***/ }), /***/ "./node_modules/_gl-matrix@3.3.0@gl-matrix/esm/common.js": /*!***************************************************************!*\ !*** ./node_modules/_gl-matrix@3.3.0@gl-matrix/esm/common.js ***! \***************************************************************/ /*! exports provided: EPSILON, ARRAY_TYPE, RANDOM, setMatrixArrayType, toRadian, equals */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "EPSILON", function() { return EPSILON; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ARRAY_TYPE", function() { return ARRAY_TYPE; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "RANDOM", function() { return RANDOM; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "setMatrixArrayType", function() { return setMatrixArrayType; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "toRadian", function() { return toRadian; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "equals", function() { return equals; }); /** * Common utilities * @module glMatrix */ // Configuration Constants var EPSILON = 0.000001; var ARRAY_TYPE = typeof Float32Array !== 'undefined' ? Float32Array : Array; var RANDOM = Math.random; /** * Sets the type of array used when creating new vectors and matrices * * @param {Float32ArrayConstructor | ArrayConstructor} type Array type, such as Float32Array or Array */ function setMatrixArrayType(type) { ARRAY_TYPE = type; } var degree = Math.PI / 180; /** * Convert Degree To Radian * * @param {Number} a Angle in Degrees */ function toRadian(a) { return a * degree; } /** * Tests whether or not the arguments have approximately the same value, within an absolute * or relative tolerance of glMatrix.EPSILON (an absolute tolerance is used for values less * than or equal to 1.0, and a relative tolerance is used for larger values) * * @param {Number} a The first number to test. * @param {Number} b The second number to test. * @returns {Boolean} True if the numbers are approximately equal, false otherwise. */ function equals(a, b) { return Math.abs(a - b) <= EPSILON * Math.max(1.0, Math.abs(a), Math.abs(b)); } if (!Math.hypot) Math.hypot = function () { var y = 0, i = arguments.length; while (i--) { y += arguments[i] * arguments[i]; } return Math.sqrt(y); }; /***/ }), /***/ "./node_modules/_gl-matrix@3.3.0@gl-matrix/esm/index.js": /*!**************************************************************!*\ !*** ./node_modules/_gl-matrix@3.3.0@gl-matrix/esm/index.js ***! \**************************************************************/ /*! exports provided: glMatrix, mat2, mat2d, mat3, mat4, quat, quat2, vec2, vec3, vec4 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony import */ var _common_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./common.js */ "./node_modules/_gl-matrix@3.3.0@gl-matrix/esm/common.js"); /* harmony reexport (module object) */ __webpack_require__.d(__webpack_exports__, "glMatrix", function() { return _common_js__WEBPACK_IMPORTED_MODULE_0__; }); /* harmony import */ var _mat2_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./mat2.js */ "./node_modules/_gl-matrix@3.3.0@gl-matrix/esm/mat2.js"); /* harmony reexport (module object) */ __webpack_require__.d(__webpack_exports__, "mat2", function() { return _mat2_js__WEBPACK_IMPORTED_MODULE_1__; }); /* harmony import */ var _mat2d_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./mat2d.js */ "./node_modules/_gl-matrix@3.3.0@gl-matrix/esm/mat2d.js"); /* harmony reexport (module object) */ __webpack_require__.d(__webpack_exports__, "mat2d", function() { return _mat2d_js__WEBPACK_IMPORTED_MODULE_2__; }); /* harmony import */ var _mat3_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./mat3.js */ "./node_modules/_gl-matrix@3.3.0@gl-matrix/esm/mat3.js"); /* harmony reexport (module object) */ __webpack_require__.d(__webpack_exports__, "mat3", function() { return _mat3_js__WEBPACK_IMPORTED_MODULE_3__; }); /* harmony import */ var _mat4_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./mat4.js */ "./node_modules/_gl-matrix@3.3.0@gl-matrix/esm/mat4.js"); /* harmony reexport (module object) */ __webpack_require__.d(__webpack_exports__, "mat4", function() { return _mat4_js__WEBPACK_IMPORTED_MODULE_4__; }); /* harmony import */ var _quat_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./quat.js */ "./node_modules/_gl-matrix@3.3.0@gl-matrix/esm/quat.js"); /* harmony reexport (module object) */ __webpack_require__.d(__webpack_exports__, "quat", function() { return _quat_js__WEBPACK_IMPORTED_MODULE_5__; }); /* harmony import */ var _quat2_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./quat2.js */ "./node_modules/_gl-matrix@3.3.0@gl-matrix/esm/quat2.js"); /* harmony reexport (module object) */ __webpack_require__.d(__webpack_exports__, "quat2", function() { return _quat2_js__WEBPACK_IMPORTED_MODULE_6__; }); /* harmony import */ var _vec2_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./vec2.js */ "./node_modules/_gl-matrix@3.3.0@gl-matrix/esm/vec2.js"); /* harmony reexport (module object) */ __webpack_require__.d(__webpack_exports__, "vec2", function() { return _vec2_js__WEBPACK_IMPORTED_MODULE_7__; }); /* harmony import */ var _vec3_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./vec3.js */ "./node_modules/_gl-matrix@3.3.0@gl-matrix/esm/vec3.js"); /* harmony reexport (module object) */ __webpack_require__.d(__webpack_exports__, "vec3", function() { return _vec3_js__WEBPACK_IMPORTED_MODULE_8__; }); /* harmony import */ var _vec4_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./vec4.js */ "./node_modules/_gl-matrix@3.3.0@gl-matrix/esm/vec4.js"); /* harmony reexport (module object) */ __webpack_require__.d(__webpack_exports__, "vec4", function() { return _vec4_js__WEBPACK_IMPORTED_MODULE_9__; }); /***/ }), /***/ "./node_modules/_gl-matrix@3.3.0@gl-matrix/esm/mat2.js": /*!*************************************************************!*\ !*** ./node_modules/_gl-matrix@3.3.0@gl-matrix/esm/mat2.js ***! \*************************************************************/ /*! exports provided: create, clone, copy, identity, fromValues, set, transpose, invert, adjoint, determinant, multiply, rotate, scale, fromRotation, fromScaling, str, frob, LDU, add, subtract, exactEquals, equals, multiplyScalar, multiplyScalarAndAdd, mul, sub */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "create", function() { return create; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "clone", function() { return clone; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "copy", function() { return copy; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "identity", function() { return identity; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "fromValues", function() { return fromValues; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "set", function() { return set; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "transpose", function() { return transpose; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "invert", function() { return invert; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "adjoint", function() { return adjoint; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "determinant", function() { return determinant; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "multiply", function() { return multiply; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "rotate", function() { return rotate; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "scale", function() { return scale; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "fromRotation", function() { return fromRotation; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "fromScaling", function() { return fromScaling; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "str", function() { return str; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "frob", function() { return frob; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "LDU", function() { return LDU; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "add", function() { return add; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "subtract", function() { return subtract; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "exactEquals", function() { return exactEquals; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "equals", function() { return equals; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "multiplyScalar", function() { return multiplyScalar; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "multiplyScalarAndAdd", function() { return multiplyScalarAndAdd; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "mul", function() { return mul; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "sub", function() { return sub; }); /* harmony import */ var _common_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./common.js */ "./node_modules/_gl-matrix@3.3.0@gl-matrix/esm/common.js"); /** * 2x2 Matrix * @module mat2 */ /** * Creates a new identity mat2 * * @returns {mat2} a new 2x2 matrix */ function create() { var out = new _common_js__WEBPACK_IMPORTED_MODULE_0__["ARRAY_TYPE"](4); if (_common_js__WEBPACK_IMPORTED_MODULE_0__["ARRAY_TYPE"] != Float32Array) { out[1] = 0; out[2] = 0; } out[0] = 1; out[3] = 1; return out; } /** * Creates a new mat2 initialized with values from an existing matrix * * @param {ReadonlyMat2} a matrix to clone * @returns {mat2} a new 2x2 matrix */ function clone(a) { var out = new _common_js__WEBPACK_IMPORTED_MODULE_0__["ARRAY_TYPE"](4); out[0] = a[0]; out[1] = a[1]; out[2] = a[2]; out[3] = a[3]; return out; } /** * Copy the values from one mat2 to another * * @param {mat2} out the receiving matrix * @param {ReadonlyMat2} a the source matrix * @returns {mat2} out */ function copy(out, a) { out[0] = a[0]; out[1] = a[1]; out[2] = a[2]; out[3] = a[3]; return out; } /** * Set a mat2 to the identity matrix * * @param {mat2} out the receiving matrix * @returns {mat2} out */ function identity(out) { out[0] = 1; out[1] = 0; out[2] = 0; out[3] = 1; return out; } /** * Create a new mat2 with the given values * * @param {Number} m00 Component in column 0, row 0 position (index 0) * @param {Number} m01 Component in column 0, row 1 position (index 1) * @param {Number} m10 Component in column 1, row 0 position (index 2) * @param {Number} m11 Component in column 1, row 1 position (index 3) * @returns {mat2} out A new 2x2 matrix */ function fromValues(m00, m01, m10, m11) { var out = new _common_js__WEBPACK_IMPORTED_MODULE_0__["ARRAY_TYPE"](4); out[0] = m00; out[1] = m01; out[2] = m10; out[3] = m11; return out; } /** * Set the components of a mat2 to the given values * * @param {mat2} out the receiving matrix * @param {Number} m00 Component in column 0, row 0 position (index 0) * @param {Number} m01 Component in column 0, row 1 position (index 1) * @param {Number} m10 Component in column 1, row 0 position (index 2) * @param {Number} m11 Component in column 1, row 1 position (index 3) * @returns {mat2} out */ function set(out, m00, m01, m10, m11) { out[0] = m00; out[1] = m01; out[2] = m10; out[3] = m11; return out; } /** * Transpose the values of a mat2 * * @param {mat2} out the receiving matrix * @param {ReadonlyMat2} a the source matrix * @returns {mat2} out */ function transpose(out, a) { // If we are transposing ourselves we can skip a few steps but have to cache // some values if (out === a) { var a1 = a[1]; out[1] = a[2]; out[2] = a1; } else { out[0] = a[0]; out[1] = a[2]; out[2] = a[1]; out[3] = a[3]; } return out; } /** * Inverts a mat2 * * @param {mat2} out the receiving matrix * @param {ReadonlyMat2} a the source matrix * @returns {mat2} out */ function invert(out, a) { var a0 = a[0], a1 = a[1], a2 = a[2], a3 = a[3]; // Calculate the determinant var det = a0 * a3 - a2 * a1; if (!det) { return null; } det = 1.0 / det; out[0] = a3 * det; out[1] = -a1 * det; out[2] = -a2 * det; out[3] = a0 * det; return out; } /** * Calculates the adjugate of a mat2 * * @param {mat2} out the receiving matrix * @param {ReadonlyMat2} a the source matrix * @returns {mat2} out */ function adjoint(out, a) { // Caching this value is nessecary if out == a var a0 = a[0]; out[0] = a[3]; out[1] = -a[1]; out[2] = -a[2]; out[3] = a0; return out; } /** * Calculates the determinant of a mat2 * * @param {ReadonlyMat2} a the source matrix * @returns {Number} determinant of a */ function determinant(a) { return a[0] * a[3] - a[2] * a[1]; } /** * Multiplies two mat2's * * @param {mat2} out the receiving matrix * @param {ReadonlyMat2} a the first operand * @param {ReadonlyMat2} b the second operand * @returns {mat2} out */ function multiply(out, a, b) { var a0 = a[0], a1 = a[1], a2 = a[2], a3 = a[3]; var b0 = b[0], b1 = b[1], b2 = b[2], b3 = b[3]; out[0] = a0 * b0 + a2 * b1; out[1] = a1 * b0 + a3 * b1; out[2] = a0 * b2 + a2 * b3; out[3] = a1 * b2 + a3 * b3; return out; } /** * Rotates a mat2 by the given angle * * @param {mat2} out the receiving matrix * @param {ReadonlyMat2} a the matrix to rotate * @param {Number} rad the angle to rotate the matrix by * @returns {mat2} out */ function rotate(out, a, rad) { var a0 = a[0], a1 = a[1], a2 = a[2], a3 = a[3]; var s = Math.sin(rad); var c = Math.cos(rad); out[0] = a0 * c + a2 * s; out[1] = a1 * c + a3 * s; out[2] = a0 * -s + a2 * c; out[3] = a1 * -s + a3 * c; return out; } /** * Scales the mat2 by the dimensions in the given vec2 * * @param {mat2} out the receiving matrix * @param {ReadonlyMat2} a the matrix to rotate * @param {ReadonlyVec2} v the vec2 to scale the matrix by * @returns {mat2} out **/ function scale(out, a, v) { var a0 = a[0], a1 = a[1], a2 = a[2], a3 = a[3]; var v0 = v[0], v1 = v[1]; out[0] = a0 * v0; out[1] = a1 * v0; out[2] = a2 * v1; out[3] = a3 * v1; return out; } /** * Creates a matrix from a given angle * This is equivalent to (but much faster than): * * mat2.identity(dest); * mat2.rotate(dest, dest, rad); * * @param {mat2} out mat2 receiving operation result * @param {Number} rad the angle to rotate the matrix by * @returns {mat2} out */ function fromRotation(out, rad) { var s = Math.sin(rad); var c = Math.cos(rad); out[0] = c; out[1] = s; out[2] = -s; out[3] = c; return out; } /** * Creates a matrix from a vector scaling * This is equivalent to (but much faster than): * * mat2.identity(dest); * mat2.scale(dest, dest, vec); * * @param {mat2} out mat2 receiving operation result * @param {ReadonlyVec2} v Scaling vector * @returns {mat2} out */ function fromScaling(out, v) { out[0] = v[0]; out[1] = 0; out[2] = 0; out[3] = v[1]; return out; } /** * Returns a string representation of a mat2 * * @param {ReadonlyMat2} a matrix to represent as a string * @returns {String} string representation of the matrix */ function str(a) { return "mat2(" + a[0] + ", " + a[1] + ", " + a[2] + ", " + a[3] + ")"; } /** * Returns Frobenius norm of a mat2 * * @param {ReadonlyMat2} a the matrix to calculate Frobenius norm of * @returns {Number} Frobenius norm */ function frob(a) { return Math.hypot(a[0], a[1], a[2], a[3]); } /** * Returns L, D and U matrices (Lower triangular, Diagonal and Upper triangular) by factorizing the input matrix * @param {ReadonlyMat2} L the lower triangular matrix * @param {ReadonlyMat2} D the diagonal matrix * @param {ReadonlyMat2} U the upper triangular matrix * @param {ReadonlyMat2} a the input matrix to factorize */ function LDU(L, D, U, a) { L[2] = a[2] / a[0]; U[0] = a[0]; U[1] = a[1]; U[3] = a[3] - L[2] * U[1]; return [L, D, U]; } /** * Adds two mat2's * * @param {mat2} out the receiving matrix * @param {ReadonlyMat2} a the first operand * @param {ReadonlyMat2} b the second operand * @returns {mat2} out */ function add(out, a, b) { out[0] = a[0] + b[0]; out[1] = a[1] + b[1]; out[2] = a[2] + b[2]; out[3] = a[3] + b[3]; return out; } /** * Subtracts matrix b from matrix a * * @param {mat2} out the receiving matrix * @param {ReadonlyMat2} a the first operand * @param {ReadonlyMat2} b the second operand * @returns {mat2} out */ function subtract(out, a, b) { out[0] = a[0] - b[0]; out[1] = a[1] - b[1]; out[2] = a[2] - b[2]; out[3] = a[3] - b[3]; return out; } /** * Returns whether or not the matrices have exactly the same elements in the same position (when compared with ===) * * @param {ReadonlyMat2} a The first matrix. * @param {ReadonlyMat2} b The second matrix. * @returns {Boolean} True if the matrices are equal, false otherwise. */ function exactEquals(a, b) { return a[0] === b[0] && a[1] === b[1] && a[2] === b[2] && a[3] === b[3]; } /** * Returns whether or not the matrices have approximately the same elements in the same position. * * @param {ReadonlyMat2} a The first matrix. * @param {ReadonlyMat2} b The second matrix. * @returns {Boolean} True if the matrices are equal, false otherwise. */ function equals(a, b) { var a0 = a[0], a1 = a[1], a2 = a[2], a3 = a[3]; var b0 = b[0], b1 = b[1], b2 = b[2], b3 = b[3]; return Math.abs(a0 - b0) <= _common_js__WEBPACK_IMPORTED_MODULE_0__["EPSILON"] * Math.max(1.0, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= _common_js__WEBPACK_IMPORTED_MODULE_0__["EPSILON"] * Math.max(1.0, Math.abs(a1), Math.abs(b1)) && Math.abs(a2 - b2) <= _common_js__WEBPACK_IMPORTED_MODULE_0__["EPSILON"] * Math.max(1.0, Math.abs(a2), Math.abs(b2)) && Math.abs(a3 - b3) <= _common_js__WEBPACK_IMPORTED_MODULE_0__["EPSILON"] * Math.max(1.0, Math.abs(a3), Math.abs(b3)); } /** * Multiply each element of the matrix by a scalar. * * @param {mat2} out the receiving matrix * @param {ReadonlyMat2} a the matrix to scale * @param {Number} b amount to scale the matrix's elements by * @returns {mat2} out */ function multiplyScalar(out, a, b) { out[0] = a[0] * b; out[1] = a[1] * b; out[2] = a[2] * b; out[3] = a[3] * b; return out; } /** * Adds two mat2's after multiplying each element of the second operand by a scalar value. * * @param {mat2} out the receiving vector * @param {ReadonlyMat2} a the first operand * @param {ReadonlyMat2} b the second operand * @param {Number} scale the amount to scale b's elements by before adding * @returns {mat2} out */ function multiplyScalarAndAdd(out, a, b, scale) { out[0] = a[0] + b[0] * scale; out[1] = a[1] + b[1] * scale; out[2] = a[2] + b[2] * scale; out[3] = a[3] + b[3] * scale; return out; } /** * Alias for {@link mat2.multiply} * @function */ var mul = multiply; /** * Alias for {@link mat2.subtract} * @function */ var sub = subtract; /***/ }), /***/ "./node_modules/_gl-matrix@3.3.0@gl-matrix/esm/mat2d.js": /*!**************************************************************!*\ !*** ./node_modules/_gl-matrix@3.3.0@gl-matrix/esm/mat2d.js ***! \**************************************************************/ /*! exports provided: create, clone, copy, identity, fromValues, set, invert, determinant, multiply, rotate, scale, translate, fromRotation, fromScaling, fromTranslation, str, frob, add, subtract, multiplyScalar, multiplyScalarAndAdd, exactEquals, equals, mul, sub */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "create", function() { return create; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "clone", function() { return clone; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "copy", function() { return copy; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "identity", function() { return identity; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "fromValues", function() { return fromValues; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "set", function() { return set; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "invert", function() { return invert; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "determinant", function() { return determinant; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "multiply", function() { return multiply; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "rotate", function() { return rotate; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "scale", function() { return scale; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "translate", function() { return translate; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "fromRotation", function() { return fromRotation; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "fromScaling", function() { return fromScaling; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "fromTranslation", function() { return fromTranslation; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "str", function() { return str; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "frob", function() { return frob; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "add", function() { return add; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "subtract", function() { return subtract; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "multiplyScalar", function() { return multiplyScalar; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "multiplyScalarAndAdd", function() { return multiplyScalarAndAdd; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "exactEquals", function() { return exactEquals; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "equals", function() { return equals; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "mul", function() { return mul; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "sub", function() { return sub; }); /* harmony import */ var _common_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./common.js */ "./node_modules/_gl-matrix@3.3.0@gl-matrix/esm/common.js"); /** * 2x3 Matrix * @module mat2d * @description * A mat2d contains six elements defined as: *
 * [a, b,
 *  c, d,
 *  tx, ty]
 * 
* This is a short form for the 3x3 matrix: *
 * [a, b, 0,
 *  c, d, 0,
 *  tx, ty, 1]
 * 
* The last column is ignored so the array is shorter and operations are faster. */ /** * Creates a new identity mat2d * * @returns {mat2d} a new 2x3 matrix */ function create() { var out = new _common_js__WEBPACK_IMPORTED_MODULE_0__["ARRAY_TYPE"](6); if (_common_js__WEBPACK_IMPORTED_MODULE_0__["ARRAY_TYPE"] != Float32Array) { out[1] = 0; out[2] = 0; out[4] = 0; out[5] = 0; } out[0] = 1; out[3] = 1; return out; } /** * Creates a new mat2d initialized with values from an existing matrix * * @param {ReadonlyMat2d} a matrix to clone * @returns {mat2d} a new 2x3 matrix */ function clone(a) { var out = new _common_js__WEBPACK_IMPORTED_MODULE_0__["ARRAY_TYPE"](6); out[0] = a[0]; out[1] = a[1]; out[2] = a[2]; out[3] = a[3]; out[4] = a[4]; out[5] = a[5]; return out; } /** * Copy the values from one mat2d to another * * @param {mat2d} out the receiving matrix * @param {ReadonlyMat2d} a the source matrix * @returns {mat2d} out */ function copy(out, a) { out[0] = a[0]; out[1] = a[1]; out[2] = a[2]; out[3] = a[3]; out[4] = a[4]; out[5] = a[5]; return out; } /** * Set a mat2d to the identity matrix * * @param {mat2d} out the receiving matrix * @returns {mat2d} out */ function identity(out) { out[0] = 1; out[1] = 0; out[2] = 0; out[3] = 1; out[4] = 0; out[5] = 0; return out; } /** * Create a new mat2d with the given values * * @param {Number} a Component A (index 0) * @param {Number} b Component B (index 1) * @param {Number} c Component C (index 2) * @param {Number} d Component D (index 3) * @param {Number} tx Component TX (index 4) * @param {Number} ty Component TY (index 5) * @returns {mat2d} A new mat2d */ function fromValues(a, b, c, d, tx, ty) { var out = new _common_js__WEBPACK_IMPORTED_MODULE_0__["ARRAY_TYPE"](6); out[0] = a; out[1] = b; out[2] = c; out[3] = d; out[4] = tx; out[5] = ty; return out; } /** * Set the components of a mat2d to the given values * * @param {mat2d} out the receiving matrix * @param {Number} a Component A (index 0) * @param {Number} b Component B (index 1) * @param {Number} c Component C (index 2) * @param {Number} d Component D (index 3) * @param {Number} tx Component TX (index 4) * @param {Number} ty Component TY (index 5) * @returns {mat2d} out */ function set(out, a, b, c, d, tx, ty) { out[0] = a; out[1] = b; out[2] = c; out[3] = d; out[4] = tx; out[5] = ty; return out; } /** * Inverts a mat2d * * @param {mat2d} out the receiving matrix * @param {ReadonlyMat2d} a the source matrix * @returns {mat2d} out */ function invert(out, a) { var aa = a[0], ab = a[1], ac = a[2], ad = a[3]; var atx = a[4], aty = a[5]; var det = aa * ad - ab * ac; if (!det) { return null; } det = 1.0 / det; out[0] = ad * det; out[1] = -ab * det; out[2] = -ac * det; out[3] = aa * det; out[4] = (ac * aty - ad * atx) * det; out[5] = (ab * atx - aa * aty) * det; return out; } /** * Calculates the determinant of a mat2d * * @param {ReadonlyMat2d} a the source matrix * @returns {Number} determinant of a */ function determinant(a) { return a[0] * a[3] - a[1] * a[2]; } /** * Multiplies two mat2d's * * @param {mat2d} out the receiving matrix * @param {ReadonlyMat2d} a the first operand * @param {ReadonlyMat2d} b the second operand * @returns {mat2d} out */ function multiply(out, a, b) { var a0 = a[0], a1 = a[1], a2 = a[2], a3 = a[3], a4 = a[4], a5 = a[5]; var b0 = b[0], b1 = b[1], b2 = b[2], b3 = b[3], b4 = b[4], b5 = b[5]; out[0] = a0 * b0 + a2 * b1; out[1] = a1 * b0 + a3 * b1; out[2] = a0 * b2 + a2 * b3; out[3] = a1 * b2 + a3 * b3; out[4] = a0 * b4 + a2 * b5 + a4; out[5] = a1 * b4 + a3 * b5 + a5; return out; } /** * Rotates a mat2d by the given angle * * @param {mat2d} out the receiving matrix * @param {ReadonlyMat2d} a the matrix to rotate * @param {Number} rad the angle to rotate the matrix by * @returns {mat2d} out */ function rotate(out, a, rad) { var a0 = a[0], a1 = a[1], a2 = a[2], a3 = a[3], a4 = a[4], a5 = a[5]; var s = Math.sin(rad); var c = Math.cos(rad); out[0] = a0 * c + a2 * s; out[1] = a1 * c + a3 * s; out[2] = a0 * -s + a2 * c; out[3] = a1 * -s + a3 * c; out[4] = a4; out[5] = a5; return out; } /** * Scales the mat2d by the dimensions in the given vec2 * * @param {mat2d} out the receiving matrix * @param {ReadonlyMat2d} a the matrix to translate * @param {ReadonlyVec2} v the vec2 to scale the matrix by * @returns {mat2d} out **/ function scale(out, a, v) { var a0 = a[0], a1 = a[1], a2 = a[2], a3 = a[3], a4 = a[4], a5 = a[5]; var v0 = v[0], v1 = v[1]; out[0] = a0 * v0; out[1] = a1 * v0; out[2] = a2 * v1; out[3] = a3 * v1; out[4] = a4; out[5] = a5; return out; } /** * Translates the mat2d by the dimensions in the given vec2 * * @param {mat2d} out the receiving matrix * @param {ReadonlyMat2d} a the matrix to translate * @param {ReadonlyVec2} v the vec2 to translate the matrix by * @returns {mat2d} out **/ function translate(out, a, v) { var a0 = a[0], a1 = a[1], a2 = a[2], a3 = a[3], a4 = a[4], a5 = a[5]; var v0 = v[0], v1 = v[1]; out[0] = a0; out[1] = a1; out[2] = a2; out[3] = a3; out[4] = a0 * v0 + a2 * v1 + a4; out[5] = a1 * v0 + a3 * v1 + a5; return out; } /** * Creates a matrix from a given angle * This is equivalent to (but much faster than): * * mat2d.identity(dest); * mat2d.rotate(dest, dest, rad); * * @param {mat2d} out mat2d receiving operation result * @param {Number} rad the angle to rotate the matrix by * @returns {mat2d} out */ function fromRotation(out, rad) { var s = Math.sin(rad), c = Math.cos(rad); out[0] = c; out[1] = s; out[2] = -s; out[3] = c; out[4] = 0; out[5] = 0; return out; } /** * Creates a matrix from a vector scaling * This is equivalent to (but much faster than): * * mat2d.identity(dest); * mat2d.scale(dest, dest, vec); * * @param {mat2d} out mat2d receiving operation result * @param {ReadonlyVec2} v Scaling vector * @returns {mat2d} out */ function fromScaling(out, v) { out[0] = v[0]; out[1] = 0; out[2] = 0; out[3] = v[1]; out[4] = 0; out[5] = 0; return out; } /** * Creates a matrix from a vector translation * This is equivalent to (but much faster than): * * mat2d.identity(dest); * mat2d.translate(dest, dest, vec); * * @param {mat2d} out mat2d receiving operation result * @param {ReadonlyVec2} v Translation vector * @returns {mat2d} out */ function fromTranslation(out, v) { out[0] = 1; out[1] = 0; out[2] = 0; out[3] = 1; out[4] = v[0]; out[5] = v[1]; return out; } /** * Returns a string representation of a mat2d * * @param {ReadonlyMat2d} a matrix to represent as a string * @returns {String} string representation of the matrix */ function str(a) { return "mat2d(" + a[0] + ", " + a[1] + ", " + a[2] + ", " + a[3] + ", " + a[4] + ", " + a[5] + ")"; } /** * Returns Frobenius norm of a mat2d * * @param {ReadonlyMat2d} a the matrix to calculate Frobenius norm of * @returns {Number} Frobenius norm */ function frob(a) { return Math.hypot(a[0], a[1], a[2], a[3], a[4], a[5], 1); } /** * Adds two mat2d's * * @param {mat2d} out the receiving matrix * @param {ReadonlyMat2d} a the first operand * @param {ReadonlyMat2d} b the second operand * @returns {mat2d} out */ function add(out, a, b) { out[0] = a[0] + b[0]; out[1] = a[1] + b[1]; out[2] = a[2] + b[2]; out[3] = a[3] + b[3]; out[4] = a[4] + b[4]; out[5] = a[5] + b[5]; return out; } /** * Subtracts matrix b from matrix a * * @param {mat2d} out the receiving matrix * @param {ReadonlyMat2d} a the first operand * @param {ReadonlyMat2d} b the second operand * @returns {mat2d} out */ function subtract(out, a, b) { out[0] = a[0] - b[0]; out[1] = a[1] - b[1]; out[2] = a[2] - b[2]; out[3] = a[3] - b[3]; out[4] = a[4] - b[4]; out[5] = a[5] - b[5]; return out; } /** * Multiply each element of the matrix by a scalar. * * @param {mat2d} out the receiving matrix * @param {ReadonlyMat2d} a the matrix to scale * @param {Number} b amount to scale the matrix's elements by * @returns {mat2d} out */ function multiplyScalar(out, a, b) { out[0] = a[0] * b; out[1] = a[1] * b; out[2] = a[2] * b; out[3] = a[3] * b; out[4] = a[4] * b; out[5] = a[5] * b; return out; } /** * Adds two mat2d's after multiplying each element of the second operand by a scalar value. * * @param {mat2d} out the receiving vector * @param {ReadonlyMat2d} a the first operand * @param {ReadonlyMat2d} b the second operand * @param {Number} scale the amount to scale b's elements by before adding * @returns {mat2d} out */ function multiplyScalarAndAdd(out, a, b, scale) { out[0] = a[0] + b[0] * scale; out[1] = a[1] + b[1] * scale; out[2] = a[2] + b[2] * scale; out[3] = a[3] + b[3] * scale; out[4] = a[4] + b[4] * scale; out[5] = a[5] + b[5] * scale; return out; } /** * Returns whether or not the matrices have exactly the same elements in the same position (when compared with ===) * * @param {ReadonlyMat2d} a The first matrix. * @param {ReadonlyMat2d} b The second matrix. * @returns {Boolean} True if the matrices are equal, false otherwise. */ function exactEquals(a, b) { return a[0] === b[0] && a[1] === b[1] && a[2] === b[2] && a[3] === b[3] && a[4] === b[4] && a[5] === b[5]; } /** * Returns whether or not the matrices have approximately the same elements in the same position. * * @param {ReadonlyMat2d} a The first matrix. * @param {ReadonlyMat2d} b The second matrix. * @returns {Boolean} True if the matrices are equal, false otherwise. */ function equals(a, b) { var a0 = a[0], a1 = a[1], a2 = a[2], a3 = a[3], a4 = a[4], a5 = a[5]; var b0 = b[0], b1 = b[1], b2 = b[2], b3 = b[3], b4 = b[4], b5 = b[5]; return Math.abs(a0 - b0) <= _common_js__WEBPACK_IMPORTED_MODULE_0__["EPSILON"] * Math.max(1.0, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= _common_js__WEBPACK_IMPORTED_MODULE_0__["EPSILON"] * Math.max(1.0, Math.abs(a1), Math.abs(b1)) && Math.abs(a2 - b2) <= _common_js__WEBPACK_IMPORTED_MODULE_0__["EPSILON"] * Math.max(1.0, Math.abs(a2), Math.abs(b2)) && Math.abs(a3 - b3) <= _common_js__WEBPACK_IMPORTED_MODULE_0__["EPSILON"] * Math.max(1.0, Math.abs(a3), Math.abs(b3)) && Math.abs(a4 - b4) <= _common_js__WEBPACK_IMPORTED_MODULE_0__["EPSILON"] * Math.max(1.0, Math.abs(a4), Math.abs(b4)) && Math.abs(a5 - b5) <= _common_js__WEBPACK_IMPORTED_MODULE_0__["EPSILON"] * Math.max(1.0, Math.abs(a5), Math.abs(b5)); } /** * Alias for {@link mat2d.multiply} * @function */ var mul = multiply; /** * Alias for {@link mat2d.subtract} * @function */ var sub = subtract; /***/ }), /***/ "./node_modules/_gl-matrix@3.3.0@gl-matrix/esm/mat3.js": /*!*************************************************************!*\ !*** ./node_modules/_gl-matrix@3.3.0@gl-matrix/esm/mat3.js ***! \*************************************************************/ /*! exports provided: create, fromMat4, clone, copy, fromValues, set, identity, transpose, invert, adjoint, determinant, multiply, translate, rotate, scale, fromTranslation, fromRotation, fromScaling, fromMat2d, fromQuat, normalFromMat4, projection, str, frob, add, subtract, multiplyScalar, multiplyScalarAndAdd, exactEquals, equals, mul, sub */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "create", function() { return create; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "fromMat4", function() { return fromMat4; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "clone", function() { return clone; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "copy", function() { return copy; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "fromValues", function() { return fromValues; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "set", function() { return set; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "identity", function() { return identity; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "transpose", function() { return transpose; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "invert", function() { return invert; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "adjoint", function() { return adjoint; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "determinant", function() { return determinant; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "multiply", function() { return multiply; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "translate", function() { return translate; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "rotate", function() { return rotate; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "scale", function() { return scale; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "fromTranslation", function() { return fromTranslation; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "fromRotation", function() { return fromRotation; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "fromScaling", function() { return fromScaling; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "fromMat2d", function() { return fromMat2d; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "fromQuat", function() { return fromQuat; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "normalFromMat4", function() { return normalFromMat4; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "projection", function() { return projection; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "str", function() { return str; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "frob", function() { return frob; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "add", function() { return add; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "subtract", function() { return subtract; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "multiplyScalar", function() { return multiplyScalar; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "multiplyScalarAndAdd", function() { return multiplyScalarAndAdd; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "exactEquals", function() { return exactEquals; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "equals", function() { return equals; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "mul", function() { return mul; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "sub", function() { return sub; }); /* harmony import */ var _common_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./common.js */ "./node_modules/_gl-matrix@3.3.0@gl-matrix/esm/common.js"); /** * 3x3 Matrix * @module mat3 */ /** * Creates a new identity mat3 * * @returns {mat3} a new 3x3 matrix */ function create() { var out = new _common_js__WEBPACK_IMPORTED_MODULE_0__["ARRAY_TYPE"](9); if (_common_js__WEBPACK_IMPORTED_MODULE_0__["ARRAY_TYPE"] != Float32Array) { out[1] = 0; out[2] = 0; out[3] = 0; out[5] = 0; out[6] = 0; out[7] = 0; } out[0] = 1; out[4] = 1; out[8] = 1; return out; } /** * Copies the upper-left 3x3 values into the given mat3. * * @param {mat3} out the receiving 3x3 matrix * @param {ReadonlyMat4} a the source 4x4 matrix * @returns {mat3} out */ function fromMat4(out, a) { out[0] = a[0]; out[1] = a[1]; out[2] = a[2]; out[3] = a[4]; out[4] = a[5]; out[5] = a[6]; out[6] = a[8]; out[7] = a[9]; out[8] = a[10]; return out; } /** * Creates a new mat3 initialized with values from an existing matrix * * @param {ReadonlyMat3} a matrix to clone * @returns {mat3} a new 3x3 matrix */ function clone(a) { var out = new _common_js__WEBPACK_IMPORTED_MODULE_0__["ARRAY_TYPE"](9); out[0] = a[0]; out[1] = a[1]; out[2] = a[2]; out[3] = a[3]; out[4] = a[4]; out[5] = a[5]; out[6] = a[6]; out[7] = a[7]; out[8] = a[8]; return out; } /** * Copy the values from one mat3 to another * * @param {mat3} out the receiving matrix * @param {ReadonlyMat3} a the source matrix * @returns {mat3} out */ function copy(out, a) { out[0] = a[0]; out[1] = a[1]; out[2] = a[2]; out[3] = a[3]; out[4] = a[4]; out[5] = a[5]; out[6] = a[6]; out[7] = a[7]; out[8] = a[8]; return out; } /** * Create a new mat3 with the given values * * @param {Number} m00 Component in column 0, row 0 position (index 0) * @param {Number} m01 Component in column 0, row 1 position (index 1) * @param {Number} m02 Component in column 0, row 2 position (index 2) * @param {Number} m10 Component in column 1, row 0 position (index 3) * @param {Number} m11 Component in column 1, row 1 position (index 4) * @param {Number} m12 Component in column 1, row 2 position (index 5) * @param {Number} m20 Component in column 2, row 0 position (index 6) * @param {Number} m21 Component in column 2, row 1 position (index 7) * @param {Number} m22 Component in column 2, row 2 position (index 8) * @returns {mat3} A new mat3 */ function fromValues(m00, m01, m02, m10, m11, m12, m20, m21, m22) { var out = new _common_js__WEBPACK_IMPORTED_MODULE_0__["ARRAY_TYPE"](9); out[0] = m00; out[1] = m01; out[2] = m02; out[3] = m10; out[4] = m11; out[5] = m12; out[6] = m20; out[7] = m21; out[8] = m22; return out; } /** * Set the components of a mat3 to the given values * * @param {mat3} out the receiving matrix * @param {Number} m00 Component in column 0, row 0 position (index 0) * @param {Number} m01 Component in column 0, row 1 position (index 1) * @param {Number} m02 Component in column 0, row 2 position (index 2) * @param {Number} m10 Component in column 1, row 0 position (index 3) * @param {Number} m11 Component in column 1, row 1 position (index 4) * @param {Number} m12 Component in column 1, row 2 position (index 5) * @param {Number} m20 Component in column 2, row 0 position (index 6) * @param {Number} m21 Component in column 2, row 1 position (index 7) * @param {Number} m22 Component in column 2, row 2 position (index 8) * @returns {mat3} out */ function set(out, m00, m01, m02, m10, m11, m12, m20, m21, m22) { out[0] = m00; out[1] = m01; out[2] = m02; out[3] = m10; out[4] = m11; out[5] = m12; out[6] = m20; out[7] = m21; out[8] = m22; return out; } /** * Set a mat3 to the identity matrix * * @param {mat3} out the receiving matrix * @returns {mat3} out */ function identity(out) { out[0] = 1; out[1] = 0; out[2] = 0; out[3] = 0; out[4] = 1; out[5] = 0; out[6] = 0; out[7] = 0; out[8] = 1; return out; } /** * Transpose the values of a mat3 * * @param {mat3} out the receiving matrix * @param {ReadonlyMat3} a the source matrix * @returns {mat3} out */ function transpose(out, a) { // If we are transposing ourselves we can skip a few steps but have to cache some values if (out === a) { var a01 = a[1], a02 = a[2], a12 = a[5]; out[1] = a[3]; out[2] = a[6]; out[3] = a01; out[5] = a[7]; out[6] = a02; out[7] = a12; } else { out[0] = a[0]; out[1] = a[3]; out[2] = a[6]; out[3] = a[1]; out[4] = a[4]; out[5] = a[7]; out[6] = a[2]; out[7] = a[5]; out[8] = a[8]; } return out; } /** * Inverts a mat3 * * @param {mat3} out the receiving matrix * @param {ReadonlyMat3} a the source matrix * @returns {mat3} out */ function invert(out, a) { var a00 = a[0], a01 = a[1], a02 = a[2]; var a10 = a[3], a11 = a[4], a12 = a[5]; var a20 = a[6], a21 = a[7], a22 = a[8]; var b01 = a22 * a11 - a12 * a21; var b11 = -a22 * a10 + a12 * a20; var b21 = a21 * a10 - a11 * a20; // Calculate the determinant var det = a00 * b01 + a01 * b11 + a02 * b21; if (!det) { return null; } det = 1.0 / det; out[0] = b01 * det; out[1] = (-a22 * a01 + a02 * a21) * det; out[2] = (a12 * a01 - a02 * a11) * det; out[3] = b11 * det; out[4] = (a22 * a00 - a02 * a20) * det; out[5] = (-a12 * a00 + a02 * a10) * det; out[6] = b21 * det; out[7] = (-a21 * a00 + a01 * a20) * det; out[8] = (a11 * a00 - a01 * a10) * det; return out; } /** * Calculates the adjugate of a mat3 * * @param {mat3} out the receiving matrix * @param {ReadonlyMat3} a the source matrix * @returns {mat3} out */ function adjoint(out, a) { var a00 = a[0], a01 = a[1], a02 = a[2]; var a10 = a[3], a11 = a[4], a12 = a[5]; var a20 = a[6], a21 = a[7], a22 = a[8]; out[0] = a11 * a22 - a12 * a21; out[1] = a02 * a21 - a01 * a22; out[2] = a01 * a12 - a02 * a11; out[3] = a12 * a20 - a10 * a22; out[4] = a00 * a22 - a02 * a20; out[5] = a02 * a10 - a00 * a12; out[6] = a10 * a21 - a11 * a20; out[7] = a01 * a20 - a00 * a21; out[8] = a00 * a11 - a01 * a10; return out; } /** * Calculates the determinant of a mat3 * * @param {ReadonlyMat3} a the source matrix * @returns {Number} determinant of a */ function determinant(a) { var a00 = a[0], a01 = a[1], a02 = a[2]; var a10 = a[3], a11 = a[4], a12 = a[5]; var a20 = a[6], a21 = a[7], a22 = a[8]; return a00 * (a22 * a11 - a12 * a21) + a01 * (-a22 * a10 + a12 * a20) + a02 * (a21 * a10 - a11 * a20); } /** * Multiplies two mat3's * * @param {mat3} out the receiving matrix * @param {ReadonlyMat3} a the first operand * @param {ReadonlyMat3} b the second operand * @returns {mat3} out */ function multiply(out, a, b) { var a00 = a[0], a01 = a[1], a02 = a[2]; var a10 = a[3], a11 = a[4], a12 = a[5]; var a20 = a[6], a21 = a[7], a22 = a[8]; var b00 = b[0], b01 = b[1], b02 = b[2]; var b10 = b[3], b11 = b[4], b12 = b[5]; var b20 = b[6], b21 = b[7], b22 = b[8]; out[0] = b00 * a00 + b01 * a10 + b02 * a20; out[1] = b00 * a01 + b01 * a11 + b02 * a21; out[2] = b00 * a02 + b01 * a12 + b02 * a22; out[3] = b10 * a00 + b11 * a10 + b12 * a20; out[4] = b10 * a01 + b11 * a11 + b12 * a21; out[5] = b10 * a02 + b11 * a12 + b12 * a22; out[6] = b20 * a00 + b21 * a10 + b22 * a20; out[7] = b20 * a01 + b21 * a11 + b22 * a21; out[8] = b20 * a02 + b21 * a12 + b22 * a22; return out; } /** * Translate a mat3 by the given vector * * @param {mat3} out the receiving matrix * @param {ReadonlyMat3} a the matrix to translate * @param {ReadonlyVec2} v vector to translate by * @returns {mat3} out */ function translate(out, a, v) { var a00 = a[0], a01 = a[1], a02 = a[2], a10 = a[3], a11 = a[4], a12 = a[5], a20 = a[6], a21 = a[7], a22 = a[8], x = v[0], y = v[1]; out[0] = a00; out[1] = a01; out[2] = a02; out[3] = a10; out[4] = a11; out[5] = a12; out[6] = x * a00 + y * a10 + a20; out[7] = x * a01 + y * a11 + a21; out[8] = x * a02 + y * a12 + a22; return out; } /** * Rotates a mat3 by the given angle * * @param {mat3} out the receiving matrix * @param {ReadonlyMat3} a the matrix to rotate * @param {Number} rad the angle to rotate the matrix by * @returns {mat3} out */ function rotate(out, a, rad) { var a00 = a[0], a01 = a[1], a02 = a[2], a10 = a[3], a11 = a[4], a12 = a[5], a20 = a[6], a21 = a[7], a22 = a[8], s = Math.sin(rad), c = Math.cos(rad); out[0] = c * a00 + s * a10; out[1] = c * a01 + s * a11; out[2] = c * a02 + s * a12; out[3] = c * a10 - s * a00; out[4] = c * a11 - s * a01; out[5] = c * a12 - s * a02; out[6] = a20; out[7] = a21; out[8] = a22; return out; } /** * Scales the mat3 by the dimensions in the given vec2 * * @param {mat3} out the receiving matrix * @param {ReadonlyMat3} a the matrix to rotate * @param {ReadonlyVec2} v the vec2 to scale the matrix by * @returns {mat3} out **/ function scale(out, a, v) { var x = v[0], y = v[1]; out[0] = x * a[0]; out[1] = x * a[1]; out[2] = x * a[2]; out[3] = y * a[3]; out[4] = y * a[4]; out[5] = y * a[5]; out[6] = a[6]; out[7] = a[7]; out[8] = a[8]; return out; } /** * Creates a matrix from a vector translation * This is equivalent to (but much faster than): * * mat3.identity(dest); * mat3.translate(dest, dest, vec); * * @param {mat3} out mat3 receiving operation result * @param {ReadonlyVec2} v Translation vector * @returns {mat3} out */ function fromTranslation(out, v) { out[0] = 1; out[1] = 0; out[2] = 0; out[3] = 0; out[4] = 1; out[5] = 0; out[6] = v[0]; out[7] = v[1]; out[8] = 1; return out; } /** * Creates a matrix from a given angle * This is equivalent to (but much faster than): * * mat3.identity(dest); * mat3.rotate(dest, dest, rad); * * @param {mat3} out mat3 receiving operation result * @param {Number} rad the angle to rotate the matrix by * @returns {mat3} out */ function fromRotation(out, rad) { var s = Math.sin(rad), c = Math.cos(rad); out[0] = c; out[1] = s; out[2] = 0; out[3] = -s; out[4] = c; out[5] = 0; out[6] = 0; out[7] = 0; out[8] = 1; return out; } /** * Creates a matrix from a vector scaling * This is equivalent to (but much faster than): * * mat3.identity(dest); * mat3.scale(dest, dest, vec); * * @param {mat3} out mat3 receiving operation result * @param {ReadonlyVec2} v Scaling vector * @returns {mat3} out */ function fromScaling(out, v) { out[0] = v[0]; out[1] = 0; out[2] = 0; out[3] = 0; out[4] = v[1]; out[5] = 0; out[6] = 0; out[7] = 0; out[8] = 1; return out; } /** * Copies the values from a mat2d into a mat3 * * @param {mat3} out the receiving matrix * @param {ReadonlyMat2d} a the matrix to copy * @returns {mat3} out **/ function fromMat2d(out, a) { out[0] = a[0]; out[1] = a[1]; out[2] = 0; out[3] = a[2]; out[4] = a[3]; out[5] = 0; out[6] = a[4]; out[7] = a[5]; out[8] = 1; return out; } /** * Calculates a 3x3 matrix from the given quaternion * * @param {mat3} out mat3 receiving operation result * @param {ReadonlyQuat} q Quaternion to create matrix from * * @returns {mat3} out */ function fromQuat(out, q) { var x = q[0], y = q[1], z = q[2], w = q[3]; var x2 = x + x; var y2 = y + y; var z2 = z + z; var xx = x * x2; var yx = y * x2; var yy = y * y2; var zx = z * x2; var zy = z * y2; var zz = z * z2; var wx = w * x2; var wy = w * y2; var wz = w * z2; out[0] = 1 - yy - zz; out[3] = yx - wz; out[6] = zx + wy; out[1] = yx + wz; out[4] = 1 - xx - zz; out[7] = zy - wx; out[2] = zx - wy; out[5] = zy + wx; out[8] = 1 - xx - yy; return out; } /** * Calculates a 3x3 normal matrix (transpose inverse) from the 4x4 matrix * * @param {mat3} out mat3 receiving operation result * @param {ReadonlyMat4} a Mat4 to derive the normal matrix from * * @returns {mat3} out */ function normalFromMat4(out, a) { var a00 = a[0], a01 = a[1], a02 = a[2], a03 = a[3]; var a10 = a[4], a11 = a[5], a12 = a[6], a13 = a[7]; var a20 = a[8], a21 = a[9], a22 = a[10], a23 = a[11]; var a30 = a[12], a31 = a[13], a32 = a[14], a33 = a[15]; var b00 = a00 * a11 - a01 * a10; var b01 = a00 * a12 - a02 * a10; var b02 = a00 * a13 - a03 * a10; var b03 = a01 * a12 - a02 * a11; var b04 = a01 * a13 - a03 * a11; var b05 = a02 * a13 - a03 * a12; var b06 = a20 * a31 - a21 * a30; var b07 = a20 * a32 - a22 * a30; var b08 = a20 * a33 - a23 * a30; var b09 = a21 * a32 - a22 * a31; var b10 = a21 * a33 - a23 * a31; var b11 = a22 * a33 - a23 * a32; // Calculate the determinant var det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06; if (!det) { return null; } det = 1.0 / det; out[0] = (a11 * b11 - a12 * b10 + a13 * b09) * det; out[1] = (a12 * b08 - a10 * b11 - a13 * b07) * det; out[2] = (a10 * b10 - a11 * b08 + a13 * b06) * det; out[3] = (a02 * b10 - a01 * b11 - a03 * b09) * det; out[4] = (a00 * b11 - a02 * b08 + a03 * b07) * det; out[5] = (a01 * b08 - a00 * b10 - a03 * b06) * det; out[6] = (a31 * b05 - a32 * b04 + a33 * b03) * det; out[7] = (a32 * b02 - a30 * b05 - a33 * b01) * det; out[8] = (a30 * b04 - a31 * b02 + a33 * b00) * det; return out; } /** * Generates a 2D projection matrix with the given bounds * * @param {mat3} out mat3 frustum matrix will be written into * @param {number} width Width of your gl context * @param {number} height Height of gl context * @returns {mat3} out */ function projection(out, width, height) { out[0] = 2 / width; out[1] = 0; out[2] = 0; out[3] = 0; out[4] = -2 / height; out[5] = 0; out[6] = -1; out[7] = 1; out[8] = 1; return out; } /** * Returns a string representation of a mat3 * * @param {ReadonlyMat3} a matrix to represent as a string * @returns {String} string representation of the matrix */ function str(a) { return "mat3(" + a[0] + ", " + a[1] + ", " + a[2] + ", " + a[3] + ", " + a[4] + ", " + a[5] + ", " + a[6] + ", " + a[7] + ", " + a[8] + ")"; } /** * Returns Frobenius norm of a mat3 * * @param {ReadonlyMat3} a the matrix to calculate Frobenius norm of * @returns {Number} Frobenius norm */ function frob(a) { return Math.hypot(a[0], a[1], a[2], a[3], a[4], a[5], a[6], a[7], a[8]); } /** * Adds two mat3's * * @param {mat3} out the receiving matrix * @param {ReadonlyMat3} a the first operand * @param {ReadonlyMat3} b the second operand * @returns {mat3} out */ function add(out, a, b) { out[0] = a[0] + b[0]; out[1] = a[1] + b[1]; out[2] = a[2] + b[2]; out[3] = a[3] + b[3]; out[4] = a[4] + b[4]; out[5] = a[5] + b[5]; out[6] = a[6] + b[6]; out[7] = a[7] + b[7]; out[8] = a[8] + b[8]; return out; } /** * Subtracts matrix b from matrix a * * @param {mat3} out the receiving matrix * @param {ReadonlyMat3} a the first operand * @param {ReadonlyMat3} b the second operand * @returns {mat3} out */ function subtract(out, a, b) { out[0] = a[0] - b[0]; out[1] = a[1] - b[1]; out[2] = a[2] - b[2]; out[3] = a[3] - b[3]; out[4] = a[4] - b[4]; out[5] = a[5] - b[5]; out[6] = a[6] - b[6]; out[7] = a[7] - b[7]; out[8] = a[8] - b[8]; return out; } /** * Multiply each element of the matrix by a scalar. * * @param {mat3} out the receiving matrix * @param {ReadonlyMat3} a the matrix to scale * @param {Number} b amount to scale the matrix's elements by * @returns {mat3} out */ function multiplyScalar(out, a, b) { out[0] = a[0] * b; out[1] = a[1] * b; out[2] = a[2] * b; out[3] = a[3] * b; out[4] = a[4] * b; out[5] = a[5] * b; out[6] = a[6] * b; out[7] = a[7] * b; out[8] = a[8] * b; return out; } /** * Adds two mat3's after multiplying each element of the second operand by a scalar value. * * @param {mat3} out the receiving vector * @param {ReadonlyMat3} a the first operand * @param {ReadonlyMat3} b the second operand * @param {Number} scale the amount to scale b's elements by before adding * @returns {mat3} out */ function multiplyScalarAndAdd(out, a, b, scale) { out[0] = a[0] + b[0] * scale; out[1] = a[1] + b[1] * scale; out[2] = a[2] + b[2] * scale; out[3] = a[3] + b[3] * scale; out[4] = a[4] + b[4] * scale; out[5] = a[5] + b[5] * scale; out[6] = a[6] + b[6] * scale; out[7] = a[7] + b[7] * scale; out[8] = a[8] + b[8] * scale; return out; } /** * Returns whether or not the matrices have exactly the same elements in the same position (when compared with ===) * * @param {ReadonlyMat3} a The first matrix. * @param {ReadonlyMat3} b The second matrix. * @returns {Boolean} True if the matrices are equal, false otherwise. */ function exactEquals(a, b) { return a[0] === b[0] && a[1] === b[1] && a[2] === b[2] && a[3] === b[3] && a[4] === b[4] && a[5] === b[5] && a[6] === b[6] && a[7] === b[7] && a[8] === b[8]; } /** * Returns whether or not the matrices have approximately the same elements in the same position. * * @param {ReadonlyMat3} a The first matrix. * @param {ReadonlyMat3} b The second matrix. * @returns {Boolean} True if the matrices are equal, false otherwise. */ function equals(a, b) { var a0 = a[0], a1 = a[1], a2 = a[2], a3 = a[3], a4 = a[4], a5 = a[5], a6 = a[6], a7 = a[7], a8 = a[8]; var b0 = b[0], b1 = b[1], b2 = b[2], b3 = b[3], b4 = b[4], b5 = b[5], b6 = b[6], b7 = b[7], b8 = b[8]; return Math.abs(a0 - b0) <= _common_js__WEBPACK_IMPORTED_MODULE_0__["EPSILON"] * Math.max(1.0, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= _common_js__WEBPACK_IMPORTED_MODULE_0__["EPSILON"] * Math.max(1.0, Math.abs(a1), Math.abs(b1)) && Math.abs(a2 - b2) <= _common_js__WEBPACK_IMPORTED_MODULE_0__["EPSILON"] * Math.max(1.0, Math.abs(a2), Math.abs(b2)) && Math.abs(a3 - b3) <= _common_js__WEBPACK_IMPORTED_MODULE_0__["EPSILON"] * Math.max(1.0, Math.abs(a3), Math.abs(b3)) && Math.abs(a4 - b4) <= _common_js__WEBPACK_IMPORTED_MODULE_0__["EPSILON"] * Math.max(1.0, Math.abs(a4), Math.abs(b4)) && Math.abs(a5 - b5) <= _common_js__WEBPACK_IMPORTED_MODULE_0__["EPSILON"] * Math.max(1.0, Math.abs(a5), Math.abs(b5)) && Math.abs(a6 - b6) <= _common_js__WEBPACK_IMPORTED_MODULE_0__["EPSILON"] * Math.max(1.0, Math.abs(a6), Math.abs(b6)) && Math.abs(a7 - b7) <= _common_js__WEBPACK_IMPORTED_MODULE_0__["EPSILON"] * Math.max(1.0, Math.abs(a7), Math.abs(b7)) && Math.abs(a8 - b8) <= _common_js__WEBPACK_IMPORTED_MODULE_0__["EPSILON"] * Math.max(1.0, Math.abs(a8), Math.abs(b8)); } /** * Alias for {@link mat3.multiply} * @function */ var mul = multiply; /** * Alias for {@link mat3.subtract} * @function */ var sub = subtract; /***/ }), /***/ "./node_modules/_gl-matrix@3.3.0@gl-matrix/esm/mat4.js": /*!*************************************************************!*\ !*** ./node_modules/_gl-matrix@3.3.0@gl-matrix/esm/mat4.js ***! \*************************************************************/ /*! exports provided: create, clone, copy, fromValues, set, identity, transpose, invert, adjoint, determinant, multiply, translate, scale, rotate, rotateX, rotateY, rotateZ, fromTranslation, fromScaling, fromRotation, fromXRotation, fromYRotation, fromZRotation, fromRotationTranslation, fromQuat2, getTranslation, getScaling, getRotation, fromRotationTranslationScale, fromRotationTranslationScaleOrigin, fromQuat, frustum, perspective, perspectiveFromFieldOfView, ortho, lookAt, targetTo, str, frob, add, subtract, multiplyScalar, multiplyScalarAndAdd, exactEquals, equals, mul, sub */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "create", function() { return create; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "clone", function() { return clone; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "copy", function() { return copy; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "fromValues", function() { return fromValues; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "set", function() { return set; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "identity", function() { return identity; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "transpose", function() { return transpose; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "invert", function() { return invert; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "adjoint", function() { return adjoint; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "determinant", function() { return determinant; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "multiply", function() { return multiply; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "translate", function() { return translate; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "scale", function() { return scale; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "rotate", function() { return rotate; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "rotateX", function() { return rotateX; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "rotateY", function() { return rotateY; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "rotateZ", function() { return rotateZ; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "fromTranslation", function() { return fromTranslation; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "fromScaling", function() { return fromScaling; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "fromRotation", function() { return fromRotation; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "fromXRotation", function() { return fromXRotation; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "fromYRotation", function() { return fromYRotation; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "fromZRotation", function() { return fromZRotation; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "fromRotationTranslation", function() { return fromRotationTranslation; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "fromQuat2", function() { return fromQuat2; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getTranslation", function() { return getTranslation; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getScaling", function() { return getScaling; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getRotation", function() { return getRotation; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "fromRotationTranslationScale", function() { return fromRotationTranslationScale; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "fromRotationTranslationScaleOrigin", function() { return fromRotationTranslationScaleOrigin; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "fromQuat", function() { return fromQuat; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "frustum", function() { return frustum; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "perspective", function() { return perspective; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "perspectiveFromFieldOfView", function() { return perspectiveFromFieldOfView; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ortho", function() { return ortho; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "lookAt", function() { return lookAt; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "targetTo", function() { return targetTo; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "str", function() { return str; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "frob", function() { return frob; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "add", function() { return add; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "subtract", function() { return subtract; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "multiplyScalar", function() { return multiplyScalar; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "multiplyScalarAndAdd", function() { return multiplyScalarAndAdd; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "exactEquals", function() { return exactEquals; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "equals", function() { return equals; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "mul", function() { return mul; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "sub", function() { return sub; }); /* harmony import */ var _common_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./common.js */ "./node_modules/_gl-matrix@3.3.0@gl-matrix/esm/common.js"); /** * 4x4 Matrix
Format: column-major, when typed out it looks like row-major
The matrices are being post multiplied. * @module mat4 */ /** * Creates a new identity mat4 * * @returns {mat4} a new 4x4 matrix */ function create() { var out = new _common_js__WEBPACK_IMPORTED_MODULE_0__["ARRAY_TYPE"](16); if (_common_js__WEBPACK_IMPORTED_MODULE_0__["ARRAY_TYPE"] != Float32Array) { out[1] = 0; out[2] = 0; out[3] = 0; out[4] = 0; out[6] = 0; out[7] = 0; out[8] = 0; out[9] = 0; out[11] = 0; out[12] = 0; out[13] = 0; out[14] = 0; } out[0] = 1; out[5] = 1; out[10] = 1; out[15] = 1; return out; } /** * Creates a new mat4 initialized with values from an existing matrix * * @param {ReadonlyMat4} a matrix to clone * @returns {mat4} a new 4x4 matrix */ function clone(a) { var out = new _common_js__WEBPACK_IMPORTED_MODULE_0__["ARRAY_TYPE"](16); out[0] = a[0]; out[1] = a[1]; out[2] = a[2]; out[3] = a[3]; out[4] = a[4]; out[5] = a[5]; out[6] = a[6]; out[7] = a[7]; out[8] = a[8]; out[9] = a[9]; out[10] = a[10]; out[11] = a[11]; out[12] = a[12]; out[13] = a[13]; out[14] = a[14]; out[15] = a[15]; return out; } /** * Copy the values from one mat4 to another * * @param {mat4} out the receiving matrix * @param {ReadonlyMat4} a the source matrix * @returns {mat4} out */ function copy(out, a) { out[0] = a[0]; out[1] = a[1]; out[2] = a[2]; out[3] = a[3]; out[4] = a[4]; out[5] = a[5]; out[6] = a[6]; out[7] = a[7]; out[8] = a[8]; out[9] = a[9]; out[10] = a[10]; out[11] = a[11]; out[12] = a[12]; out[13] = a[13]; out[14] = a[14]; out[15] = a[15]; return out; } /** * Create a new mat4 with the given values * * @param {Number} m00 Component in column 0, row 0 position (index 0) * @param {Number} m01 Component in column 0, row 1 position (index 1) * @param {Number} m02 Component in column 0, row 2 position (index 2) * @param {Number} m03 Component in column 0, row 3 position (index 3) * @param {Number} m10 Component in column 1, row 0 position (index 4) * @param {Number} m11 Component in column 1, row 1 position (index 5) * @param {Number} m12 Component in column 1, row 2 position (index 6) * @param {Number} m13 Component in column 1, row 3 position (index 7) * @param {Number} m20 Component in column 2, row 0 position (index 8) * @param {Number} m21 Component in column 2, row 1 position (index 9) * @param {Number} m22 Component in column 2, row 2 position (index 10) * @param {Number} m23 Component in column 2, row 3 position (index 11) * @param {Number} m30 Component in column 3, row 0 position (index 12) * @param {Number} m31 Component in column 3, row 1 position (index 13) * @param {Number} m32 Component in column 3, row 2 position (index 14) * @param {Number} m33 Component in column 3, row 3 position (index 15) * @returns {mat4} A new mat4 */ function fromValues(m00, m01, m02, m03, m10, m11, m12, m13, m20, m21, m22, m23, m30, m31, m32, m33) { var out = new _common_js__WEBPACK_IMPORTED_MODULE_0__["ARRAY_TYPE"](16); out[0] = m00; out[1] = m01; out[2] = m02; out[3] = m03; out[4] = m10; out[5] = m11; out[6] = m12; out[7] = m13; out[8] = m20; out[9] = m21; out[10] = m22; out[11] = m23; out[12] = m30; out[13] = m31; out[14] = m32; out[15] = m33; return out; } /** * Set the components of a mat4 to the given values * * @param {mat4} out the receiving matrix * @param {Number} m00 Component in column 0, row 0 position (index 0) * @param {Number} m01 Component in column 0, row 1 position (index 1) * @param {Number} m02 Component in column 0, row 2 position (index 2) * @param {Number} m03 Component in column 0, row 3 position (index 3) * @param {Number} m10 Component in column 1, row 0 position (index 4) * @param {Number} m11 Component in column 1, row 1 position (index 5) * @param {Number} m12 Component in column 1, row 2 position (index 6) * @param {Number} m13 Component in column 1, row 3 position (index 7) * @param {Number} m20 Component in column 2, row 0 position (index 8) * @param {Number} m21 Component in column 2, row 1 position (index 9) * @param {Number} m22 Component in column 2, row 2 position (index 10) * @param {Number} m23 Component in column 2, row 3 position (index 11) * @param {Number} m30 Component in column 3, row 0 position (index 12) * @param {Number} m31 Component in column 3, row 1 position (index 13) * @param {Number} m32 Component in column 3, row 2 position (index 14) * @param {Number} m33 Component in column 3, row 3 position (index 15) * @returns {mat4} out */ function set(out, m00, m01, m02, m03, m10, m11, m12, m13, m20, m21, m22, m23, m30, m31, m32, m33) { out[0] = m00; out[1] = m01; out[2] = m02; out[3] = m03; out[4] = m10; out[5] = m11; out[6] = m12; out[7] = m13; out[8] = m20; out[9] = m21; out[10] = m22; out[11] = m23; out[12] = m30; out[13] = m31; out[14] = m32; out[15] = m33; return out; } /** * Set a mat4 to the identity matrix * * @param {mat4} out the receiving matrix * @returns {mat4} out */ function identity(out) { out[0] = 1; out[1] = 0; out[2] = 0; out[3] = 0; out[4] = 0; out[5] = 1; out[6] = 0; out[7] = 0; out[8] = 0; out[9] = 0; out[10] = 1; out[11] = 0; out[12] = 0; out[13] = 0; out[14] = 0; out[15] = 1; return out; } /** * Transpose the values of a mat4 * * @param {mat4} out the receiving matrix * @param {ReadonlyMat4} a the source matrix * @returns {mat4} out */ function transpose(out, a) { // If we are transposing ourselves we can skip a few steps but have to cache some values if (out === a) { var a01 = a[1], a02 = a[2], a03 = a[3]; var a12 = a[6], a13 = a[7]; var a23 = a[11]; out[1] = a[4]; out[2] = a[8]; out[3] = a[12]; out[4] = a01; out[6] = a[9]; out[7] = a[13]; out[8] = a02; out[9] = a12; out[11] = a[14]; out[12] = a03; out[13] = a13; out[14] = a23; } else { out[0] = a[0]; out[1] = a[4]; out[2] = a[8]; out[3] = a[12]; out[4] = a[1]; out[5] = a[5]; out[6] = a[9]; out[7] = a[13]; out[8] = a[2]; out[9] = a[6]; out[10] = a[10]; out[11] = a[14]; out[12] = a[3]; out[13] = a[7]; out[14] = a[11]; out[15] = a[15]; } return out; } /** * Inverts a mat4 * * @param {mat4} out the receiving matrix * @param {ReadonlyMat4} a the source matrix * @returns {mat4} out */ function invert(out, a) { var a00 = a[0], a01 = a[1], a02 = a[2], a03 = a[3]; var a10 = a[4], a11 = a[5], a12 = a[6], a13 = a[7]; var a20 = a[8], a21 = a[9], a22 = a[10], a23 = a[11]; var a30 = a[12], a31 = a[13], a32 = a[14], a33 = a[15]; var b00 = a00 * a11 - a01 * a10; var b01 = a00 * a12 - a02 * a10; var b02 = a00 * a13 - a03 * a10; var b03 = a01 * a12 - a02 * a11; var b04 = a01 * a13 - a03 * a11; var b05 = a02 * a13 - a03 * a12; var b06 = a20 * a31 - a21 * a30; var b07 = a20 * a32 - a22 * a30; var b08 = a20 * a33 - a23 * a30; var b09 = a21 * a32 - a22 * a31; var b10 = a21 * a33 - a23 * a31; var b11 = a22 * a33 - a23 * a32; // Calculate the determinant var det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06; if (!det) { return null; } det = 1.0 / det; out[0] = (a11 * b11 - a12 * b10 + a13 * b09) * det; out[1] = (a02 * b10 - a01 * b11 - a03 * b09) * det; out[2] = (a31 * b05 - a32 * b04 + a33 * b03) * det; out[3] = (a22 * b04 - a21 * b05 - a23 * b03) * det; out[4] = (a12 * b08 - a10 * b11 - a13 * b07) * det; out[5] = (a00 * b11 - a02 * b08 + a03 * b07) * det; out[6] = (a32 * b02 - a30 * b05 - a33 * b01) * det; out[7] = (a20 * b05 - a22 * b02 + a23 * b01) * det; out[8] = (a10 * b10 - a11 * b08 + a13 * b06) * det; out[9] = (a01 * b08 - a00 * b10 - a03 * b06) * det; out[10] = (a30 * b04 - a31 * b02 + a33 * b00) * det; out[11] = (a21 * b02 - a20 * b04 - a23 * b00) * det; out[12] = (a11 * b07 - a10 * b09 - a12 * b06) * det; out[13] = (a00 * b09 - a01 * b07 + a02 * b06) * det; out[14] = (a31 * b01 - a30 * b03 - a32 * b00) * det; out[15] = (a20 * b03 - a21 * b01 + a22 * b00) * det; return out; } /** * Calculates the adjugate of a mat4 * * @param {mat4} out the receiving matrix * @param {ReadonlyMat4} a the source matrix * @returns {mat4} out */ function adjoint(out, a) { var a00 = a[0], a01 = a[1], a02 = a[2], a03 = a[3]; var a10 = a[4], a11 = a[5], a12 = a[6], a13 = a[7]; var a20 = a[8], a21 = a[9], a22 = a[10], a23 = a[11]; var a30 = a[12], a31 = a[13], a32 = a[14], a33 = a[15]; out[0] = a11 * (a22 * a33 - a23 * a32) - a21 * (a12 * a33 - a13 * a32) + a31 * (a12 * a23 - a13 * a22); out[1] = -(a01 * (a22 * a33 - a23 * a32) - a21 * (a02 * a33 - a03 * a32) + a31 * (a02 * a23 - a03 * a22)); out[2] = a01 * (a12 * a33 - a13 * a32) - a11 * (a02 * a33 - a03 * a32) + a31 * (a02 * a13 - a03 * a12); out[3] = -(a01 * (a12 * a23 - a13 * a22) - a11 * (a02 * a23 - a03 * a22) + a21 * (a02 * a13 - a03 * a12)); out[4] = -(a10 * (a22 * a33 - a23 * a32) - a20 * (a12 * a33 - a13 * a32) + a30 * (a12 * a23 - a13 * a22)); out[5] = a00 * (a22 * a33 - a23 * a32) - a20 * (a02 * a33 - a03 * a32) + a30 * (a02 * a23 - a03 * a22); out[6] = -(a00 * (a12 * a33 - a13 * a32) - a10 * (a02 * a33 - a03 * a32) + a30 * (a02 * a13 - a03 * a12)); out[7] = a00 * (a12 * a23 - a13 * a22) - a10 * (a02 * a23 - a03 * a22) + a20 * (a02 * a13 - a03 * a12); out[8] = a10 * (a21 * a33 - a23 * a31) - a20 * (a11 * a33 - a13 * a31) + a30 * (a11 * a23 - a13 * a21); out[9] = -(a00 * (a21 * a33 - a23 * a31) - a20 * (a01 * a33 - a03 * a31) + a30 * (a01 * a23 - a03 * a21)); out[10] = a00 * (a11 * a33 - a13 * a31) - a10 * (a01 * a33 - a03 * a31) + a30 * (a01 * a13 - a03 * a11); out[11] = -(a00 * (a11 * a23 - a13 * a21) - a10 * (a01 * a23 - a03 * a21) + a20 * (a01 * a13 - a03 * a11)); out[12] = -(a10 * (a21 * a32 - a22 * a31) - a20 * (a11 * a32 - a12 * a31) + a30 * (a11 * a22 - a12 * a21)); out[13] = a00 * (a21 * a32 - a22 * a31) - a20 * (a01 * a32 - a02 * a31) + a30 * (a01 * a22 - a02 * a21); out[14] = -(a00 * (a11 * a32 - a12 * a31) - a10 * (a01 * a32 - a02 * a31) + a30 * (a01 * a12 - a02 * a11)); out[15] = a00 * (a11 * a22 - a12 * a21) - a10 * (a01 * a22 - a02 * a21) + a20 * (a01 * a12 - a02 * a11); return out; } /** * Calculates the determinant of a mat4 * * @param {ReadonlyMat4} a the source matrix * @returns {Number} determinant of a */ function determinant(a) { var a00 = a[0], a01 = a[1], a02 = a[2], a03 = a[3]; var a10 = a[4], a11 = a[5], a12 = a[6], a13 = a[7]; var a20 = a[8], a21 = a[9], a22 = a[10], a23 = a[11]; var a30 = a[12], a31 = a[13], a32 = a[14], a33 = a[15]; var b00 = a00 * a11 - a01 * a10; var b01 = a00 * a12 - a02 * a10; var b02 = a00 * a13 - a03 * a10; var b03 = a01 * a12 - a02 * a11; var b04 = a01 * a13 - a03 * a11; var b05 = a02 * a13 - a03 * a12; var b06 = a20 * a31 - a21 * a30; var b07 = a20 * a32 - a22 * a30; var b08 = a20 * a33 - a23 * a30; var b09 = a21 * a32 - a22 * a31; var b10 = a21 * a33 - a23 * a31; var b11 = a22 * a33 - a23 * a32; // Calculate the determinant return b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06; } /** * Multiplies two mat4s * * @param {mat4} out the receiving matrix * @param {ReadonlyMat4} a the first operand * @param {ReadonlyMat4} b the second operand * @returns {mat4} out */ function multiply(out, a, b) { var a00 = a[0], a01 = a[1], a02 = a[2], a03 = a[3]; var a10 = a[4], a11 = a[5], a12 = a[6], a13 = a[7]; var a20 = a[8], a21 = a[9], a22 = a[10], a23 = a[11]; var a30 = a[12], a31 = a[13], a32 = a[14], a33 = a[15]; // Cache only the current line of the second matrix var b0 = b[0], b1 = b[1], b2 = b[2], b3 = b[3]; out[0] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30; out[1] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31; out[2] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32; out[3] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33; b0 = b[4]; b1 = b[5]; b2 = b[6]; b3 = b[7]; out[4] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30; out[5] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31; out[6] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32; out[7] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33; b0 = b[8]; b1 = b[9]; b2 = b[10]; b3 = b[11]; out[8] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30; out[9] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31; out[10] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32; out[11] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33; b0 = b[12]; b1 = b[13]; b2 = b[14]; b3 = b[15]; out[12] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30; out[13] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31; out[14] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32; out[15] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33; return out; } /** * Translate a mat4 by the given vector * * @param {mat4} out the receiving matrix * @param {ReadonlyMat4} a the matrix to translate * @param {ReadonlyVec3} v vector to translate by * @returns {mat4} out */ function translate(out, a, v) { var x = v[0], y = v[1], z = v[2]; var a00, a01, a02, a03; var a10, a11, a12, a13; var a20, a21, a22, a23; if (a === out) { out[12] = a[0] * x + a[4] * y + a[8] * z + a[12]; out[13] = a[1] * x + a[5] * y + a[9] * z + a[13]; out[14] = a[2] * x + a[6] * y + a[10] * z + a[14]; out[15] = a[3] * x + a[7] * y + a[11] * z + a[15]; } else { a00 = a[0]; a01 = a[1]; a02 = a[2]; a03 = a[3]; a10 = a[4]; a11 = a[5]; a12 = a[6]; a13 = a[7]; a20 = a[8]; a21 = a[9]; a22 = a[10]; a23 = a[11]; out[0] = a00; out[1] = a01; out[2] = a02; out[3] = a03; out[4] = a10; out[5] = a11; out[6] = a12; out[7] = a13; out[8] = a20; out[9] = a21; out[10] = a22; out[11] = a23; out[12] = a00 * x + a10 * y + a20 * z + a[12]; out[13] = a01 * x + a11 * y + a21 * z + a[13]; out[14] = a02 * x + a12 * y + a22 * z + a[14]; out[15] = a03 * x + a13 * y + a23 * z + a[15]; } return out; } /** * Scales the mat4 by the dimensions in the given vec3 not using vectorization * * @param {mat4} out the receiving matrix * @param {ReadonlyMat4} a the matrix to scale * @param {ReadonlyVec3} v the vec3 to scale the matrix by * @returns {mat4} out **/ function scale(out, a, v) { var x = v[0], y = v[1], z = v[2]; out[0] = a[0] * x; out[1] = a[1] * x; out[2] = a[2] * x; out[3] = a[3] * x; out[4] = a[4] * y; out[5] = a[5] * y; out[6] = a[6] * y; out[7] = a[7] * y; out[8] = a[8] * z; out[9] = a[9] * z; out[10] = a[10] * z; out[11] = a[11] * z; out[12] = a[12]; out[13] = a[13]; out[14] = a[14]; out[15] = a[15]; return out; } /** * Rotates a mat4 by the given angle around the given axis * * @param {mat4} out the receiving matrix * @param {ReadonlyMat4} a the matrix to rotate * @param {Number} rad the angle to rotate the matrix by * @param {ReadonlyVec3} axis the axis to rotate around * @returns {mat4} out */ function rotate(out, a, rad, axis) { var x = axis[0], y = axis[1], z = axis[2]; var len = Math.hypot(x, y, z); var s, c, t; var a00, a01, a02, a03; var a10, a11, a12, a13; var a20, a21, a22, a23; var b00, b01, b02; var b10, b11, b12; var b20, b21, b22; if (len < _common_js__WEBPACK_IMPORTED_MODULE_0__["EPSILON"]) { return null; } len = 1 / len; x *= len; y *= len; z *= len; s = Math.sin(rad); c = Math.cos(rad); t = 1 - c; a00 = a[0]; a01 = a[1]; a02 = a[2]; a03 = a[3]; a10 = a[4]; a11 = a[5]; a12 = a[6]; a13 = a[7]; a20 = a[8]; a21 = a[9]; a22 = a[10]; a23 = a[11]; // Construct the elements of the rotation matrix b00 = x * x * t + c; b01 = y * x * t + z * s; b02 = z * x * t - y * s; b10 = x * y * t - z * s; b11 = y * y * t + c; b12 = z * y * t + x * s; b20 = x * z * t + y * s; b21 = y * z * t - x * s; b22 = z * z * t + c; // Perform rotation-specific matrix multiplication out[0] = a00 * b00 + a10 * b01 + a20 * b02; out[1] = a01 * b00 + a11 * b01 + a21 * b02; out[2] = a02 * b00 + a12 * b01 + a22 * b02; out[3] = a03 * b00 + a13 * b01 + a23 * b02; out[4] = a00 * b10 + a10 * b11 + a20 * b12; out[5] = a01 * b10 + a11 * b11 + a21 * b12; out[6] = a02 * b10 + a12 * b11 + a22 * b12; out[7] = a03 * b10 + a13 * b11 + a23 * b12; out[8] = a00 * b20 + a10 * b21 + a20 * b22; out[9] = a01 * b20 + a11 * b21 + a21 * b22; out[10] = a02 * b20 + a12 * b21 + a22 * b22; out[11] = a03 * b20 + a13 * b21 + a23 * b22; if (a !== out) { // If the source and destination differ, copy the unchanged last row out[12] = a[12]; out[13] = a[13]; out[14] = a[14]; out[15] = a[15]; } return out; } /** * Rotates a matrix by the given angle around the X axis * * @param {mat4} out the receiving matrix * @param {ReadonlyMat4} a the matrix to rotate * @param {Number} rad the angle to rotate the matrix by * @returns {mat4} out */ function rotateX(out, a, rad) { var s = Math.sin(rad); var c = Math.cos(rad); var a10 = a[4]; var a11 = a[5]; var a12 = a[6]; var a13 = a[7]; var a20 = a[8]; var a21 = a[9]; var a22 = a[10]; var a23 = a[11]; if (a !== out) { // If the source and destination differ, copy the unchanged rows out[0] = a[0]; out[1] = a[1]; out[2] = a[2]; out[3] = a[3]; out[12] = a[12]; out[13] = a[13]; out[14] = a[14]; out[15] = a[15]; } // Perform axis-specific matrix multiplication out[4] = a10 * c + a20 * s; out[5] = a11 * c + a21 * s; out[6] = a12 * c + a22 * s; out[7] = a13 * c + a23 * s; out[8] = a20 * c - a10 * s; out[9] = a21 * c - a11 * s; out[10] = a22 * c - a12 * s; out[11] = a23 * c - a13 * s; return out; } /** * Rotates a matrix by the given angle around the Y axis * * @param {mat4} out the receiving matrix * @param {ReadonlyMat4} a the matrix to rotate * @param {Number} rad the angle to rotate the matrix by * @returns {mat4} out */ function rotateY(out, a, rad) { var s = Math.sin(rad); var c = Math.cos(rad); var a00 = a[0]; var a01 = a[1]; var a02 = a[2]; var a03 = a[3]; var a20 = a[8]; var a21 = a[9]; var a22 = a[10]; var a23 = a[11]; if (a !== out) { // If the source and destination differ, copy the unchanged rows out[4] = a[4]; out[5] = a[5]; out[6] = a[6]; out[7] = a[7]; out[12] = a[12]; out[13] = a[13]; out[14] = a[14]; out[15] = a[15]; } // Perform axis-specific matrix multiplication out[0] = a00 * c - a20 * s; out[1] = a01 * c - a21 * s; out[2] = a02 * c - a22 * s; out[3] = a03 * c - a23 * s; out[8] = a00 * s + a20 * c; out[9] = a01 * s + a21 * c; out[10] = a02 * s + a22 * c; out[11] = a03 * s + a23 * c; return out; } /** * Rotates a matrix by the given angle around the Z axis * * @param {mat4} out the receiving matrix * @param {ReadonlyMat4} a the matrix to rotate * @param {Number} rad the angle to rotate the matrix by * @returns {mat4} out */ function rotateZ(out, a, rad) { var s = Math.sin(rad); var c = Math.cos(rad); var a00 = a[0]; var a01 = a[1]; var a02 = a[2]; var a03 = a[3]; var a10 = a[4]; var a11 = a[5]; var a12 = a[6]; var a13 = a[7]; if (a !== out) { // If the source and destination differ, copy the unchanged last row out[8] = a[8]; out[9] = a[9]; out[10] = a[10]; out[11] = a[11]; out[12] = a[12]; out[13] = a[13]; out[14] = a[14]; out[15] = a[15]; } // Perform axis-specific matrix multiplication out[0] = a00 * c + a10 * s; out[1] = a01 * c + a11 * s; out[2] = a02 * c + a12 * s; out[3] = a03 * c + a13 * s; out[4] = a10 * c - a00 * s; out[5] = a11 * c - a01 * s; out[6] = a12 * c - a02 * s; out[7] = a13 * c - a03 * s; return out; } /** * Creates a matrix from a vector translation * This is equivalent to (but much faster than): * * mat4.identity(dest); * mat4.translate(dest, dest, vec); * * @param {mat4} out mat4 receiving operation result * @param {ReadonlyVec3} v Translation vector * @returns {mat4} out */ function fromTranslation(out, v) { out[0] = 1; out[1] = 0; out[2] = 0; out[3] = 0; out[4] = 0; out[5] = 1; out[6] = 0; out[7] = 0; out[8] = 0; out[9] = 0; out[10] = 1; out[11] = 0; out[12] = v[0]; out[13] = v[1]; out[14] = v[2]; out[15] = 1; return out; } /** * Creates a matrix from a vector scaling * This is equivalent to (but much faster than): * * mat4.identity(dest); * mat4.scale(dest, dest, vec); * * @param {mat4} out mat4 receiving operation result * @param {ReadonlyVec3} v Scaling vector * @returns {mat4} out */ function fromScaling(out, v) { out[0] = v[0]; out[1] = 0; out[2] = 0; out[3] = 0; out[4] = 0; out[5] = v[1]; out[6] = 0; out[7] = 0; out[8] = 0; out[9] = 0; out[10] = v[2]; out[11] = 0; out[12] = 0; out[13] = 0; out[14] = 0; out[15] = 1; return out; } /** * Creates a matrix from a given angle around a given axis * This is equivalent to (but much faster than): * * mat4.identity(dest); * mat4.rotate(dest, dest, rad, axis); * * @param {mat4} out mat4 receiving operation result * @param {Number} rad the angle to rotate the matrix by * @param {ReadonlyVec3} axis the axis to rotate around * @returns {mat4} out */ function fromRotation(out, rad, axis) { var x = axis[0], y = axis[1], z = axis[2]; var len = Math.hypot(x, y, z); var s, c, t; if (len < _common_js__WEBPACK_IMPORTED_MODULE_0__["EPSILON"]) { return null; } len = 1 / len; x *= len; y *= len; z *= len; s = Math.sin(rad); c = Math.cos(rad); t = 1 - c; // Perform rotation-specific matrix multiplication out[0] = x * x * t + c; out[1] = y * x * t + z * s; out[2] = z * x * t - y * s; out[3] = 0; out[4] = x * y * t - z * s; out[5] = y * y * t + c; out[6] = z * y * t + x * s; out[7] = 0; out[8] = x * z * t + y * s; out[9] = y * z * t - x * s; out[10] = z * z * t + c; out[11] = 0; out[12] = 0; out[13] = 0; out[14] = 0; out[15] = 1; return out; } /** * Creates a matrix from the given angle around the X axis * This is equivalent to (but much faster than): * * mat4.identity(dest); * mat4.rotateX(dest, dest, rad); * * @param {mat4} out mat4 receiving operation result * @param {Number} rad the angle to rotate the matrix by * @returns {mat4} out */ function fromXRotation(out, rad) { var s = Math.sin(rad); var c = Math.cos(rad); // Perform axis-specific matrix multiplication out[0] = 1; out[1] = 0; out[2] = 0; out[3] = 0; out[4] = 0; out[5] = c; out[6] = s; out[7] = 0; out[8] = 0; out[9] = -s; out[10] = c; out[11] = 0; out[12] = 0; out[13] = 0; out[14] = 0; out[15] = 1; return out; } /** * Creates a matrix from the given angle around the Y axis * This is equivalent to (but much faster than): * * mat4.identity(dest); * mat4.rotateY(dest, dest, rad); * * @param {mat4} out mat4 receiving operation result * @param {Number} rad the angle to rotate the matrix by * @returns {mat4} out */ function fromYRotation(out, rad) { var s = Math.sin(rad); var c = Math.cos(rad); // Perform axis-specific matrix multiplication out[0] = c; out[1] = 0; out[2] = -s; out[3] = 0; out[4] = 0; out[5] = 1; out[6] = 0; out[7] = 0; out[8] = s; out[9] = 0; out[10] = c; out[11] = 0; out[12] = 0; out[13] = 0; out[14] = 0; out[15] = 1; return out; } /** * Creates a matrix from the given angle around the Z axis * This is equivalent to (but much faster than): * * mat4.identity(dest); * mat4.rotateZ(dest, dest, rad); * * @param {mat4} out mat4 receiving operation result * @param {Number} rad the angle to rotate the matrix by * @returns {mat4} out */ function fromZRotation(out, rad) { var s = Math.sin(rad); var c = Math.cos(rad); // Perform axis-specific matrix multiplication out[0] = c; out[1] = s; out[2] = 0; out[3] = 0; out[4] = -s; out[5] = c; out[6] = 0; out[7] = 0; out[8] = 0; out[9] = 0; out[10] = 1; out[11] = 0; out[12] = 0; out[13] = 0; out[14] = 0; out[15] = 1; return out; } /** * Creates a matrix from a quaternion rotation and vector translation * This is equivalent to (but much faster than): * * mat4.identity(dest); * mat4.translate(dest, vec); * let quatMat = mat4.create(); * quat4.toMat4(quat, quatMat); * mat4.multiply(dest, quatMat); * * @param {mat4} out mat4 receiving operation result * @param {quat4} q Rotation quaternion * @param {ReadonlyVec3} v Translation vector * @returns {mat4} out */ function fromRotationTranslation(out, q, v) { // Quaternion math var x = q[0], y = q[1], z = q[2], w = q[3]; var x2 = x + x; var y2 = y + y; var z2 = z + z; var xx = x * x2; var xy = x * y2; var xz = x * z2; var yy = y * y2; var yz = y * z2; var zz = z * z2; var wx = w * x2; var wy = w * y2; var wz = w * z2; out[0] = 1 - (yy + zz); out[1] = xy + wz; out[2] = xz - wy; out[3] = 0; out[4] = xy - wz; out[5] = 1 - (xx + zz); out[6] = yz + wx; out[7] = 0; out[8] = xz + wy; out[9] = yz - wx; out[10] = 1 - (xx + yy); out[11] = 0; out[12] = v[0]; out[13] = v[1]; out[14] = v[2]; out[15] = 1; return out; } /** * Creates a new mat4 from a dual quat. * * @param {mat4} out Matrix * @param {ReadonlyQuat2} a Dual Quaternion * @returns {mat4} mat4 receiving operation result */ function fromQuat2(out, a) { var translation = new _common_js__WEBPACK_IMPORTED_MODULE_0__["ARRAY_TYPE"](3); var bx = -a[0], by = -a[1], bz = -a[2], bw = a[3], ax = a[4], ay = a[5], az = a[6], aw = a[7]; var magnitude = bx * bx + by * by + bz * bz + bw * bw; //Only scale if it makes sense if (magnitude > 0) { translation[0] = (ax * bw + aw * bx + ay * bz - az * by) * 2 / magnitude; translation[1] = (ay * bw + aw * by + az * bx - ax * bz) * 2 / magnitude; translation[2] = (az * bw + aw * bz + ax * by - ay * bx) * 2 / magnitude; } else { translation[0] = (ax * bw + aw * bx + ay * bz - az * by) * 2; translation[1] = (ay * bw + aw * by + az * bx - ax * bz) * 2; translation[2] = (az * bw + aw * bz + ax * by - ay * bx) * 2; } fromRotationTranslation(out, a, translation); return out; } /** * Returns the translation vector component of a transformation * matrix. If a matrix is built with fromRotationTranslation, * the returned vector will be the same as the translation vector * originally supplied. * @param {vec3} out Vector to receive translation component * @param {ReadonlyMat4} mat Matrix to be decomposed (input) * @return {vec3} out */ function getTranslation(out, mat) { out[0] = mat[12]; out[1] = mat[13]; out[2] = mat[14]; return out; } /** * Returns the scaling factor component of a transformation * matrix. If a matrix is built with fromRotationTranslationScale * with a normalized Quaternion paramter, the returned vector will be * the same as the scaling vector * originally supplied. * @param {vec3} out Vector to receive scaling factor component * @param {ReadonlyMat4} mat Matrix to be decomposed (input) * @return {vec3} out */ function getScaling(out, mat) { var m11 = mat[0]; var m12 = mat[1]; var m13 = mat[2]; var m21 = mat[4]; var m22 = mat[5]; var m23 = mat[6]; var m31 = mat[8]; var m32 = mat[9]; var m33 = mat[10]; out[0] = Math.hypot(m11, m12, m13); out[1] = Math.hypot(m21, m22, m23); out[2] = Math.hypot(m31, m32, m33); return out; } /** * Returns a quaternion representing the rotational component * of a transformation matrix. If a matrix is built with * fromRotationTranslation, the returned quaternion will be the * same as the quaternion originally supplied. * @param {quat} out Quaternion to receive the rotation component * @param {ReadonlyMat4} mat Matrix to be decomposed (input) * @return {quat} out */ function getRotation(out, mat) { var scaling = new _common_js__WEBPACK_IMPORTED_MODULE_0__["ARRAY_TYPE"](3); getScaling(scaling, mat); var is1 = 1 / scaling[0]; var is2 = 1 / scaling[1]; var is3 = 1 / scaling[2]; var sm11 = mat[0] * is1; var sm12 = mat[1] * is2; var sm13 = mat[2] * is3; var sm21 = mat[4] * is1; var sm22 = mat[5] * is2; var sm23 = mat[6] * is3; var sm31 = mat[8] * is1; var sm32 = mat[9] * is2; var sm33 = mat[10] * is3; var trace = sm11 + sm22 + sm33; var S = 0; if (trace > 0) { S = Math.sqrt(trace + 1.0) * 2; out[3] = 0.25 * S; out[0] = (sm23 - sm32) / S; out[1] = (sm31 - sm13) / S; out[2] = (sm12 - sm21) / S; } else if (sm11 > sm22 && sm11 > sm33) { S = Math.sqrt(1.0 + sm11 - sm22 - sm33) * 2; out[3] = (sm23 - sm32) / S; out[0] = 0.25 * S; out[1] = (sm12 + sm21) / S; out[2] = (sm31 + sm13) / S; } else if (sm22 > sm33) { S = Math.sqrt(1.0 + sm22 - sm11 - sm33) * 2; out[3] = (sm31 - sm13) / S; out[0] = (sm12 + sm21) / S; out[1] = 0.25 * S; out[2] = (sm23 + sm32) / S; } else { S = Math.sqrt(1.0 + sm33 - sm11 - sm22) * 2; out[3] = (sm12 - sm21) / S; out[0] = (sm31 + sm13) / S; out[1] = (sm23 + sm32) / S; out[2] = 0.25 * S; } return out; } /** * Creates a matrix from a quaternion rotation, vector translation and vector scale * This is equivalent to (but much faster than): * * mat4.identity(dest); * mat4.translate(dest, vec); * let quatMat = mat4.create(); * quat4.toMat4(quat, quatMat); * mat4.multiply(dest, quatMat); * mat4.scale(dest, scale) * * @param {mat4} out mat4 receiving operation result * @param {quat4} q Rotation quaternion * @param {ReadonlyVec3} v Translation vector * @param {ReadonlyVec3} s Scaling vector * @returns {mat4} out */ function fromRotationTranslationScale(out, q, v, s) { // Quaternion math var x = q[0], y = q[1], z = q[2], w = q[3]; var x2 = x + x; var y2 = y + y; var z2 = z + z; var xx = x * x2; var xy = x * y2; var xz = x * z2; var yy = y * y2; var yz = y * z2; var zz = z * z2; var wx = w * x2; var wy = w * y2; var wz = w * z2; var sx = s[0]; var sy = s[1]; var sz = s[2]; out[0] = (1 - (yy + zz)) * sx; out[1] = (xy + wz) * sx; out[2] = (xz - wy) * sx; out[3] = 0; out[4] = (xy - wz) * sy; out[5] = (1 - (xx + zz)) * sy; out[6] = (yz + wx) * sy; out[7] = 0; out[8] = (xz + wy) * sz; out[9] = (yz - wx) * sz; out[10] = (1 - (xx + yy)) * sz; out[11] = 0; out[12] = v[0]; out[13] = v[1]; out[14] = v[2]; out[15] = 1; return out; } /** * Creates a matrix from a quaternion rotation, vector translation and vector scale, rotating and scaling around the given origin * This is equivalent to (but much faster than): * * mat4.identity(dest); * mat4.translate(dest, vec); * mat4.translate(dest, origin); * let quatMat = mat4.create(); * quat4.toMat4(quat, quatMat); * mat4.multiply(dest, quatMat); * mat4.scale(dest, scale) * mat4.translate(dest, negativeOrigin); * * @param {mat4} out mat4 receiving operation result * @param {quat4} q Rotation quaternion * @param {ReadonlyVec3} v Translation vector * @param {ReadonlyVec3} s Scaling vector * @param {ReadonlyVec3} o The origin vector around which to scale and rotate * @returns {mat4} out */ function fromRotationTranslationScaleOrigin(out, q, v, s, o) { // Quaternion math var x = q[0], y = q[1], z = q[2], w = q[3]; var x2 = x + x; var y2 = y + y; var z2 = z + z; var xx = x * x2; var xy = x * y2; var xz = x * z2; var yy = y * y2; var yz = y * z2; var zz = z * z2; var wx = w * x2; var wy = w * y2; var wz = w * z2; var sx = s[0]; var sy = s[1]; var sz = s[2]; var ox = o[0]; var oy = o[1]; var oz = o[2]; var out0 = (1 - (yy + zz)) * sx; var out1 = (xy + wz) * sx; var out2 = (xz - wy) * sx; var out4 = (xy - wz) * sy; var out5 = (1 - (xx + zz)) * sy; var out6 = (yz + wx) * sy; var out8 = (xz + wy) * sz; var out9 = (yz - wx) * sz; var out10 = (1 - (xx + yy)) * sz; out[0] = out0; out[1] = out1; out[2] = out2; out[3] = 0; out[4] = out4; out[5] = out5; out[6] = out6; out[7] = 0; out[8] = out8; out[9] = out9; out[10] = out10; out[11] = 0; out[12] = v[0] + ox - (out0 * ox + out4 * oy + out8 * oz); out[13] = v[1] + oy - (out1 * ox + out5 * oy + out9 * oz); out[14] = v[2] + oz - (out2 * ox + out6 * oy + out10 * oz); out[15] = 1; return out; } /** * Calculates a 4x4 matrix from the given quaternion * * @param {mat4} out mat4 receiving operation result * @param {ReadonlyQuat} q Quaternion to create matrix from * * @returns {mat4} out */ function fromQuat(out, q) { var x = q[0], y = q[1], z = q[2], w = q[3]; var x2 = x + x; var y2 = y + y; var z2 = z + z; var xx = x * x2; var yx = y * x2; var yy = y * y2; var zx = z * x2; var zy = z * y2; var zz = z * z2; var wx = w * x2; var wy = w * y2; var wz = w * z2; out[0] = 1 - yy - zz; out[1] = yx + wz; out[2] = zx - wy; out[3] = 0; out[4] = yx - wz; out[5] = 1 - xx - zz; out[6] = zy + wx; out[7] = 0; out[8] = zx + wy; out[9] = zy - wx; out[10] = 1 - xx - yy; out[11] = 0; out[12] = 0; out[13] = 0; out[14] = 0; out[15] = 1; return out; } /** * Generates a frustum matrix with the given bounds * * @param {mat4} out mat4 frustum matrix will be written into * @param {Number} left Left bound of the frustum * @param {Number} right Right bound of the frustum * @param {Number} bottom Bottom bound of the frustum * @param {Number} top Top bound of the frustum * @param {Number} near Near bound of the frustum * @param {Number} far Far bound of the frustum * @returns {mat4} out */ function frustum(out, left, right, bottom, top, near, far) { var rl = 1 / (right - left); var tb = 1 / (top - bottom); var nf = 1 / (near - far); out[0] = near * 2 * rl; out[1] = 0; out[2] = 0; out[3] = 0; out[4] = 0; out[5] = near * 2 * tb; out[6] = 0; out[7] = 0; out[8] = (right + left) * rl; out[9] = (top + bottom) * tb; out[10] = (far + near) * nf; out[11] = -1; out[12] = 0; out[13] = 0; out[14] = far * near * 2 * nf; out[15] = 0; return out; } /** * Generates a perspective projection matrix with the given bounds. * Passing null/undefined/no value for far will generate infinite projection matrix. * * @param {mat4} out mat4 frustum matrix will be written into * @param {number} fovy Vertical field of view in radians * @param {number} aspect Aspect ratio. typically viewport width/height * @param {number} near Near bound of the frustum * @param {number} far Far bound of the frustum, can be null or Infinity * @returns {mat4} out */ function perspective(out, fovy, aspect, near, far) { var f = 1.0 / Math.tan(fovy / 2), nf; out[0] = f / aspect; out[1] = 0; out[2] = 0; out[3] = 0; out[4] = 0; out[5] = f; out[6] = 0; out[7] = 0; out[8] = 0; out[9] = 0; out[11] = -1; out[12] = 0; out[13] = 0; out[15] = 0; if (far != null && far !== Infinity) { nf = 1 / (near - far); out[10] = (far + near) * nf; out[14] = 2 * far * near * nf; } else { out[10] = -1; out[14] = -2 * near; } return out; } /** * Generates a perspective projection matrix with the given field of view. * This is primarily useful for generating projection matrices to be used * with the still experiemental WebVR API. * * @param {mat4} out mat4 frustum matrix will be written into * @param {Object} fov Object containing the following values: upDegrees, downDegrees, leftDegrees, rightDegrees * @param {number} near Near bound of the frustum * @param {number} far Far bound of the frustum * @returns {mat4} out */ function perspectiveFromFieldOfView(out, fov, near, far) { var upTan = Math.tan(fov.upDegrees * Math.PI / 180.0); var downTan = Math.tan(fov.downDegrees * Math.PI / 180.0); var leftTan = Math.tan(fov.leftDegrees * Math.PI / 180.0); var rightTan = Math.tan(fov.rightDegrees * Math.PI / 180.0); var xScale = 2.0 / (leftTan + rightTan); var yScale = 2.0 / (upTan + downTan); out[0] = xScale; out[1] = 0.0; out[2] = 0.0; out[3] = 0.0; out[4] = 0.0; out[5] = yScale; out[6] = 0.0; out[7] = 0.0; out[8] = -((leftTan - rightTan) * xScale * 0.5); out[9] = (upTan - downTan) * yScale * 0.5; out[10] = far / (near - far); out[11] = -1.0; out[12] = 0.0; out[13] = 0.0; out[14] = far * near / (near - far); out[15] = 0.0; return out; } /** * Generates a orthogonal projection matrix with the given bounds * * @param {mat4} out mat4 frustum matrix will be written into * @param {number} left Left bound of the frustum * @param {number} right Right bound of the frustum * @param {number} bottom Bottom bound of the frustum * @param {number} top Top bound of the frustum * @param {number} near Near bound of the frustum * @param {number} far Far bound of the frustum * @returns {mat4} out */ function ortho(out, left, right, bottom, top, near, far) { var lr = 1 / (left - right); var bt = 1 / (bottom - top); var nf = 1 / (near - far); out[0] = -2 * lr; out[1] = 0; out[2] = 0; out[3] = 0; out[4] = 0; out[5] = -2 * bt; out[6] = 0; out[7] = 0; out[8] = 0; out[9] = 0; out[10] = 2 * nf; out[11] = 0; out[12] = (left + right) * lr; out[13] = (top + bottom) * bt; out[14] = (far + near) * nf; out[15] = 1; return out; } /** * Generates a look-at matrix with the given eye position, focal point, and up axis. * If you want a matrix that actually makes an object look at another object, you should use targetTo instead. * * @param {mat4} out mat4 frustum matrix will be written into * @param {ReadonlyVec3} eye Position of the viewer * @param {ReadonlyVec3} center Point the viewer is looking at * @param {ReadonlyVec3} up vec3 pointing up * @returns {mat4} out */ function lookAt(out, eye, center, up) { var x0, x1, x2, y0, y1, y2, z0, z1, z2, len; var eyex = eye[0]; var eyey = eye[1]; var eyez = eye[2]; var upx = up[0]; var upy = up[1]; var upz = up[2]; var centerx = center[0]; var centery = center[1]; var centerz = center[2]; if (Math.abs(eyex - centerx) < _common_js__WEBPACK_IMPORTED_MODULE_0__["EPSILON"] && Math.abs(eyey - centery) < _common_js__WEBPACK_IMPORTED_MODULE_0__["EPSILON"] && Math.abs(eyez - centerz) < _common_js__WEBPACK_IMPORTED_MODULE_0__["EPSILON"]) { return identity(out); } z0 = eyex - centerx; z1 = eyey - centery; z2 = eyez - centerz; len = 1 / Math.hypot(z0, z1, z2); z0 *= len; z1 *= len; z2 *= len; x0 = upy * z2 - upz * z1; x1 = upz * z0 - upx * z2; x2 = upx * z1 - upy * z0; len = Math.hypot(x0, x1, x2); if (!len) { x0 = 0; x1 = 0; x2 = 0; } else { len = 1 / len; x0 *= len; x1 *= len; x2 *= len; } y0 = z1 * x2 - z2 * x1; y1 = z2 * x0 - z0 * x2; y2 = z0 * x1 - z1 * x0; len = Math.hypot(y0, y1, y2); if (!len) { y0 = 0; y1 = 0; y2 = 0; } else { len = 1 / len; y0 *= len; y1 *= len; y2 *= len; } out[0] = x0; out[1] = y0; out[2] = z0; out[3] = 0; out[4] = x1; out[5] = y1; out[6] = z1; out[7] = 0; out[8] = x2; out[9] = y2; out[10] = z2; out[11] = 0; out[12] = -(x0 * eyex + x1 * eyey + x2 * eyez); out[13] = -(y0 * eyex + y1 * eyey + y2 * eyez); out[14] = -(z0 * eyex + z1 * eyey + z2 * eyez); out[15] = 1; return out; } /** * Generates a matrix that makes something look at something else. * * @param {mat4} out mat4 frustum matrix will be written into * @param {ReadonlyVec3} eye Position of the viewer * @param {ReadonlyVec3} center Point the viewer is looking at * @param {ReadonlyVec3} up vec3 pointing up * @returns {mat4} out */ function targetTo(out, eye, target, up) { var eyex = eye[0], eyey = eye[1], eyez = eye[2], upx = up[0], upy = up[1], upz = up[2]; var z0 = eyex - target[0], z1 = eyey - target[1], z2 = eyez - target[2]; var len = z0 * z0 + z1 * z1 + z2 * z2; if (len > 0) { len = 1 / Math.sqrt(len); z0 *= len; z1 *= len; z2 *= len; } var x0 = upy * z2 - upz * z1, x1 = upz * z0 - upx * z2, x2 = upx * z1 - upy * z0; len = x0 * x0 + x1 * x1 + x2 * x2; if (len > 0) { len = 1 / Math.sqrt(len); x0 *= len; x1 *= len; x2 *= len; } out[0] = x0; out[1] = x1; out[2] = x2; out[3] = 0; out[4] = z1 * x2 - z2 * x1; out[5] = z2 * x0 - z0 * x2; out[6] = z0 * x1 - z1 * x0; out[7] = 0; out[8] = z0; out[9] = z1; out[10] = z2; out[11] = 0; out[12] = eyex; out[13] = eyey; out[14] = eyez; out[15] = 1; return out; } /** * Returns a string representation of a mat4 * * @param {ReadonlyMat4} a matrix to represent as a string * @returns {String} string representation of the matrix */ function str(a) { return "mat4(" + a[0] + ", " + a[1] + ", " + a[2] + ", " + a[3] + ", " + a[4] + ", " + a[5] + ", " + a[6] + ", " + a[7] + ", " + a[8] + ", " + a[9] + ", " + a[10] + ", " + a[11] + ", " + a[12] + ", " + a[13] + ", " + a[14] + ", " + a[15] + ")"; } /** * Returns Frobenius norm of a mat4 * * @param {ReadonlyMat4} a the matrix to calculate Frobenius norm of * @returns {Number} Frobenius norm */ function frob(a) { return Math.hypot(a[0], a[1], a[2], a[3], a[4], a[5], a[6], a[7], a[8], a[9], a[10], a[11], a[12], a[13], a[14], a[15]); } /** * Adds two mat4's * * @param {mat4} out the receiving matrix * @param {ReadonlyMat4} a the first operand * @param {ReadonlyMat4} b the second operand * @returns {mat4} out */ function add(out, a, b) { out[0] = a[0] + b[0]; out[1] = a[1] + b[1]; out[2] = a[2] + b[2]; out[3] = a[3] + b[3]; out[4] = a[4] + b[4]; out[5] = a[5] + b[5]; out[6] = a[6] + b[6]; out[7] = a[7] + b[7]; out[8] = a[8] + b[8]; out[9] = a[9] + b[9]; out[10] = a[10] + b[10]; out[11] = a[11] + b[11]; out[12] = a[12] + b[12]; out[13] = a[13] + b[13]; out[14] = a[14] + b[14]; out[15] = a[15] + b[15]; return out; } /** * Subtracts matrix b from matrix a * * @param {mat4} out the receiving matrix * @param {ReadonlyMat4} a the first operand * @param {ReadonlyMat4} b the second operand * @returns {mat4} out */ function subtract(out, a, b) { out[0] = a[0] - b[0]; out[1] = a[1] - b[1]; out[2] = a[2] - b[2]; out[3] = a[3] - b[3]; out[4] = a[4] - b[4]; out[5] = a[5] - b[5]; out[6] = a[6] - b[6]; out[7] = a[7] - b[7]; out[8] = a[8] - b[8]; out[9] = a[9] - b[9]; out[10] = a[10] - b[10]; out[11] = a[11] - b[11]; out[12] = a[12] - b[12]; out[13] = a[13] - b[13]; out[14] = a[14] - b[14]; out[15] = a[15] - b[15]; return out; } /** * Multiply each element of the matrix by a scalar. * * @param {mat4} out the receiving matrix * @param {ReadonlyMat4} a the matrix to scale * @param {Number} b amount to scale the matrix's elements by * @returns {mat4} out */ function multiplyScalar(out, a, b) { out[0] = a[0] * b; out[1] = a[1] * b; out[2] = a[2] * b; out[3] = a[3] * b; out[4] = a[4] * b; out[5] = a[5] * b; out[6] = a[6] * b; out[7] = a[7] * b; out[8] = a[8] * b; out[9] = a[9] * b; out[10] = a[10] * b; out[11] = a[11] * b; out[12] = a[12] * b; out[13] = a[13] * b; out[14] = a[14] * b; out[15] = a[15] * b; return out; } /** * Adds two mat4's after multiplying each element of the second operand by a scalar value. * * @param {mat4} out the receiving vector * @param {ReadonlyMat4} a the first operand * @param {ReadonlyMat4} b the second operand * @param {Number} scale the amount to scale b's elements by before adding * @returns {mat4} out */ function multiplyScalarAndAdd(out, a, b, scale) { out[0] = a[0] + b[0] * scale; out[1] = a[1] + b[1] * scale; out[2] = a[2] + b[2] * scale; out[3] = a[3] + b[3] * scale; out[4] = a[4] + b[4] * scale; out[5] = a[5] + b[5] * scale; out[6] = a[6] + b[6] * scale; out[7] = a[7] + b[7] * scale; out[8] = a[8] + b[8] * scale; out[9] = a[9] + b[9] * scale; out[10] = a[10] + b[10] * scale; out[11] = a[11] + b[11] * scale; out[12] = a[12] + b[12] * scale; out[13] = a[13] + b[13] * scale; out[14] = a[14] + b[14] * scale; out[15] = a[15] + b[15] * scale; return out; } /** * Returns whether or not the matrices have exactly the same elements in the same position (when compared with ===) * * @param {ReadonlyMat4} a The first matrix. * @param {ReadonlyMat4} b The second matrix. * @returns {Boolean} True if the matrices are equal, false otherwise. */ function exactEquals(a, b) { return a[0] === b[0] && a[1] === b[1] && a[2] === b[2] && a[3] === b[3] && a[4] === b[4] && a[5] === b[5] && a[6] === b[6] && a[7] === b[7] && a[8] === b[8] && a[9] === b[9] && a[10] === b[10] && a[11] === b[11] && a[12] === b[12] && a[13] === b[13] && a[14] === b[14] && a[15] === b[15]; } /** * Returns whether or not the matrices have approximately the same elements in the same position. * * @param {ReadonlyMat4} a The first matrix. * @param {ReadonlyMat4} b The second matrix. * @returns {Boolean} True if the matrices are equal, false otherwise. */ function equals(a, b) { var a0 = a[0], a1 = a[1], a2 = a[2], a3 = a[3]; var a4 = a[4], a5 = a[5], a6 = a[6], a7 = a[7]; var a8 = a[8], a9 = a[9], a10 = a[10], a11 = a[11]; var a12 = a[12], a13 = a[13], a14 = a[14], a15 = a[15]; var b0 = b[0], b1 = b[1], b2 = b[2], b3 = b[3]; var b4 = b[4], b5 = b[5], b6 = b[6], b7 = b[7]; var b8 = b[8], b9 = b[9], b10 = b[10], b11 = b[11]; var b12 = b[12], b13 = b[13], b14 = b[14], b15 = b[15]; return Math.abs(a0 - b0) <= _common_js__WEBPACK_IMPORTED_MODULE_0__["EPSILON"] * Math.max(1.0, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= _common_js__WEBPACK_IMPORTED_MODULE_0__["EPSILON"] * Math.max(1.0, Math.abs(a1), Math.abs(b1)) && Math.abs(a2 - b2) <= _common_js__WEBPACK_IMPORTED_MODULE_0__["EPSILON"] * Math.max(1.0, Math.abs(a2), Math.abs(b2)) && Math.abs(a3 - b3) <= _common_js__WEBPACK_IMPORTED_MODULE_0__["EPSILON"] * Math.max(1.0, Math.abs(a3), Math.abs(b3)) && Math.abs(a4 - b4) <= _common_js__WEBPACK_IMPORTED_MODULE_0__["EPSILON"] * Math.max(1.0, Math.abs(a4), Math.abs(b4)) && Math.abs(a5 - b5) <= _common_js__WEBPACK_IMPORTED_MODULE_0__["EPSILON"] * Math.max(1.0, Math.abs(a5), Math.abs(b5)) && Math.abs(a6 - b6) <= _common_js__WEBPACK_IMPORTED_MODULE_0__["EPSILON"] * Math.max(1.0, Math.abs(a6), Math.abs(b6)) && Math.abs(a7 - b7) <= _common_js__WEBPACK_IMPORTED_MODULE_0__["EPSILON"] * Math.max(1.0, Math.abs(a7), Math.abs(b7)) && Math.abs(a8 - b8) <= _common_js__WEBPACK_IMPORTED_MODULE_0__["EPSILON"] * Math.max(1.0, Math.abs(a8), Math.abs(b8)) && Math.abs(a9 - b9) <= _common_js__WEBPACK_IMPORTED_MODULE_0__["EPSILON"] * Math.max(1.0, Math.abs(a9), Math.abs(b9)) && Math.abs(a10 - b10) <= _common_js__WEBPACK_IMPORTED_MODULE_0__["EPSILON"] * Math.max(1.0, Math.abs(a10), Math.abs(b10)) && Math.abs(a11 - b11) <= _common_js__WEBPACK_IMPORTED_MODULE_0__["EPSILON"] * Math.max(1.0, Math.abs(a11), Math.abs(b11)) && Math.abs(a12 - b12) <= _common_js__WEBPACK_IMPORTED_MODULE_0__["EPSILON"] * Math.max(1.0, Math.abs(a12), Math.abs(b12)) && Math.abs(a13 - b13) <= _common_js__WEBPACK_IMPORTED_MODULE_0__["EPSILON"] * Math.max(1.0, Math.abs(a13), Math.abs(b13)) && Math.abs(a14 - b14) <= _common_js__WEBPACK_IMPORTED_MODULE_0__["EPSILON"] * Math.max(1.0, Math.abs(a14), Math.abs(b14)) && Math.abs(a15 - b15) <= _common_js__WEBPACK_IMPORTED_MODULE_0__["EPSILON"] * Math.max(1.0, Math.abs(a15), Math.abs(b15)); } /** * Alias for {@link mat4.multiply} * @function */ var mul = multiply; /** * Alias for {@link mat4.subtract} * @function */ var sub = subtract; /***/ }), /***/ "./node_modules/_gl-matrix@3.3.0@gl-matrix/esm/quat.js": /*!*************************************************************!*\ !*** ./node_modules/_gl-matrix@3.3.0@gl-matrix/esm/quat.js ***! \*************************************************************/ /*! exports provided: create, identity, setAxisAngle, getAxisAngle, getAngle, multiply, rotateX, rotateY, rotateZ, calculateW, exp, ln, pow, slerp, random, invert, conjugate, fromMat3, fromEuler, str, clone, fromValues, copy, set, add, mul, scale, dot, lerp, length, len, squaredLength, sqrLen, normalize, exactEquals, equals, rotationTo, sqlerp, setAxes */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "create", function() { return create; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "identity", function() { return identity; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "setAxisAngle", function() { return setAxisAngle; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getAxisAngle", function() { return getAxisAngle; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getAngle", function() { return getAngle; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "multiply", function() { return multiply; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "rotateX", function() { return rotateX; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "rotateY", function() { return rotateY; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "rotateZ", function() { return rotateZ; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "calculateW", function() { return calculateW; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "exp", function() { return exp; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ln", function() { return ln; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "pow", function() { return pow; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "slerp", function() { return slerp; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "random", function() { return random; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "invert", function() { return invert; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "conjugate", function() { return conjugate; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "fromMat3", function() { return fromMat3; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "fromEuler", function() { return fromEuler; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "str", function() { return str; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "clone", function() { return clone; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "fromValues", function() { return fromValues; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "copy", function() { return copy; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "set", function() { return set; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "add", function() { return add; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "mul", function() { return mul; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "scale", function() { return scale; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "dot", function() { return dot; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "lerp", function() { return lerp; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "length", function() { return length; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "len", function() { return len; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "squaredLength", function() { return squaredLength; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "sqrLen", function() { return sqrLen; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "normalize", function() { return normalize; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "exactEquals", function() { return exactEquals; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "equals", function() { return equals; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "rotationTo", function() { return rotationTo; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "sqlerp", function() { return sqlerp; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "setAxes", function() { return setAxes; }); /* harmony import */ var _common_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./common.js */ "./node_modules/_gl-matrix@3.3.0@gl-matrix/esm/common.js"); /* harmony import */ var _mat3_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./mat3.js */ "./node_modules/_gl-matrix@3.3.0@gl-matrix/esm/mat3.js"); /* harmony import */ var _vec3_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./vec3.js */ "./node_modules/_gl-matrix@3.3.0@gl-matrix/esm/vec3.js"); /* harmony import */ var _vec4_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./vec4.js */ "./node_modules/_gl-matrix@3.3.0@gl-matrix/esm/vec4.js"); /** * Quaternion * @module quat */ /** * Creates a new identity quat * * @returns {quat} a new quaternion */ function create() { var out = new _common_js__WEBPACK_IMPORTED_MODULE_0__["ARRAY_TYPE"](4); if (_common_js__WEBPACK_IMPORTED_MODULE_0__["ARRAY_TYPE"] != Float32Array) { out[0] = 0; out[1] = 0; out[2] = 0; } out[3] = 1; return out; } /** * Set a quat to the identity quaternion * * @param {quat} out the receiving quaternion * @returns {quat} out */ function identity(out) { out[0] = 0; out[1] = 0; out[2] = 0; out[3] = 1; return out; } /** * Sets a quat from the given angle and rotation axis, * then returns it. * * @param {quat} out the receiving quaternion * @param {ReadonlyVec3} axis the axis around which to rotate * @param {Number} rad the angle in radians * @returns {quat} out **/ function setAxisAngle(out, axis, rad) { rad = rad * 0.5; var s = Math.sin(rad); out[0] = s * axis[0]; out[1] = s * axis[1]; out[2] = s * axis[2]; out[3] = Math.cos(rad); return out; } /** * Gets the rotation axis and angle for a given * quaternion. If a quaternion is created with * setAxisAngle, this method will return the same * values as providied in the original parameter list * OR functionally equivalent values. * Example: The quaternion formed by axis [0, 0, 1] and * angle -90 is the same as the quaternion formed by * [0, 0, 1] and 270. This method favors the latter. * @param {vec3} out_axis Vector receiving the axis of rotation * @param {ReadonlyQuat} q Quaternion to be decomposed * @return {Number} Angle, in radians, of the rotation */ function getAxisAngle(out_axis, q) { var rad = Math.acos(q[3]) * 2.0; var s = Math.sin(rad / 2.0); if (s > _common_js__WEBPACK_IMPORTED_MODULE_0__["EPSILON"]) { out_axis[0] = q[0] / s; out_axis[1] = q[1] / s; out_axis[2] = q[2] / s; } else { // If s is zero, return any axis (no rotation - axis does not matter) out_axis[0] = 1; out_axis[1] = 0; out_axis[2] = 0; } return rad; } /** * Gets the angular distance between two unit quaternions * * @param {ReadonlyQuat} a Origin unit quaternion * @param {ReadonlyQuat} b Destination unit quaternion * @return {Number} Angle, in radians, between the two quaternions */ function getAngle(a, b) { var dotproduct = dot(a, b); return Math.acos(2 * dotproduct * dotproduct - 1); } /** * Multiplies two quat's * * @param {quat} out the receiving quaternion * @param {ReadonlyQuat} a the first operand * @param {ReadonlyQuat} b the second operand * @returns {quat} out */ function multiply(out, a, b) { var ax = a[0], ay = a[1], az = a[2], aw = a[3]; var bx = b[0], by = b[1], bz = b[2], bw = b[3]; out[0] = ax * bw + aw * bx + ay * bz - az * by; out[1] = ay * bw + aw * by + az * bx - ax * bz; out[2] = az * bw + aw * bz + ax * by - ay * bx; out[3] = aw * bw - ax * bx - ay * by - az * bz; return out; } /** * Rotates a quaternion by the given angle about the X axis * * @param {quat} out quat receiving operation result * @param {ReadonlyQuat} a quat to rotate * @param {number} rad angle (in radians) to rotate * @returns {quat} out */ function rotateX(out, a, rad) { rad *= 0.5; var ax = a[0], ay = a[1], az = a[2], aw = a[3]; var bx = Math.sin(rad), bw = Math.cos(rad); out[0] = ax * bw + aw * bx; out[1] = ay * bw + az * bx; out[2] = az * bw - ay * bx; out[3] = aw * bw - ax * bx; return out; } /** * Rotates a quaternion by the given angle about the Y axis * * @param {quat} out quat receiving operation result * @param {ReadonlyQuat} a quat to rotate * @param {number} rad angle (in radians) to rotate * @returns {quat} out */ function rotateY(out, a, rad) { rad *= 0.5; var ax = a[0], ay = a[1], az = a[2], aw = a[3]; var by = Math.sin(rad), bw = Math.cos(rad); out[0] = ax * bw - az * by; out[1] = ay * bw + aw * by; out[2] = az * bw + ax * by; out[3] = aw * bw - ay * by; return out; } /** * Rotates a quaternion by the given angle about the Z axis * * @param {quat} out quat receiving operation result * @param {ReadonlyQuat} a quat to rotate * @param {number} rad angle (in radians) to rotate * @returns {quat} out */ function rotateZ(out, a, rad) { rad *= 0.5; var ax = a[0], ay = a[1], az = a[2], aw = a[3]; var bz = Math.sin(rad), bw = Math.cos(rad); out[0] = ax * bw + ay * bz; out[1] = ay * bw - ax * bz; out[2] = az * bw + aw * bz; out[3] = aw * bw - az * bz; return out; } /** * Calculates the W component of a quat from the X, Y, and Z components. * Assumes that quaternion is 1 unit in length. * Any existing W component will be ignored. * * @param {quat} out the receiving quaternion * @param {ReadonlyQuat} a quat to calculate W component of * @returns {quat} out */ function calculateW(out, a) { var x = a[0], y = a[1], z = a[2]; out[0] = x; out[1] = y; out[2] = z; out[3] = Math.sqrt(Math.abs(1.0 - x * x - y * y - z * z)); return out; } /** * Calculate the exponential of a unit quaternion. * * @param {quat} out the receiving quaternion * @param {ReadonlyQuat} a quat to calculate the exponential of * @returns {quat} out */ function exp(out, a) { var x = a[0], y = a[1], z = a[2], w = a[3]; var r = Math.sqrt(x * x + y * y + z * z); var et = Math.exp(w); var s = r > 0 ? et * Math.sin(r) / r : 0; out[0] = x * s; out[1] = y * s; out[2] = z * s; out[3] = et * Math.cos(r); return out; } /** * Calculate the natural logarithm of a unit quaternion. * * @param {quat} out the receiving quaternion * @param {ReadonlyQuat} a quat to calculate the exponential of * @returns {quat} out */ function ln(out, a) { var x = a[0], y = a[1], z = a[2], w = a[3]; var r = Math.sqrt(x * x + y * y + z * z); var t = r > 0 ? Math.atan2(r, w) / r : 0; out[0] = x * t; out[1] = y * t; out[2] = z * t; out[3] = 0.5 * Math.log(x * x + y * y + z * z + w * w); return out; } /** * Calculate the scalar power of a unit quaternion. * * @param {quat} out the receiving quaternion * @param {ReadonlyQuat} a quat to calculate the exponential of * @param {Number} b amount to scale the quaternion by * @returns {quat} out */ function pow(out, a, b) { ln(out, a); scale(out, out, b); exp(out, out); return out; } /** * Performs a spherical linear interpolation between two quat * * @param {quat} out the receiving quaternion * @param {ReadonlyQuat} a the first operand * @param {ReadonlyQuat} b the second operand * @param {Number} t interpolation amount, in the range [0-1], between the two inputs * @returns {quat} out */ function slerp(out, a, b, t) { // benchmarks: // http://jsperf.com/quaternion-slerp-implementations var ax = a[0], ay = a[1], az = a[2], aw = a[3]; var bx = b[0], by = b[1], bz = b[2], bw = b[3]; var omega, cosom, sinom, scale0, scale1; // calc cosine cosom = ax * bx + ay * by + az * bz + aw * bw; // adjust signs (if necessary) if (cosom < 0.0) { cosom = -cosom; bx = -bx; by = -by; bz = -bz; bw = -bw; } // calculate coefficients if (1.0 - cosom > _common_js__WEBPACK_IMPORTED_MODULE_0__["EPSILON"]) { // standard case (slerp) omega = Math.acos(cosom); sinom = Math.sin(omega); scale0 = Math.sin((1.0 - t) * omega) / sinom; scale1 = Math.sin(t * omega) / sinom; } else { // "from" and "to" quaternions are very close // ... so we can do a linear interpolation scale0 = 1.0 - t; scale1 = t; } // calculate final values out[0] = scale0 * ax + scale1 * bx; out[1] = scale0 * ay + scale1 * by; out[2] = scale0 * az + scale1 * bz; out[3] = scale0 * aw + scale1 * bw; return out; } /** * Generates a random unit quaternion * * @param {quat} out the receiving quaternion * @returns {quat} out */ function random(out) { // Implementation of http://planning.cs.uiuc.edu/node198.html // TODO: Calling random 3 times is probably not the fastest solution var u1 = _common_js__WEBPACK_IMPORTED_MODULE_0__["RANDOM"](); var u2 = _common_js__WEBPACK_IMPORTED_MODULE_0__["RANDOM"](); var u3 = _common_js__WEBPACK_IMPORTED_MODULE_0__["RANDOM"](); var sqrt1MinusU1 = Math.sqrt(1 - u1); var sqrtU1 = Math.sqrt(u1); out[0] = sqrt1MinusU1 * Math.sin(2.0 * Math.PI * u2); out[1] = sqrt1MinusU1 * Math.cos(2.0 * Math.PI * u2); out[2] = sqrtU1 * Math.sin(2.0 * Math.PI * u3); out[3] = sqrtU1 * Math.cos(2.0 * Math.PI * u3); return out; } /** * Calculates the inverse of a quat * * @param {quat} out the receiving quaternion * @param {ReadonlyQuat} a quat to calculate inverse of * @returns {quat} out */ function invert(out, a) { var a0 = a[0], a1 = a[1], a2 = a[2], a3 = a[3]; var dot = a0 * a0 + a1 * a1 + a2 * a2 + a3 * a3; var invDot = dot ? 1.0 / dot : 0; // TODO: Would be faster to return [0,0,0,0] immediately if dot == 0 out[0] = -a0 * invDot; out[1] = -a1 * invDot; out[2] = -a2 * invDot; out[3] = a3 * invDot; return out; } /** * Calculates the conjugate of a quat * If the quaternion is normalized, this function is faster than quat.inverse and produces the same result. * * @param {quat} out the receiving quaternion * @param {ReadonlyQuat} a quat to calculate conjugate of * @returns {quat} out */ function conjugate(out, a) { out[0] = -a[0]; out[1] = -a[1]; out[2] = -a[2]; out[3] = a[3]; return out; } /** * Creates a quaternion from the given 3x3 rotation matrix. * * NOTE: The resultant quaternion is not normalized, so you should be sure * to renormalize the quaternion yourself where necessary. * * @param {quat} out the receiving quaternion * @param {ReadonlyMat3} m rotation matrix * @returns {quat} out * @function */ function fromMat3(out, m) { // Algorithm in Ken Shoemake's article in 1987 SIGGRAPH course notes // article "Quaternion Calculus and Fast Animation". var fTrace = m[0] + m[4] + m[8]; var fRoot; if (fTrace > 0.0) { // |w| > 1/2, may as well choose w > 1/2 fRoot = Math.sqrt(fTrace + 1.0); // 2w out[3] = 0.5 * fRoot; fRoot = 0.5 / fRoot; // 1/(4w) out[0] = (m[5] - m[7]) * fRoot; out[1] = (m[6] - m[2]) * fRoot; out[2] = (m[1] - m[3]) * fRoot; } else { // |w| <= 1/2 var i = 0; if (m[4] > m[0]) i = 1; if (m[8] > m[i * 3 + i]) i = 2; var j = (i + 1) % 3; var k = (i + 2) % 3; fRoot = Math.sqrt(m[i * 3 + i] - m[j * 3 + j] - m[k * 3 + k] + 1.0); out[i] = 0.5 * fRoot; fRoot = 0.5 / fRoot; out[3] = (m[j * 3 + k] - m[k * 3 + j]) * fRoot; out[j] = (m[j * 3 + i] + m[i * 3 + j]) * fRoot; out[k] = (m[k * 3 + i] + m[i * 3 + k]) * fRoot; } return out; } /** * Creates a quaternion from the given euler angle x, y, z. * * @param {quat} out the receiving quaternion * @param {x} Angle to rotate around X axis in degrees. * @param {y} Angle to rotate around Y axis in degrees. * @param {z} Angle to rotate around Z axis in degrees. * @returns {quat} out * @function */ function fromEuler(out, x, y, z) { var halfToRad = 0.5 * Math.PI / 180.0; x *= halfToRad; y *= halfToRad; z *= halfToRad; var sx = Math.sin(x); var cx = Math.cos(x); var sy = Math.sin(y); var cy = Math.cos(y); var sz = Math.sin(z); var cz = Math.cos(z); out[0] = sx * cy * cz - cx * sy * sz; out[1] = cx * sy * cz + sx * cy * sz; out[2] = cx * cy * sz - sx * sy * cz; out[3] = cx * cy * cz + sx * sy * sz; return out; } /** * Returns a string representation of a quatenion * * @param {ReadonlyQuat} a vector to represent as a string * @returns {String} string representation of the vector */ function str(a) { return "quat(" + a[0] + ", " + a[1] + ", " + a[2] + ", " + a[3] + ")"; } /** * Creates a new quat initialized with values from an existing quaternion * * @param {ReadonlyQuat} a quaternion to clone * @returns {quat} a new quaternion * @function */ var clone = _vec4_js__WEBPACK_IMPORTED_MODULE_3__["clone"]; /** * Creates a new quat initialized with the given values * * @param {Number} x X component * @param {Number} y Y component * @param {Number} z Z component * @param {Number} w W component * @returns {quat} a new quaternion * @function */ var fromValues = _vec4_js__WEBPACK_IMPORTED_MODULE_3__["fromValues"]; /** * Copy the values from one quat to another * * @param {quat} out the receiving quaternion * @param {ReadonlyQuat} a the source quaternion * @returns {quat} out * @function */ var copy = _vec4_js__WEBPACK_IMPORTED_MODULE_3__["copy"]; /** * Set the components of a quat to the given values * * @param {quat} out the receiving quaternion * @param {Number} x X component * @param {Number} y Y component * @param {Number} z Z component * @param {Number} w W component * @returns {quat} out * @function */ var set = _vec4_js__WEBPACK_IMPORTED_MODULE_3__["set"]; /** * Adds two quat's * * @param {quat} out the receiving quaternion * @param {ReadonlyQuat} a the first operand * @param {ReadonlyQuat} b the second operand * @returns {quat} out * @function */ var add = _vec4_js__WEBPACK_IMPORTED_MODULE_3__["add"]; /** * Alias for {@link quat.multiply} * @function */ var mul = multiply; /** * Scales a quat by a scalar number * * @param {quat} out the receiving vector * @param {ReadonlyQuat} a the vector to scale * @param {Number} b amount to scale the vector by * @returns {quat} out * @function */ var scale = _vec4_js__WEBPACK_IMPORTED_MODULE_3__["scale"]; /** * Calculates the dot product of two quat's * * @param {ReadonlyQuat} a the first operand * @param {ReadonlyQuat} b the second operand * @returns {Number} dot product of a and b * @function */ var dot = _vec4_js__WEBPACK_IMPORTED_MODULE_3__["dot"]; /** * Performs a linear interpolation between two quat's * * @param {quat} out the receiving quaternion * @param {ReadonlyQuat} a the first operand * @param {ReadonlyQuat} b the second operand * @param {Number} t interpolation amount, in the range [0-1], between the two inputs * @returns {quat} out * @function */ var lerp = _vec4_js__WEBPACK_IMPORTED_MODULE_3__["lerp"]; /** * Calculates the length of a quat * * @param {ReadonlyQuat} a vector to calculate length of * @returns {Number} length of a */ var length = _vec4_js__WEBPACK_IMPORTED_MODULE_3__["length"]; /** * Alias for {@link quat.length} * @function */ var len = length; /** * Calculates the squared length of a quat * * @param {ReadonlyQuat} a vector to calculate squared length of * @returns {Number} squared length of a * @function */ var squaredLength = _vec4_js__WEBPACK_IMPORTED_MODULE_3__["squaredLength"]; /** * Alias for {@link quat.squaredLength} * @function */ var sqrLen = squaredLength; /** * Normalize a quat * * @param {quat} out the receiving quaternion * @param {ReadonlyQuat} a quaternion to normalize * @returns {quat} out * @function */ var normalize = _vec4_js__WEBPACK_IMPORTED_MODULE_3__["normalize"]; /** * Returns whether or not the quaternions have exactly the same elements in the same position (when compared with ===) * * @param {ReadonlyQuat} a The first quaternion. * @param {ReadonlyQuat} b The second quaternion. * @returns {Boolean} True if the vectors are equal, false otherwise. */ var exactEquals = _vec4_js__WEBPACK_IMPORTED_MODULE_3__["exactEquals"]; /** * Returns whether or not the quaternions have approximately the same elements in the same position. * * @param {ReadonlyQuat} a The first vector. * @param {ReadonlyQuat} b The second vector. * @returns {Boolean} True if the vectors are equal, false otherwise. */ var equals = _vec4_js__WEBPACK_IMPORTED_MODULE_3__["equals"]; /** * Sets a quaternion to represent the shortest rotation from one * vector to another. * * Both vectors are assumed to be unit length. * * @param {quat} out the receiving quaternion. * @param {ReadonlyVec3} a the initial vector * @param {ReadonlyVec3} b the destination vector * @returns {quat} out */ var rotationTo = function () { var tmpvec3 = _vec3_js__WEBPACK_IMPORTED_MODULE_2__["create"](); var xUnitVec3 = _vec3_js__WEBPACK_IMPORTED_MODULE_2__["fromValues"](1, 0, 0); var yUnitVec3 = _vec3_js__WEBPACK_IMPORTED_MODULE_2__["fromValues"](0, 1, 0); return function (out, a, b) { var dot = _vec3_js__WEBPACK_IMPORTED_MODULE_2__["dot"](a, b); if (dot < -0.999999) { _vec3_js__WEBPACK_IMPORTED_MODULE_2__["cross"](tmpvec3, xUnitVec3, a); if (_vec3_js__WEBPACK_IMPORTED_MODULE_2__["len"](tmpvec3) < 0.000001) _vec3_js__WEBPACK_IMPORTED_MODULE_2__["cross"](tmpvec3, yUnitVec3, a); _vec3_js__WEBPACK_IMPORTED_MODULE_2__["normalize"](tmpvec3, tmpvec3); setAxisAngle(out, tmpvec3, Math.PI); return out; } else if (dot > 0.999999) { out[0] = 0; out[1] = 0; out[2] = 0; out[3] = 1; return out; } else { _vec3_js__WEBPACK_IMPORTED_MODULE_2__["cross"](tmpvec3, a, b); out[0] = tmpvec3[0]; out[1] = tmpvec3[1]; out[2] = tmpvec3[2]; out[3] = 1 + dot; return normalize(out, out); } }; }(); /** * Performs a spherical linear interpolation with two control points * * @param {quat} out the receiving quaternion * @param {ReadonlyQuat} a the first operand * @param {ReadonlyQuat} b the second operand * @param {ReadonlyQuat} c the third operand * @param {ReadonlyQuat} d the fourth operand * @param {Number} t interpolation amount, in the range [0-1], between the two inputs * @returns {quat} out */ var sqlerp = function () { var temp1 = create(); var temp2 = create(); return function (out, a, b, c, d, t) { slerp(temp1, a, d, t); slerp(temp2, b, c, t); slerp(out, temp1, temp2, 2 * t * (1 - t)); return out; }; }(); /** * Sets the specified quaternion with values corresponding to the given * axes. Each axis is a vec3 and is expected to be unit length and * perpendicular to all other specified axes. * * @param {ReadonlyVec3} view the vector representing the viewing direction * @param {ReadonlyVec3} right the vector representing the local "right" direction * @param {ReadonlyVec3} up the vector representing the local "up" direction * @returns {quat} out */ var setAxes = function () { var matr = _mat3_js__WEBPACK_IMPORTED_MODULE_1__["create"](); return function (out, view, right, up) { matr[0] = right[0]; matr[3] = right[1]; matr[6] = right[2]; matr[1] = up[0]; matr[4] = up[1]; matr[7] = up[2]; matr[2] = -view[0]; matr[5] = -view[1]; matr[8] = -view[2]; return normalize(out, fromMat3(out, matr)); }; }(); /***/ }), /***/ "./node_modules/_gl-matrix@3.3.0@gl-matrix/esm/quat2.js": /*!**************************************************************!*\ !*** ./node_modules/_gl-matrix@3.3.0@gl-matrix/esm/quat2.js ***! \**************************************************************/ /*! exports provided: create, clone, fromValues, fromRotationTranslationValues, fromRotationTranslation, fromTranslation, fromRotation, fromMat4, copy, identity, set, getReal, getDual, setReal, setDual, getTranslation, translate, rotateX, rotateY, rotateZ, rotateByQuatAppend, rotateByQuatPrepend, rotateAroundAxis, add, multiply, mul, scale, dot, lerp, invert, conjugate, length, len, squaredLength, sqrLen, normalize, str, exactEquals, equals */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "create", function() { return create; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "clone", function() { return clone; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "fromValues", function() { return fromValues; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "fromRotationTranslationValues", function() { return fromRotationTranslationValues; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "fromRotationTranslation", function() { return fromRotationTranslation; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "fromTranslation", function() { return fromTranslation; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "fromRotation", function() { return fromRotation; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "fromMat4", function() { return fromMat4; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "copy", function() { return copy; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "identity", function() { return identity; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "set", function() { return set; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getReal", function() { return getReal; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getDual", function() { return getDual; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "setReal", function() { return setReal; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "setDual", function() { return setDual; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getTranslation", function() { return getTranslation; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "translate", function() { return translate; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "rotateX", function() { return rotateX; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "rotateY", function() { return rotateY; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "rotateZ", function() { return rotateZ; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "rotateByQuatAppend", function() { return rotateByQuatAppend; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "rotateByQuatPrepend", function() { return rotateByQuatPrepend; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "rotateAroundAxis", function() { return rotateAroundAxis; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "add", function() { return add; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "multiply", function() { return multiply; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "mul", function() { return mul; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "scale", function() { return scale; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "dot", function() { return dot; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "lerp", function() { return lerp; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "invert", function() { return invert; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "conjugate", function() { return conjugate; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "length", function() { return length; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "len", function() { return len; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "squaredLength", function() { return squaredLength; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "sqrLen", function() { return sqrLen; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "normalize", function() { return normalize; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "str", function() { return str; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "exactEquals", function() { return exactEquals; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "equals", function() { return equals; }); /* harmony import */ var _common_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./common.js */ "./node_modules/_gl-matrix@3.3.0@gl-matrix/esm/common.js"); /* harmony import */ var _quat_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./quat.js */ "./node_modules/_gl-matrix@3.3.0@gl-matrix/esm/quat.js"); /* harmony import */ var _mat4_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./mat4.js */ "./node_modules/_gl-matrix@3.3.0@gl-matrix/esm/mat4.js"); /** * Dual Quaternion
* Format: [real, dual]
* Quaternion format: XYZW
* Make sure to have normalized dual quaternions, otherwise the functions may not work as intended.
* @module quat2 */ /** * Creates a new identity dual quat * * @returns {quat2} a new dual quaternion [real -> rotation, dual -> translation] */ function create() { var dq = new _common_js__WEBPACK_IMPORTED_MODULE_0__["ARRAY_TYPE"](8); if (_common_js__WEBPACK_IMPORTED_MODULE_0__["ARRAY_TYPE"] != Float32Array) { dq[0] = 0; dq[1] = 0; dq[2] = 0; dq[4] = 0; dq[5] = 0; dq[6] = 0; dq[7] = 0; } dq[3] = 1; return dq; } /** * Creates a new quat initialized with values from an existing quaternion * * @param {ReadonlyQuat2} a dual quaternion to clone * @returns {quat2} new dual quaternion * @function */ function clone(a) { var dq = new _common_js__WEBPACK_IMPORTED_MODULE_0__["ARRAY_TYPE"](8); dq[0] = a[0]; dq[1] = a[1]; dq[2] = a[2]; dq[3] = a[3]; dq[4] = a[4]; dq[5] = a[5]; dq[6] = a[6]; dq[7] = a[7]; return dq; } /** * Creates a new dual quat initialized with the given values * * @param {Number} x1 X component * @param {Number} y1 Y component * @param {Number} z1 Z component * @param {Number} w1 W component * @param {Number} x2 X component * @param {Number} y2 Y component * @param {Number} z2 Z component * @param {Number} w2 W component * @returns {quat2} new dual quaternion * @function */ function fromValues(x1, y1, z1, w1, x2, y2, z2, w2) { var dq = new _common_js__WEBPACK_IMPORTED_MODULE_0__["ARRAY_TYPE"](8); dq[0] = x1; dq[1] = y1; dq[2] = z1; dq[3] = w1; dq[4] = x2; dq[5] = y2; dq[6] = z2; dq[7] = w2; return dq; } /** * Creates a new dual quat from the given values (quat and translation) * * @param {Number} x1 X component * @param {Number} y1 Y component * @param {Number} z1 Z component * @param {Number} w1 W component * @param {Number} x2 X component (translation) * @param {Number} y2 Y component (translation) * @param {Number} z2 Z component (translation) * @returns {quat2} new dual quaternion * @function */ function fromRotationTranslationValues(x1, y1, z1, w1, x2, y2, z2) { var dq = new _common_js__WEBPACK_IMPORTED_MODULE_0__["ARRAY_TYPE"](8); dq[0] = x1; dq[1] = y1; dq[2] = z1; dq[3] = w1; var ax = x2 * 0.5, ay = y2 * 0.5, az = z2 * 0.5; dq[4] = ax * w1 + ay * z1 - az * y1; dq[5] = ay * w1 + az * x1 - ax * z1; dq[6] = az * w1 + ax * y1 - ay * x1; dq[7] = -ax * x1 - ay * y1 - az * z1; return dq; } /** * Creates a dual quat from a quaternion and a translation * * @param {ReadonlyQuat2} dual quaternion receiving operation result * @param {ReadonlyQuat} q a normalized quaternion * @param {ReadonlyVec3} t tranlation vector * @returns {quat2} dual quaternion receiving operation result * @function */ function fromRotationTranslation(out, q, t) { var ax = t[0] * 0.5, ay = t[1] * 0.5, az = t[2] * 0.5, bx = q[0], by = q[1], bz = q[2], bw = q[3]; out[0] = bx; out[1] = by; out[2] = bz; out[3] = bw; out[4] = ax * bw + ay * bz - az * by; out[5] = ay * bw + az * bx - ax * bz; out[6] = az * bw + ax * by - ay * bx; out[7] = -ax * bx - ay * by - az * bz; return out; } /** * Creates a dual quat from a translation * * @param {ReadonlyQuat2} dual quaternion receiving operation result * @param {ReadonlyVec3} t translation vector * @returns {quat2} dual quaternion receiving operation result * @function */ function fromTranslation(out, t) { out[0] = 0; out[1] = 0; out[2] = 0; out[3] = 1; out[4] = t[0] * 0.5; out[5] = t[1] * 0.5; out[6] = t[2] * 0.5; out[7] = 0; return out; } /** * Creates a dual quat from a quaternion * * @param {ReadonlyQuat2} dual quaternion receiving operation result * @param {ReadonlyQuat} q the quaternion * @returns {quat2} dual quaternion receiving operation result * @function */ function fromRotation(out, q) { out[0] = q[0]; out[1] = q[1]; out[2] = q[2]; out[3] = q[3]; out[4] = 0; out[5] = 0; out[6] = 0; out[7] = 0; return out; } /** * Creates a new dual quat from a matrix (4x4) * * @param {quat2} out the dual quaternion * @param {ReadonlyMat4} a the matrix * @returns {quat2} dual quat receiving operation result * @function */ function fromMat4(out, a) { //TODO Optimize this var outer = _quat_js__WEBPACK_IMPORTED_MODULE_1__["create"](); _mat4_js__WEBPACK_IMPORTED_MODULE_2__["getRotation"](outer, a); var t = new _common_js__WEBPACK_IMPORTED_MODULE_0__["ARRAY_TYPE"](3); _mat4_js__WEBPACK_IMPORTED_MODULE_2__["getTranslation"](t, a); fromRotationTranslation(out, outer, t); return out; } /** * Copy the values from one dual quat to another * * @param {quat2} out the receiving dual quaternion * @param {ReadonlyQuat2} a the source dual quaternion * @returns {quat2} out * @function */ function copy(out, a) { out[0] = a[0]; out[1] = a[1]; out[2] = a[2]; out[3] = a[3]; out[4] = a[4]; out[5] = a[5]; out[6] = a[6]; out[7] = a[7]; return out; } /** * Set a dual quat to the identity dual quaternion * * @param {quat2} out the receiving quaternion * @returns {quat2} out */ function identity(out) { out[0] = 0; out[1] = 0; out[2] = 0; out[3] = 1; out[4] = 0; out[5] = 0; out[6] = 0; out[7] = 0; return out; } /** * Set the components of a dual quat to the given values * * @param {quat2} out the receiving quaternion * @param {Number} x1 X component * @param {Number} y1 Y component * @param {Number} z1 Z component * @param {Number} w1 W component * @param {Number} x2 X component * @param {Number} y2 Y component * @param {Number} z2 Z component * @param {Number} w2 W component * @returns {quat2} out * @function */ function set(out, x1, y1, z1, w1, x2, y2, z2, w2) { out[0] = x1; out[1] = y1; out[2] = z1; out[3] = w1; out[4] = x2; out[5] = y2; out[6] = z2; out[7] = w2; return out; } /** * Gets the real part of a dual quat * @param {quat} out real part * @param {ReadonlyQuat2} a Dual Quaternion * @return {quat} real part */ var getReal = _quat_js__WEBPACK_IMPORTED_MODULE_1__["copy"]; /** * Gets the dual part of a dual quat * @param {quat} out dual part * @param {ReadonlyQuat2} a Dual Quaternion * @return {quat} dual part */ function getDual(out, a) { out[0] = a[4]; out[1] = a[5]; out[2] = a[6]; out[3] = a[7]; return out; } /** * Set the real component of a dual quat to the given quaternion * * @param {quat2} out the receiving quaternion * @param {ReadonlyQuat} q a quaternion representing the real part * @returns {quat2} out * @function */ var setReal = _quat_js__WEBPACK_IMPORTED_MODULE_1__["copy"]; /** * Set the dual component of a dual quat to the given quaternion * * @param {quat2} out the receiving quaternion * @param {ReadonlyQuat} q a quaternion representing the dual part * @returns {quat2} out * @function */ function setDual(out, q) { out[4] = q[0]; out[5] = q[1]; out[6] = q[2]; out[7] = q[3]; return out; } /** * Gets the translation of a normalized dual quat * @param {vec3} out translation * @param {ReadonlyQuat2} a Dual Quaternion to be decomposed * @return {vec3} translation */ function getTranslation(out, a) { var ax = a[4], ay = a[5], az = a[6], aw = a[7], bx = -a[0], by = -a[1], bz = -a[2], bw = a[3]; out[0] = (ax * bw + aw * bx + ay * bz - az * by) * 2; out[1] = (ay * bw + aw * by + az * bx - ax * bz) * 2; out[2] = (az * bw + aw * bz + ax * by - ay * bx) * 2; return out; } /** * Translates a dual quat by the given vector * * @param {quat2} out the receiving dual quaternion * @param {ReadonlyQuat2} a the dual quaternion to translate * @param {ReadonlyVec3} v vector to translate by * @returns {quat2} out */ function translate(out, a, v) { var ax1 = a[0], ay1 = a[1], az1 = a[2], aw1 = a[3], bx1 = v[0] * 0.5, by1 = v[1] * 0.5, bz1 = v[2] * 0.5, ax2 = a[4], ay2 = a[5], az2 = a[6], aw2 = a[7]; out[0] = ax1; out[1] = ay1; out[2] = az1; out[3] = aw1; out[4] = aw1 * bx1 + ay1 * bz1 - az1 * by1 + ax2; out[5] = aw1 * by1 + az1 * bx1 - ax1 * bz1 + ay2; out[6] = aw1 * bz1 + ax1 * by1 - ay1 * bx1 + az2; out[7] = -ax1 * bx1 - ay1 * by1 - az1 * bz1 + aw2; return out; } /** * Rotates a dual quat around the X axis * * @param {quat2} out the receiving dual quaternion * @param {ReadonlyQuat2} a the dual quaternion to rotate * @param {number} rad how far should the rotation be * @returns {quat2} out */ function rotateX(out, a, rad) { var bx = -a[0], by = -a[1], bz = -a[2], bw = a[3], ax = a[4], ay = a[5], az = a[6], aw = a[7], ax1 = ax * bw + aw * bx + ay * bz - az * by, ay1 = ay * bw + aw * by + az * bx - ax * bz, az1 = az * bw + aw * bz + ax * by - ay * bx, aw1 = aw * bw - ax * bx - ay * by - az * bz; _quat_js__WEBPACK_IMPORTED_MODULE_1__["rotateX"](out, a, rad); bx = out[0]; by = out[1]; bz = out[2]; bw = out[3]; out[4] = ax1 * bw + aw1 * bx + ay1 * bz - az1 * by; out[5] = ay1 * bw + aw1 * by + az1 * bx - ax1 * bz; out[6] = az1 * bw + aw1 * bz + ax1 * by - ay1 * bx; out[7] = aw1 * bw - ax1 * bx - ay1 * by - az1 * bz; return out; } /** * Rotates a dual quat around the Y axis * * @param {quat2} out the receiving dual quaternion * @param {ReadonlyQuat2} a the dual quaternion to rotate * @param {number} rad how far should the rotation be * @returns {quat2} out */ function rotateY(out, a, rad) { var bx = -a[0], by = -a[1], bz = -a[2], bw = a[3], ax = a[4], ay = a[5], az = a[6], aw = a[7], ax1 = ax * bw + aw * bx + ay * bz - az * by, ay1 = ay * bw + aw * by + az * bx - ax * bz, az1 = az * bw + aw * bz + ax * by - ay * bx, aw1 = aw * bw - ax * bx - ay * by - az * bz; _quat_js__WEBPACK_IMPORTED_MODULE_1__["rotateY"](out, a, rad); bx = out[0]; by = out[1]; bz = out[2]; bw = out[3]; out[4] = ax1 * bw + aw1 * bx + ay1 * bz - az1 * by; out[5] = ay1 * bw + aw1 * by + az1 * bx - ax1 * bz; out[6] = az1 * bw + aw1 * bz + ax1 * by - ay1 * bx; out[7] = aw1 * bw - ax1 * bx - ay1 * by - az1 * bz; return out; } /** * Rotates a dual quat around the Z axis * * @param {quat2} out the receiving dual quaternion * @param {ReadonlyQuat2} a the dual quaternion to rotate * @param {number} rad how far should the rotation be * @returns {quat2} out */ function rotateZ(out, a, rad) { var bx = -a[0], by = -a[1], bz = -a[2], bw = a[3], ax = a[4], ay = a[5], az = a[6], aw = a[7], ax1 = ax * bw + aw * bx + ay * bz - az * by, ay1 = ay * bw + aw * by + az * bx - ax * bz, az1 = az * bw + aw * bz + ax * by - ay * bx, aw1 = aw * bw - ax * bx - ay * by - az * bz; _quat_js__WEBPACK_IMPORTED_MODULE_1__["rotateZ"](out, a, rad); bx = out[0]; by = out[1]; bz = out[2]; bw = out[3]; out[4] = ax1 * bw + aw1 * bx + ay1 * bz - az1 * by; out[5] = ay1 * bw + aw1 * by + az1 * bx - ax1 * bz; out[6] = az1 * bw + aw1 * bz + ax1 * by - ay1 * bx; out[7] = aw1 * bw - ax1 * bx - ay1 * by - az1 * bz; return out; } /** * Rotates a dual quat by a given quaternion (a * q) * * @param {quat2} out the receiving dual quaternion * @param {ReadonlyQuat2} a the dual quaternion to rotate * @param {ReadonlyQuat} q quaternion to rotate by * @returns {quat2} out */ function rotateByQuatAppend(out, a, q) { var qx = q[0], qy = q[1], qz = q[2], qw = q[3], ax = a[0], ay = a[1], az = a[2], aw = a[3]; out[0] = ax * qw + aw * qx + ay * qz - az * qy; out[1] = ay * qw + aw * qy + az * qx - ax * qz; out[2] = az * qw + aw * qz + ax * qy - ay * qx; out[3] = aw * qw - ax * qx - ay * qy - az * qz; ax = a[4]; ay = a[5]; az = a[6]; aw = a[7]; out[4] = ax * qw + aw * qx + ay * qz - az * qy; out[5] = ay * qw + aw * qy + az * qx - ax * qz; out[6] = az * qw + aw * qz + ax * qy - ay * qx; out[7] = aw * qw - ax * qx - ay * qy - az * qz; return out; } /** * Rotates a dual quat by a given quaternion (q * a) * * @param {quat2} out the receiving dual quaternion * @param {ReadonlyQuat} q quaternion to rotate by * @param {ReadonlyQuat2} a the dual quaternion to rotate * @returns {quat2} out */ function rotateByQuatPrepend(out, q, a) { var qx = q[0], qy = q[1], qz = q[2], qw = q[3], bx = a[0], by = a[1], bz = a[2], bw = a[3]; out[0] = qx * bw + qw * bx + qy * bz - qz * by; out[1] = qy * bw + qw * by + qz * bx - qx * bz; out[2] = qz * bw + qw * bz + qx * by - qy * bx; out[3] = qw * bw - qx * bx - qy * by - qz * bz; bx = a[4]; by = a[5]; bz = a[6]; bw = a[7]; out[4] = qx * bw + qw * bx + qy * bz - qz * by; out[5] = qy * bw + qw * by + qz * bx - qx * bz; out[6] = qz * bw + qw * bz + qx * by - qy * bx; out[7] = qw * bw - qx * bx - qy * by - qz * bz; return out; } /** * Rotates a dual quat around a given axis. Does the normalisation automatically * * @param {quat2} out the receiving dual quaternion * @param {ReadonlyQuat2} a the dual quaternion to rotate * @param {ReadonlyVec3} axis the axis to rotate around * @param {Number} rad how far the rotation should be * @returns {quat2} out */ function rotateAroundAxis(out, a, axis, rad) { //Special case for rad = 0 if (Math.abs(rad) < _common_js__WEBPACK_IMPORTED_MODULE_0__["EPSILON"]) { return copy(out, a); } var axisLength = Math.hypot(axis[0], axis[1], axis[2]); rad = rad * 0.5; var s = Math.sin(rad); var bx = s * axis[0] / axisLength; var by = s * axis[1] / axisLength; var bz = s * axis[2] / axisLength; var bw = Math.cos(rad); var ax1 = a[0], ay1 = a[1], az1 = a[2], aw1 = a[3]; out[0] = ax1 * bw + aw1 * bx + ay1 * bz - az1 * by; out[1] = ay1 * bw + aw1 * by + az1 * bx - ax1 * bz; out[2] = az1 * bw + aw1 * bz + ax1 * by - ay1 * bx; out[3] = aw1 * bw - ax1 * bx - ay1 * by - az1 * bz; var ax = a[4], ay = a[5], az = a[6], aw = a[7]; out[4] = ax * bw + aw * bx + ay * bz - az * by; out[5] = ay * bw + aw * by + az * bx - ax * bz; out[6] = az * bw + aw * bz + ax * by - ay * bx; out[7] = aw * bw - ax * bx - ay * by - az * bz; return out; } /** * Adds two dual quat's * * @param {quat2} out the receiving dual quaternion * @param {ReadonlyQuat2} a the first operand * @param {ReadonlyQuat2} b the second operand * @returns {quat2} out * @function */ function add(out, a, b) { out[0] = a[0] + b[0]; out[1] = a[1] + b[1]; out[2] = a[2] + b[2]; out[3] = a[3] + b[3]; out[4] = a[4] + b[4]; out[5] = a[5] + b[5]; out[6] = a[6] + b[6]; out[7] = a[7] + b[7]; return out; } /** * Multiplies two dual quat's * * @param {quat2} out the receiving dual quaternion * @param {ReadonlyQuat2} a the first operand * @param {ReadonlyQuat2} b the second operand * @returns {quat2} out */ function multiply(out, a, b) { var ax0 = a[0], ay0 = a[1], az0 = a[2], aw0 = a[3], bx1 = b[4], by1 = b[5], bz1 = b[6], bw1 = b[7], ax1 = a[4], ay1 = a[5], az1 = a[6], aw1 = a[7], bx0 = b[0], by0 = b[1], bz0 = b[2], bw0 = b[3]; out[0] = ax0 * bw0 + aw0 * bx0 + ay0 * bz0 - az0 * by0; out[1] = ay0 * bw0 + aw0 * by0 + az0 * bx0 - ax0 * bz0; out[2] = az0 * bw0 + aw0 * bz0 + ax0 * by0 - ay0 * bx0; out[3] = aw0 * bw0 - ax0 * bx0 - ay0 * by0 - az0 * bz0; out[4] = ax0 * bw1 + aw0 * bx1 + ay0 * bz1 - az0 * by1 + ax1 * bw0 + aw1 * bx0 + ay1 * bz0 - az1 * by0; out[5] = ay0 * bw1 + aw0 * by1 + az0 * bx1 - ax0 * bz1 + ay1 * bw0 + aw1 * by0 + az1 * bx0 - ax1 * bz0; out[6] = az0 * bw1 + aw0 * bz1 + ax0 * by1 - ay0 * bx1 + az1 * bw0 + aw1 * bz0 + ax1 * by0 - ay1 * bx0; out[7] = aw0 * bw1 - ax0 * bx1 - ay0 * by1 - az0 * bz1 + aw1 * bw0 - ax1 * bx0 - ay1 * by0 - az1 * bz0; return out; } /** * Alias for {@link quat2.multiply} * @function */ var mul = multiply; /** * Scales a dual quat by a scalar number * * @param {quat2} out the receiving dual quat * @param {ReadonlyQuat2} a the dual quat to scale * @param {Number} b amount to scale the dual quat by * @returns {quat2} out * @function */ function scale(out, a, b) { out[0] = a[0] * b; out[1] = a[1] * b; out[2] = a[2] * b; out[3] = a[3] * b; out[4] = a[4] * b; out[5] = a[5] * b; out[6] = a[6] * b; out[7] = a[7] * b; return out; } /** * Calculates the dot product of two dual quat's (The dot product of the real parts) * * @param {ReadonlyQuat2} a the first operand * @param {ReadonlyQuat2} b the second operand * @returns {Number} dot product of a and b * @function */ var dot = _quat_js__WEBPACK_IMPORTED_MODULE_1__["dot"]; /** * Performs a linear interpolation between two dual quats's * NOTE: The resulting dual quaternions won't always be normalized (The error is most noticeable when t = 0.5) * * @param {quat2} out the receiving dual quat * @param {ReadonlyQuat2} a the first operand * @param {ReadonlyQuat2} b the second operand * @param {Number} t interpolation amount, in the range [0-1], between the two inputs * @returns {quat2} out */ function lerp(out, a, b, t) { var mt = 1 - t; if (dot(a, b) < 0) t = -t; out[0] = a[0] * mt + b[0] * t; out[1] = a[1] * mt + b[1] * t; out[2] = a[2] * mt + b[2] * t; out[3] = a[3] * mt + b[3] * t; out[4] = a[4] * mt + b[4] * t; out[5] = a[5] * mt + b[5] * t; out[6] = a[6] * mt + b[6] * t; out[7] = a[7] * mt + b[7] * t; return out; } /** * Calculates the inverse of a dual quat. If they are normalized, conjugate is cheaper * * @param {quat2} out the receiving dual quaternion * @param {ReadonlyQuat2} a dual quat to calculate inverse of * @returns {quat2} out */ function invert(out, a) { var sqlen = squaredLength(a); out[0] = -a[0] / sqlen; out[1] = -a[1] / sqlen; out[2] = -a[2] / sqlen; out[3] = a[3] / sqlen; out[4] = -a[4] / sqlen; out[5] = -a[5] / sqlen; out[6] = -a[6] / sqlen; out[7] = a[7] / sqlen; return out; } /** * Calculates the conjugate of a dual quat * If the dual quaternion is normalized, this function is faster than quat2.inverse and produces the same result. * * @param {quat2} out the receiving quaternion * @param {ReadonlyQuat2} a quat to calculate conjugate of * @returns {quat2} out */ function conjugate(out, a) { out[0] = -a[0]; out[1] = -a[1]; out[2] = -a[2]; out[3] = a[3]; out[4] = -a[4]; out[5] = -a[5]; out[6] = -a[6]; out[7] = a[7]; return out; } /** * Calculates the length of a dual quat * * @param {ReadonlyQuat2} a dual quat to calculate length of * @returns {Number} length of a * @function */ var length = _quat_js__WEBPACK_IMPORTED_MODULE_1__["length"]; /** * Alias for {@link quat2.length} * @function */ var len = length; /** * Calculates the squared length of a dual quat * * @param {ReadonlyQuat2} a dual quat to calculate squared length of * @returns {Number} squared length of a * @function */ var squaredLength = _quat_js__WEBPACK_IMPORTED_MODULE_1__["squaredLength"]; /** * Alias for {@link quat2.squaredLength} * @function */ var sqrLen = squaredLength; /** * Normalize a dual quat * * @param {quat2} out the receiving dual quaternion * @param {ReadonlyQuat2} a dual quaternion to normalize * @returns {quat2} out * @function */ function normalize(out, a) { var magnitude = squaredLength(a); if (magnitude > 0) { magnitude = Math.sqrt(magnitude); var a0 = a[0] / magnitude; var a1 = a[1] / magnitude; var a2 = a[2] / magnitude; var a3 = a[3] / magnitude; var b0 = a[4]; var b1 = a[5]; var b2 = a[6]; var b3 = a[7]; var a_dot_b = a0 * b0 + a1 * b1 + a2 * b2 + a3 * b3; out[0] = a0; out[1] = a1; out[2] = a2; out[3] = a3; out[4] = (b0 - a0 * a_dot_b) / magnitude; out[5] = (b1 - a1 * a_dot_b) / magnitude; out[6] = (b2 - a2 * a_dot_b) / magnitude; out[7] = (b3 - a3 * a_dot_b) / magnitude; } return out; } /** * Returns a string representation of a dual quatenion * * @param {ReadonlyQuat2} a dual quaternion to represent as a string * @returns {String} string representation of the dual quat */ function str(a) { return "quat2(" + a[0] + ", " + a[1] + ", " + a[2] + ", " + a[3] + ", " + a[4] + ", " + a[5] + ", " + a[6] + ", " + a[7] + ")"; } /** * Returns whether or not the dual quaternions have exactly the same elements in the same position (when compared with ===) * * @param {ReadonlyQuat2} a the first dual quaternion. * @param {ReadonlyQuat2} b the second dual quaternion. * @returns {Boolean} true if the dual quaternions are equal, false otherwise. */ function exactEquals(a, b) { return a[0] === b[0] && a[1] === b[1] && a[2] === b[2] && a[3] === b[3] && a[4] === b[4] && a[5] === b[5] && a[6] === b[6] && a[7] === b[7]; } /** * Returns whether or not the dual quaternions have approximately the same elements in the same position. * * @param {ReadonlyQuat2} a the first dual quat. * @param {ReadonlyQuat2} b the second dual quat. * @returns {Boolean} true if the dual quats are equal, false otherwise. */ function equals(a, b) { var a0 = a[0], a1 = a[1], a2 = a[2], a3 = a[3], a4 = a[4], a5 = a[5], a6 = a[6], a7 = a[7]; var b0 = b[0], b1 = b[1], b2 = b[2], b3 = b[3], b4 = b[4], b5 = b[5], b6 = b[6], b7 = b[7]; return Math.abs(a0 - b0) <= _common_js__WEBPACK_IMPORTED_MODULE_0__["EPSILON"] * Math.max(1.0, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= _common_js__WEBPACK_IMPORTED_MODULE_0__["EPSILON"] * Math.max(1.0, Math.abs(a1), Math.abs(b1)) && Math.abs(a2 - b2) <= _common_js__WEBPACK_IMPORTED_MODULE_0__["EPSILON"] * Math.max(1.0, Math.abs(a2), Math.abs(b2)) && Math.abs(a3 - b3) <= _common_js__WEBPACK_IMPORTED_MODULE_0__["EPSILON"] * Math.max(1.0, Math.abs(a3), Math.abs(b3)) && Math.abs(a4 - b4) <= _common_js__WEBPACK_IMPORTED_MODULE_0__["EPSILON"] * Math.max(1.0, Math.abs(a4), Math.abs(b4)) && Math.abs(a5 - b5) <= _common_js__WEBPACK_IMPORTED_MODULE_0__["EPSILON"] * Math.max(1.0, Math.abs(a5), Math.abs(b5)) && Math.abs(a6 - b6) <= _common_js__WEBPACK_IMPORTED_MODULE_0__["EPSILON"] * Math.max(1.0, Math.abs(a6), Math.abs(b6)) && Math.abs(a7 - b7) <= _common_js__WEBPACK_IMPORTED_MODULE_0__["EPSILON"] * Math.max(1.0, Math.abs(a7), Math.abs(b7)); } /***/ }), /***/ "./node_modules/_gl-matrix@3.3.0@gl-matrix/esm/vec2.js": /*!*************************************************************!*\ !*** ./node_modules/_gl-matrix@3.3.0@gl-matrix/esm/vec2.js ***! \*************************************************************/ /*! exports provided: create, clone, fromValues, copy, set, add, subtract, multiply, divide, ceil, floor, min, max, round, scale, scaleAndAdd, distance, squaredDistance, length, squaredLength, negate, inverse, normalize, dot, cross, lerp, random, transformMat2, transformMat2d, transformMat3, transformMat4, rotate, angle, zero, str, exactEquals, equals, len, sub, mul, div, dist, sqrDist, sqrLen, forEach */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "create", function() { return create; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "clone", function() { return clone; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "fromValues", function() { return fromValues; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "copy", function() { return copy; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "set", function() { return set; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "add", function() { return add; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "subtract", function() { return subtract; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "multiply", function() { return multiply; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "divide", function() { return divide; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ceil", function() { return ceil; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "floor", function() { return floor; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "min", function() { return min; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "max", function() { return max; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "round", function() { return round; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "scale", function() { return scale; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "scaleAndAdd", function() { return scaleAndAdd; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "distance", function() { return distance; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "squaredDistance", function() { return squaredDistance; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "length", function() { return length; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "squaredLength", function() { return squaredLength; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "negate", function() { return negate; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "inverse", function() { return inverse; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "normalize", function() { return normalize; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "dot", function() { return dot; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "cross", function() { return cross; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "lerp", function() { return lerp; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "random", function() { return random; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "transformMat2", function() { return transformMat2; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "transformMat2d", function() { return transformMat2d; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "transformMat3", function() { return transformMat3; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "transformMat4", function() { return transformMat4; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "rotate", function() { return rotate; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "angle", function() { return angle; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "zero", function() { return zero; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "str", function() { return str; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "exactEquals", function() { return exactEquals; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "equals", function() { return equals; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "len", function() { return len; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "sub", function() { return sub; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "mul", function() { return mul; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "div", function() { return div; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "dist", function() { return dist; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "sqrDist", function() { return sqrDist; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "sqrLen", function() { return sqrLen; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "forEach", function() { return forEach; }); /* harmony import */ var _common_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./common.js */ "./node_modules/_gl-matrix@3.3.0@gl-matrix/esm/common.js"); /** * 2 Dimensional Vector * @module vec2 */ /** * Creates a new, empty vec2 * * @returns {vec2} a new 2D vector */ function create() { var out = new _common_js__WEBPACK_IMPORTED_MODULE_0__["ARRAY_TYPE"](2); if (_common_js__WEBPACK_IMPORTED_MODULE_0__["ARRAY_TYPE"] != Float32Array) { out[0] = 0; out[1] = 0; } return out; } /** * Creates a new vec2 initialized with values from an existing vector * * @param {ReadonlyVec2} a vector to clone * @returns {vec2} a new 2D vector */ function clone(a) { var out = new _common_js__WEBPACK_IMPORTED_MODULE_0__["ARRAY_TYPE"](2); out[0] = a[0]; out[1] = a[1]; return out; } /** * Creates a new vec2 initialized with the given values * * @param {Number} x X component * @param {Number} y Y component * @returns {vec2} a new 2D vector */ function fromValues(x, y) { var out = new _common_js__WEBPACK_IMPORTED_MODULE_0__["ARRAY_TYPE"](2); out[0] = x; out[1] = y; return out; } /** * Copy the values from one vec2 to another * * @param {vec2} out the receiving vector * @param {ReadonlyVec2} a the source vector * @returns {vec2} out */ function copy(out, a) { out[0] = a[0]; out[1] = a[1]; return out; } /** * Set the components of a vec2 to the given values * * @param {vec2} out the receiving vector * @param {Number} x X component * @param {Number} y Y component * @returns {vec2} out */ function set(out, x, y) { out[0] = x; out[1] = y; return out; } /** * Adds two vec2's * * @param {vec2} out the receiving vector * @param {ReadonlyVec2} a the first operand * @param {ReadonlyVec2} b the second operand * @returns {vec2} out */ function add(out, a, b) { out[0] = a[0] + b[0]; out[1] = a[1] + b[1]; return out; } /** * Subtracts vector b from vector a * * @param {vec2} out the receiving vector * @param {ReadonlyVec2} a the first operand * @param {ReadonlyVec2} b the second operand * @returns {vec2} out */ function subtract(out, a, b) { out[0] = a[0] - b[0]; out[1] = a[1] - b[1]; return out; } /** * Multiplies two vec2's * * @param {vec2} out the receiving vector * @param {ReadonlyVec2} a the first operand * @param {ReadonlyVec2} b the second operand * @returns {vec2} out */ function multiply(out, a, b) { out[0] = a[0] * b[0]; out[1] = a[1] * b[1]; return out; } /** * Divides two vec2's * * @param {vec2} out the receiving vector * @param {ReadonlyVec2} a the first operand * @param {ReadonlyVec2} b the second operand * @returns {vec2} out */ function divide(out, a, b) { out[0] = a[0] / b[0]; out[1] = a[1] / b[1]; return out; } /** * Math.ceil the components of a vec2 * * @param {vec2} out the receiving vector * @param {ReadonlyVec2} a vector to ceil * @returns {vec2} out */ function ceil(out, a) { out[0] = Math.ceil(a[0]); out[1] = Math.ceil(a[1]); return out; } /** * Math.floor the components of a vec2 * * @param {vec2} out the receiving vector * @param {ReadonlyVec2} a vector to floor * @returns {vec2} out */ function floor(out, a) { out[0] = Math.floor(a[0]); out[1] = Math.floor(a[1]); return out; } /** * Returns the minimum of two vec2's * * @param {vec2} out the receiving vector * @param {ReadonlyVec2} a the first operand * @param {ReadonlyVec2} b the second operand * @returns {vec2} out */ function min(out, a, b) { out[0] = Math.min(a[0], b[0]); out[1] = Math.min(a[1], b[1]); return out; } /** * Returns the maximum of two vec2's * * @param {vec2} out the receiving vector * @param {ReadonlyVec2} a the first operand * @param {ReadonlyVec2} b the second operand * @returns {vec2} out */ function max(out, a, b) { out[0] = Math.max(a[0], b[0]); out[1] = Math.max(a[1], b[1]); return out; } /** * Math.round the components of a vec2 * * @param {vec2} out the receiving vector * @param {ReadonlyVec2} a vector to round * @returns {vec2} out */ function round(out, a) { out[0] = Math.round(a[0]); out[1] = Math.round(a[1]); return out; } /** * Scales a vec2 by a scalar number * * @param {vec2} out the receiving vector * @param {ReadonlyVec2} a the vector to scale * @param {Number} b amount to scale the vector by * @returns {vec2} out */ function scale(out, a, b) { out[0] = a[0] * b; out[1] = a[1] * b; return out; } /** * Adds two vec2's after scaling the second operand by a scalar value * * @param {vec2} out the receiving vector * @param {ReadonlyVec2} a the first operand * @param {ReadonlyVec2} b the second operand * @param {Number} scale the amount to scale b by before adding * @returns {vec2} out */ function scaleAndAdd(out, a, b, scale) { out[0] = a[0] + b[0] * scale; out[1] = a[1] + b[1] * scale; return out; } /** * Calculates the euclidian distance between two vec2's * * @param {ReadonlyVec2} a the first operand * @param {ReadonlyVec2} b the second operand * @returns {Number} distance between a and b */ function distance(a, b) { var x = b[0] - a[0], y = b[1] - a[1]; return Math.hypot(x, y); } /** * Calculates the squared euclidian distance between two vec2's * * @param {ReadonlyVec2} a the first operand * @param {ReadonlyVec2} b the second operand * @returns {Number} squared distance between a and b */ function squaredDistance(a, b) { var x = b[0] - a[0], y = b[1] - a[1]; return x * x + y * y; } /** * Calculates the length of a vec2 * * @param {ReadonlyVec2} a vector to calculate length of * @returns {Number} length of a */ function length(a) { var x = a[0], y = a[1]; return Math.hypot(x, y); } /** * Calculates the squared length of a vec2 * * @param {ReadonlyVec2} a vector to calculate squared length of * @returns {Number} squared length of a */ function squaredLength(a) { var x = a[0], y = a[1]; return x * x + y * y; } /** * Negates the components of a vec2 * * @param {vec2} out the receiving vector * @param {ReadonlyVec2} a vector to negate * @returns {vec2} out */ function negate(out, a) { out[0] = -a[0]; out[1] = -a[1]; return out; } /** * Returns the inverse of the components of a vec2 * * @param {vec2} out the receiving vector * @param {ReadonlyVec2} a vector to invert * @returns {vec2} out */ function inverse(out, a) { out[0] = 1.0 / a[0]; out[1] = 1.0 / a[1]; return out; } /** * Normalize a vec2 * * @param {vec2} out the receiving vector * @param {ReadonlyVec2} a vector to normalize * @returns {vec2} out */ function normalize(out, a) { var x = a[0], y = a[1]; var len = x * x + y * y; if (len > 0) { //TODO: evaluate use of glm_invsqrt here? len = 1 / Math.sqrt(len); } out[0] = a[0] * len; out[1] = a[1] * len; return out; } /** * Calculates the dot product of two vec2's * * @param {ReadonlyVec2} a the first operand * @param {ReadonlyVec2} b the second operand * @returns {Number} dot product of a and b */ function dot(a, b) { return a[0] * b[0] + a[1] * b[1]; } /** * Computes the cross product of two vec2's * Note that the cross product must by definition produce a 3D vector * * @param {vec3} out the receiving vector * @param {ReadonlyVec2} a the first operand * @param {ReadonlyVec2} b the second operand * @returns {vec3} out */ function cross(out, a, b) { var z = a[0] * b[1] - a[1] * b[0]; out[0] = out[1] = 0; out[2] = z; return out; } /** * Performs a linear interpolation between two vec2's * * @param {vec2} out the receiving vector * @param {ReadonlyVec2} a the first operand * @param {ReadonlyVec2} b the second operand * @param {Number} t interpolation amount, in the range [0-1], between the two inputs * @returns {vec2} out */ function lerp(out, a, b, t) { var ax = a[0], ay = a[1]; out[0] = ax + t * (b[0] - ax); out[1] = ay + t * (b[1] - ay); return out; } /** * Generates a random vector with the given scale * * @param {vec2} out the receiving vector * @param {Number} [scale] Length of the resulting vector. If ommitted, a unit vector will be returned * @returns {vec2} out */ function random(out, scale) { scale = scale || 1.0; var r = _common_js__WEBPACK_IMPORTED_MODULE_0__["RANDOM"]() * 2.0 * Math.PI; out[0] = Math.cos(r) * scale; out[1] = Math.sin(r) * scale; return out; } /** * Transforms the vec2 with a mat2 * * @param {vec2} out the receiving vector * @param {ReadonlyVec2} a the vector to transform * @param {ReadonlyMat2} m matrix to transform with * @returns {vec2} out */ function transformMat2(out, a, m) { var x = a[0], y = a[1]; out[0] = m[0] * x + m[2] * y; out[1] = m[1] * x + m[3] * y; return out; } /** * Transforms the vec2 with a mat2d * * @param {vec2} out the receiving vector * @param {ReadonlyVec2} a the vector to transform * @param {ReadonlyMat2d} m matrix to transform with * @returns {vec2} out */ function transformMat2d(out, a, m) { var x = a[0], y = a[1]; out[0] = m[0] * x + m[2] * y + m[4]; out[1] = m[1] * x + m[3] * y + m[5]; return out; } /** * Transforms the vec2 with a mat3 * 3rd vector component is implicitly '1' * * @param {vec2} out the receiving vector * @param {ReadonlyVec2} a the vector to transform * @param {ReadonlyMat3} m matrix to transform with * @returns {vec2} out */ function transformMat3(out, a, m) { var x = a[0], y = a[1]; out[0] = m[0] * x + m[3] * y + m[6]; out[1] = m[1] * x + m[4] * y + m[7]; return out; } /** * Transforms the vec2 with a mat4 * 3rd vector component is implicitly '0' * 4th vector component is implicitly '1' * * @param {vec2} out the receiving vector * @param {ReadonlyVec2} a the vector to transform * @param {ReadonlyMat4} m matrix to transform with * @returns {vec2} out */ function transformMat4(out, a, m) { var x = a[0]; var y = a[1]; out[0] = m[0] * x + m[4] * y + m[12]; out[1] = m[1] * x + m[5] * y + m[13]; return out; } /** * Rotate a 2D vector * @param {vec2} out The receiving vec2 * @param {ReadonlyVec2} a The vec2 point to rotate * @param {ReadonlyVec2} b The origin of the rotation * @param {Number} rad The angle of rotation in radians * @returns {vec2} out */ function rotate(out, a, b, rad) { //Translate point to the origin var p0 = a[0] - b[0], p1 = a[1] - b[1], sinC = Math.sin(rad), cosC = Math.cos(rad); //perform rotation and translate to correct position out[0] = p0 * cosC - p1 * sinC + b[0]; out[1] = p0 * sinC + p1 * cosC + b[1]; return out; } /** * Get the angle between two 2D vectors * @param {ReadonlyVec2} a The first operand * @param {ReadonlyVec2} b The second operand * @returns {Number} The angle in radians */ function angle(a, b) { var x1 = a[0], y1 = a[1], x2 = b[0], y2 = b[1], // mag is the product of the magnitudes of a and b mag = Math.sqrt(x1 * x1 + y1 * y1) * Math.sqrt(x2 * x2 + y2 * y2), // mag &&.. short circuits if mag == 0 cosine = mag && (x1 * x2 + y1 * y2) / mag; // Math.min(Math.max(cosine, -1), 1) clamps the cosine between -1 and 1 return Math.acos(Math.min(Math.max(cosine, -1), 1)); } /** * Set the components of a vec2 to zero * * @param {vec2} out the receiving vector * @returns {vec2} out */ function zero(out) { out[0] = 0.0; out[1] = 0.0; return out; } /** * Returns a string representation of a vector * * @param {ReadonlyVec2} a vector to represent as a string * @returns {String} string representation of the vector */ function str(a) { return "vec2(" + a[0] + ", " + a[1] + ")"; } /** * Returns whether or not the vectors exactly have the same elements in the same position (when compared with ===) * * @param {ReadonlyVec2} a The first vector. * @param {ReadonlyVec2} b The second vector. * @returns {Boolean} True if the vectors are equal, false otherwise. */ function exactEquals(a, b) { return a[0] === b[0] && a[1] === b[1]; } /** * Returns whether or not the vectors have approximately the same elements in the same position. * * @param {ReadonlyVec2} a The first vector. * @param {ReadonlyVec2} b The second vector. * @returns {Boolean} True if the vectors are equal, false otherwise. */ function equals(a, b) { var a0 = a[0], a1 = a[1]; var b0 = b[0], b1 = b[1]; return Math.abs(a0 - b0) <= _common_js__WEBPACK_IMPORTED_MODULE_0__["EPSILON"] * Math.max(1.0, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= _common_js__WEBPACK_IMPORTED_MODULE_0__["EPSILON"] * Math.max(1.0, Math.abs(a1), Math.abs(b1)); } /** * Alias for {@link vec2.length} * @function */ var len = length; /** * Alias for {@link vec2.subtract} * @function */ var sub = subtract; /** * Alias for {@link vec2.multiply} * @function */ var mul = multiply; /** * Alias for {@link vec2.divide} * @function */ var div = divide; /** * Alias for {@link vec2.distance} * @function */ var dist = distance; /** * Alias for {@link vec2.squaredDistance} * @function */ var sqrDist = squaredDistance; /** * Alias for {@link vec2.squaredLength} * @function */ var sqrLen = squaredLength; /** * Perform some operation over an array of vec2s. * * @param {Array} a the array of vectors to iterate over * @param {Number} stride Number of elements between the start of each vec2. If 0 assumes tightly packed * @param {Number} offset Number of elements to skip at the beginning of the array * @param {Number} count Number of vec2s to iterate over. If 0 iterates over entire array * @param {Function} fn Function to call for each vector in the array * @param {Object} [arg] additional argument to pass to fn * @returns {Array} a * @function */ var forEach = function () { var vec = create(); return function (a, stride, offset, count, fn, arg) { var i, l; if (!stride) { stride = 2; } if (!offset) { offset = 0; } if (count) { l = Math.min(count * stride + offset, a.length); } else { l = a.length; } for (i = offset; i < l; i += stride) { vec[0] = a[i]; vec[1] = a[i + 1]; fn(vec, vec, arg); a[i] = vec[0]; a[i + 1] = vec[1]; } return a; }; }(); /***/ }), /***/ "./node_modules/_gl-matrix@3.3.0@gl-matrix/esm/vec3.js": /*!*************************************************************!*\ !*** ./node_modules/_gl-matrix@3.3.0@gl-matrix/esm/vec3.js ***! \*************************************************************/ /*! exports provided: create, clone, length, fromValues, copy, set, add, subtract, multiply, divide, ceil, floor, min, max, round, scale, scaleAndAdd, distance, squaredDistance, squaredLength, negate, inverse, normalize, dot, cross, lerp, hermite, bezier, random, transformMat4, transformMat3, transformQuat, rotateX, rotateY, rotateZ, angle, zero, str, exactEquals, equals, sub, mul, div, dist, sqrDist, len, sqrLen, forEach */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "create", function() { return create; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "clone", function() { return clone; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "length", function() { return length; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "fromValues", function() { return fromValues; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "copy", function() { return copy; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "set", function() { return set; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "add", function() { return add; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "subtract", function() { return subtract; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "multiply", function() { return multiply; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "divide", function() { return divide; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ceil", function() { return ceil; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "floor", function() { return floor; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "min", function() { return min; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "max", function() { return max; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "round", function() { return round; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "scale", function() { return scale; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "scaleAndAdd", function() { return scaleAndAdd; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "distance", function() { return distance; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "squaredDistance", function() { return squaredDistance; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "squaredLength", function() { return squaredLength; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "negate", function() { return negate; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "inverse", function() { return inverse; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "normalize", function() { return normalize; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "dot", function() { return dot; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "cross", function() { return cross; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "lerp", function() { return lerp; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "hermite", function() { return hermite; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "bezier", function() { return bezier; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "random", function() { return random; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "transformMat4", function() { return transformMat4; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "transformMat3", function() { return transformMat3; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "transformQuat", function() { return transformQuat; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "rotateX", function() { return rotateX; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "rotateY", function() { return rotateY; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "rotateZ", function() { return rotateZ; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "angle", function() { return angle; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "zero", function() { return zero; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "str", function() { return str; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "exactEquals", function() { return exactEquals; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "equals", function() { return equals; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "sub", function() { return sub; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "mul", function() { return mul; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "div", function() { return div; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "dist", function() { return dist; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "sqrDist", function() { return sqrDist; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "len", function() { return len; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "sqrLen", function() { return sqrLen; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "forEach", function() { return forEach; }); /* harmony import */ var _common_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./common.js */ "./node_modules/_gl-matrix@3.3.0@gl-matrix/esm/common.js"); /** * 3 Dimensional Vector * @module vec3 */ /** * Creates a new, empty vec3 * * @returns {vec3} a new 3D vector */ function create() { var out = new _common_js__WEBPACK_IMPORTED_MODULE_0__["ARRAY_TYPE"](3); if (_common_js__WEBPACK_IMPORTED_MODULE_0__["ARRAY_TYPE"] != Float32Array) { out[0] = 0; out[1] = 0; out[2] = 0; } return out; } /** * Creates a new vec3 initialized with values from an existing vector * * @param {ReadonlyVec3} a vector to clone * @returns {vec3} a new 3D vector */ function clone(a) { var out = new _common_js__WEBPACK_IMPORTED_MODULE_0__["ARRAY_TYPE"](3); out[0] = a[0]; out[1] = a[1]; out[2] = a[2]; return out; } /** * Calculates the length of a vec3 * * @param {ReadonlyVec3} a vector to calculate length of * @returns {Number} length of a */ function length(a) { var x = a[0]; var y = a[1]; var z = a[2]; return Math.hypot(x, y, z); } /** * Creates a new vec3 initialized with the given values * * @param {Number} x X component * @param {Number} y Y component * @param {Number} z Z component * @returns {vec3} a new 3D vector */ function fromValues(x, y, z) { var out = new _common_js__WEBPACK_IMPORTED_MODULE_0__["ARRAY_TYPE"](3); out[0] = x; out[1] = y; out[2] = z; return out; } /** * Copy the values from one vec3 to another * * @param {vec3} out the receiving vector * @param {ReadonlyVec3} a the source vector * @returns {vec3} out */ function copy(out, a) { out[0] = a[0]; out[1] = a[1]; out[2] = a[2]; return out; } /** * Set the components of a vec3 to the given values * * @param {vec3} out the receiving vector * @param {Number} x X component * @param {Number} y Y component * @param {Number} z Z component * @returns {vec3} out */ function set(out, x, y, z) { out[0] = x; out[1] = y; out[2] = z; return out; } /** * Adds two vec3's * * @param {vec3} out the receiving vector * @param {ReadonlyVec3} a the first operand * @param {ReadonlyVec3} b the second operand * @returns {vec3} out */ function add(out, a, b) { out[0] = a[0] + b[0]; out[1] = a[1] + b[1]; out[2] = a[2] + b[2]; return out; } /** * Subtracts vector b from vector a * * @param {vec3} out the receiving vector * @param {ReadonlyVec3} a the first operand * @param {ReadonlyVec3} b the second operand * @returns {vec3} out */ function subtract(out, a, b) { out[0] = a[0] - b[0]; out[1] = a[1] - b[1]; out[2] = a[2] - b[2]; return out; } /** * Multiplies two vec3's * * @param {vec3} out the receiving vector * @param {ReadonlyVec3} a the first operand * @param {ReadonlyVec3} b the second operand * @returns {vec3} out */ function multiply(out, a, b) { out[0] = a[0] * b[0]; out[1] = a[1] * b[1]; out[2] = a[2] * b[2]; return out; } /** * Divides two vec3's * * @param {vec3} out the receiving vector * @param {ReadonlyVec3} a the first operand * @param {ReadonlyVec3} b the second operand * @returns {vec3} out */ function divide(out, a, b) { out[0] = a[0] / b[0]; out[1] = a[1] / b[1]; out[2] = a[2] / b[2]; return out; } /** * Math.ceil the components of a vec3 * * @param {vec3} out the receiving vector * @param {ReadonlyVec3} a vector to ceil * @returns {vec3} out */ function ceil(out, a) { out[0] = Math.ceil(a[0]); out[1] = Math.ceil(a[1]); out[2] = Math.ceil(a[2]); return out; } /** * Math.floor the components of a vec3 * * @param {vec3} out the receiving vector * @param {ReadonlyVec3} a vector to floor * @returns {vec3} out */ function floor(out, a) { out[0] = Math.floor(a[0]); out[1] = Math.floor(a[1]); out[2] = Math.floor(a[2]); return out; } /** * Returns the minimum of two vec3's * * @param {vec3} out the receiving vector * @param {ReadonlyVec3} a the first operand * @param {ReadonlyVec3} b the second operand * @returns {vec3} out */ function min(out, a, b) { out[0] = Math.min(a[0], b[0]); out[1] = Math.min(a[1], b[1]); out[2] = Math.min(a[2], b[2]); return out; } /** * Returns the maximum of two vec3's * * @param {vec3} out the receiving vector * @param {ReadonlyVec3} a the first operand * @param {ReadonlyVec3} b the second operand * @returns {vec3} out */ function max(out, a, b) { out[0] = Math.max(a[0], b[0]); out[1] = Math.max(a[1], b[1]); out[2] = Math.max(a[2], b[2]); return out; } /** * Math.round the components of a vec3 * * @param {vec3} out the receiving vector * @param {ReadonlyVec3} a vector to round * @returns {vec3} out */ function round(out, a) { out[0] = Math.round(a[0]); out[1] = Math.round(a[1]); out[2] = Math.round(a[2]); return out; } /** * Scales a vec3 by a scalar number * * @param {vec3} out the receiving vector * @param {ReadonlyVec3} a the vector to scale * @param {Number} b amount to scale the vector by * @returns {vec3} out */ function scale(out, a, b) { out[0] = a[0] * b; out[1] = a[1] * b; out[2] = a[2] * b; return out; } /** * Adds two vec3's after scaling the second operand by a scalar value * * @param {vec3} out the receiving vector * @param {ReadonlyVec3} a the first operand * @param {ReadonlyVec3} b the second operand * @param {Number} scale the amount to scale b by before adding * @returns {vec3} out */ function scaleAndAdd(out, a, b, scale) { out[0] = a[0] + b[0] * scale; out[1] = a[1] + b[1] * scale; out[2] = a[2] + b[2] * scale; return out; } /** * Calculates the euclidian distance between two vec3's * * @param {ReadonlyVec3} a the first operand * @param {ReadonlyVec3} b the second operand * @returns {Number} distance between a and b */ function distance(a, b) { var x = b[0] - a[0]; var y = b[1] - a[1]; var z = b[2] - a[2]; return Math.hypot(x, y, z); } /** * Calculates the squared euclidian distance between two vec3's * * @param {ReadonlyVec3} a the first operand * @param {ReadonlyVec3} b the second operand * @returns {Number} squared distance between a and b */ function squaredDistance(a, b) { var x = b[0] - a[0]; var y = b[1] - a[1]; var z = b[2] - a[2]; return x * x + y * y + z * z; } /** * Calculates the squared length of a vec3 * * @param {ReadonlyVec3} a vector to calculate squared length of * @returns {Number} squared length of a */ function squaredLength(a) { var x = a[0]; var y = a[1]; var z = a[2]; return x * x + y * y + z * z; } /** * Negates the components of a vec3 * * @param {vec3} out the receiving vector * @param {ReadonlyVec3} a vector to negate * @returns {vec3} out */ function negate(out, a) { out[0] = -a[0]; out[1] = -a[1]; out[2] = -a[2]; return out; } /** * Returns the inverse of the components of a vec3 * * @param {vec3} out the receiving vector * @param {ReadonlyVec3} a vector to invert * @returns {vec3} out */ function inverse(out, a) { out[0] = 1.0 / a[0]; out[1] = 1.0 / a[1]; out[2] = 1.0 / a[2]; return out; } /** * Normalize a vec3 * * @param {vec3} out the receiving vector * @param {ReadonlyVec3} a vector to normalize * @returns {vec3} out */ function normalize(out, a) { var x = a[0]; var y = a[1]; var z = a[2]; var len = x * x + y * y + z * z; if (len > 0) { //TODO: evaluate use of glm_invsqrt here? len = 1 / Math.sqrt(len); } out[0] = a[0] * len; out[1] = a[1] * len; out[2] = a[2] * len; return out; } /** * Calculates the dot product of two vec3's * * @param {ReadonlyVec3} a the first operand * @param {ReadonlyVec3} b the second operand * @returns {Number} dot product of a and b */ function dot(a, b) { return a[0] * b[0] + a[1] * b[1] + a[2] * b[2]; } /** * Computes the cross product of two vec3's * * @param {vec3} out the receiving vector * @param {ReadonlyVec3} a the first operand * @param {ReadonlyVec3} b the second operand * @returns {vec3} out */ function cross(out, a, b) { var ax = a[0], ay = a[1], az = a[2]; var bx = b[0], by = b[1], bz = b[2]; out[0] = ay * bz - az * by; out[1] = az * bx - ax * bz; out[2] = ax * by - ay * bx; return out; } /** * Performs a linear interpolation between two vec3's * * @param {vec3} out the receiving vector * @param {ReadonlyVec3} a the first operand * @param {ReadonlyVec3} b the second operand * @param {Number} t interpolation amount, in the range [0-1], between the two inputs * @returns {vec3} out */ function lerp(out, a, b, t) { var ax = a[0]; var ay = a[1]; var az = a[2]; out[0] = ax + t * (b[0] - ax); out[1] = ay + t * (b[1] - ay); out[2] = az + t * (b[2] - az); return out; } /** * Performs a hermite interpolation with two control points * * @param {vec3} out the receiving vector * @param {ReadonlyVec3} a the first operand * @param {ReadonlyVec3} b the second operand * @param {ReadonlyVec3} c the third operand * @param {ReadonlyVec3} d the fourth operand * @param {Number} t interpolation amount, in the range [0-1], between the two inputs * @returns {vec3} out */ function hermite(out, a, b, c, d, t) { var factorTimes2 = t * t; var factor1 = factorTimes2 * (2 * t - 3) + 1; var factor2 = factorTimes2 * (t - 2) + t; var factor3 = factorTimes2 * (t - 1); var factor4 = factorTimes2 * (3 - 2 * t); out[0] = a[0] * factor1 + b[0] * factor2 + c[0] * factor3 + d[0] * factor4; out[1] = a[1] * factor1 + b[1] * factor2 + c[1] * factor3 + d[1] * factor4; out[2] = a[2] * factor1 + b[2] * factor2 + c[2] * factor3 + d[2] * factor4; return out; } /** * Performs a bezier interpolation with two control points * * @param {vec3} out the receiving vector * @param {ReadonlyVec3} a the first operand * @param {ReadonlyVec3} b the second operand * @param {ReadonlyVec3} c the third operand * @param {ReadonlyVec3} d the fourth operand * @param {Number} t interpolation amount, in the range [0-1], between the two inputs * @returns {vec3} out */ function bezier(out, a, b, c, d, t) { var inverseFactor = 1 - t; var inverseFactorTimesTwo = inverseFactor * inverseFactor; var factorTimes2 = t * t; var factor1 = inverseFactorTimesTwo * inverseFactor; var factor2 = 3 * t * inverseFactorTimesTwo; var factor3 = 3 * factorTimes2 * inverseFactor; var factor4 = factorTimes2 * t; out[0] = a[0] * factor1 + b[0] * factor2 + c[0] * factor3 + d[0] * factor4; out[1] = a[1] * factor1 + b[1] * factor2 + c[1] * factor3 + d[1] * factor4; out[2] = a[2] * factor1 + b[2] * factor2 + c[2] * factor3 + d[2] * factor4; return out; } /** * Generates a random vector with the given scale * * @param {vec3} out the receiving vector * @param {Number} [scale] Length of the resulting vector. If ommitted, a unit vector will be returned * @returns {vec3} out */ function random(out, scale) { scale = scale || 1.0; var r = _common_js__WEBPACK_IMPORTED_MODULE_0__["RANDOM"]() * 2.0 * Math.PI; var z = _common_js__WEBPACK_IMPORTED_MODULE_0__["RANDOM"]() * 2.0 - 1.0; var zScale = Math.sqrt(1.0 - z * z) * scale; out[0] = Math.cos(r) * zScale; out[1] = Math.sin(r) * zScale; out[2] = z * scale; return out; } /** * Transforms the vec3 with a mat4. * 4th vector component is implicitly '1' * * @param {vec3} out the receiving vector * @param {ReadonlyVec3} a the vector to transform * @param {ReadonlyMat4} m matrix to transform with * @returns {vec3} out */ function transformMat4(out, a, m) { var x = a[0], y = a[1], z = a[2]; var w = m[3] * x + m[7] * y + m[11] * z + m[15]; w = w || 1.0; out[0] = (m[0] * x + m[4] * y + m[8] * z + m[12]) / w; out[1] = (m[1] * x + m[5] * y + m[9] * z + m[13]) / w; out[2] = (m[2] * x + m[6] * y + m[10] * z + m[14]) / w; return out; } /** * Transforms the vec3 with a mat3. * * @param {vec3} out the receiving vector * @param {ReadonlyVec3} a the vector to transform * @param {ReadonlyMat3} m the 3x3 matrix to transform with * @returns {vec3} out */ function transformMat3(out, a, m) { var x = a[0], y = a[1], z = a[2]; out[0] = x * m[0] + y * m[3] + z * m[6]; out[1] = x * m[1] + y * m[4] + z * m[7]; out[2] = x * m[2] + y * m[5] + z * m[8]; return out; } /** * Transforms the vec3 with a quat * Can also be used for dual quaternions. (Multiply it with the real part) * * @param {vec3} out the receiving vector * @param {ReadonlyVec3} a the vector to transform * @param {ReadonlyQuat} q quaternion to transform with * @returns {vec3} out */ function transformQuat(out, a, q) { // benchmarks: https://jsperf.com/quaternion-transform-vec3-implementations-fixed var qx = q[0], qy = q[1], qz = q[2], qw = q[3]; var x = a[0], y = a[1], z = a[2]; // var qvec = [qx, qy, qz]; // var uv = vec3.cross([], qvec, a); var uvx = qy * z - qz * y, uvy = qz * x - qx * z, uvz = qx * y - qy * x; // var uuv = vec3.cross([], qvec, uv); var uuvx = qy * uvz - qz * uvy, uuvy = qz * uvx - qx * uvz, uuvz = qx * uvy - qy * uvx; // vec3.scale(uv, uv, 2 * w); var w2 = qw * 2; uvx *= w2; uvy *= w2; uvz *= w2; // vec3.scale(uuv, uuv, 2); uuvx *= 2; uuvy *= 2; uuvz *= 2; // return vec3.add(out, a, vec3.add(out, uv, uuv)); out[0] = x + uvx + uuvx; out[1] = y + uvy + uuvy; out[2] = z + uvz + uuvz; return out; } /** * Rotate a 3D vector around the x-axis * @param {vec3} out The receiving vec3 * @param {ReadonlyVec3} a The vec3 point to rotate * @param {ReadonlyVec3} b The origin of the rotation * @param {Number} rad The angle of rotation in radians * @returns {vec3} out */ function rotateX(out, a, b, rad) { var p = [], r = []; //Translate point to the origin p[0] = a[0] - b[0]; p[1] = a[1] - b[1]; p[2] = a[2] - b[2]; //perform rotation r[0] = p[0]; r[1] = p[1] * Math.cos(rad) - p[2] * Math.sin(rad); r[2] = p[1] * Math.sin(rad) + p[2] * Math.cos(rad); //translate to correct position out[0] = r[0] + b[0]; out[1] = r[1] + b[1]; out[2] = r[2] + b[2]; return out; } /** * Rotate a 3D vector around the y-axis * @param {vec3} out The receiving vec3 * @param {ReadonlyVec3} a The vec3 point to rotate * @param {ReadonlyVec3} b The origin of the rotation * @param {Number} rad The angle of rotation in radians * @returns {vec3} out */ function rotateY(out, a, b, rad) { var p = [], r = []; //Translate point to the origin p[0] = a[0] - b[0]; p[1] = a[1] - b[1]; p[2] = a[2] - b[2]; //perform rotation r[0] = p[2] * Math.sin(rad) + p[0] * Math.cos(rad); r[1] = p[1]; r[2] = p[2] * Math.cos(rad) - p[0] * Math.sin(rad); //translate to correct position out[0] = r[0] + b[0]; out[1] = r[1] + b[1]; out[2] = r[2] + b[2]; return out; } /** * Rotate a 3D vector around the z-axis * @param {vec3} out The receiving vec3 * @param {ReadonlyVec3} a The vec3 point to rotate * @param {ReadonlyVec3} b The origin of the rotation * @param {Number} rad The angle of rotation in radians * @returns {vec3} out */ function rotateZ(out, a, b, rad) { var p = [], r = []; //Translate point to the origin p[0] = a[0] - b[0]; p[1] = a[1] - b[1]; p[2] = a[2] - b[2]; //perform rotation r[0] = p[0] * Math.cos(rad) - p[1] * Math.sin(rad); r[1] = p[0] * Math.sin(rad) + p[1] * Math.cos(rad); r[2] = p[2]; //translate to correct position out[0] = r[0] + b[0]; out[1] = r[1] + b[1]; out[2] = r[2] + b[2]; return out; } /** * Get the angle between two 3D vectors * @param {ReadonlyVec3} a The first operand * @param {ReadonlyVec3} b The second operand * @returns {Number} The angle in radians */ function angle(a, b) { var ax = a[0], ay = a[1], az = a[2], bx = b[0], by = b[1], bz = b[2], mag1 = Math.sqrt(ax * ax + ay * ay + az * az), mag2 = Math.sqrt(bx * bx + by * by + bz * bz), mag = mag1 * mag2, cosine = mag && dot(a, b) / mag; return Math.acos(Math.min(Math.max(cosine, -1), 1)); } /** * Set the components of a vec3 to zero * * @param {vec3} out the receiving vector * @returns {vec3} out */ function zero(out) { out[0] = 0.0; out[1] = 0.0; out[2] = 0.0; return out; } /** * Returns a string representation of a vector * * @param {ReadonlyVec3} a vector to represent as a string * @returns {String} string representation of the vector */ function str(a) { return "vec3(" + a[0] + ", " + a[1] + ", " + a[2] + ")"; } /** * Returns whether or not the vectors have exactly the same elements in the same position (when compared with ===) * * @param {ReadonlyVec3} a The first vector. * @param {ReadonlyVec3} b The second vector. * @returns {Boolean} True if the vectors are equal, false otherwise. */ function exactEquals(a, b) { return a[0] === b[0] && a[1] === b[1] && a[2] === b[2]; } /** * Returns whether or not the vectors have approximately the same elements in the same position. * * @param {ReadonlyVec3} a The first vector. * @param {ReadonlyVec3} b The second vector. * @returns {Boolean} True if the vectors are equal, false otherwise. */ function equals(a, b) { var a0 = a[0], a1 = a[1], a2 = a[2]; var b0 = b[0], b1 = b[1], b2 = b[2]; return Math.abs(a0 - b0) <= _common_js__WEBPACK_IMPORTED_MODULE_0__["EPSILON"] * Math.max(1.0, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= _common_js__WEBPACK_IMPORTED_MODULE_0__["EPSILON"] * Math.max(1.0, Math.abs(a1), Math.abs(b1)) && Math.abs(a2 - b2) <= _common_js__WEBPACK_IMPORTED_MODULE_0__["EPSILON"] * Math.max(1.0, Math.abs(a2), Math.abs(b2)); } /** * Alias for {@link vec3.subtract} * @function */ var sub = subtract; /** * Alias for {@link vec3.multiply} * @function */ var mul = multiply; /** * Alias for {@link vec3.divide} * @function */ var div = divide; /** * Alias for {@link vec3.distance} * @function */ var dist = distance; /** * Alias for {@link vec3.squaredDistance} * @function */ var sqrDist = squaredDistance; /** * Alias for {@link vec3.length} * @function */ var len = length; /** * Alias for {@link vec3.squaredLength} * @function */ var sqrLen = squaredLength; /** * Perform some operation over an array of vec3s. * * @param {Array} a the array of vectors to iterate over * @param {Number} stride Number of elements between the start of each vec3. If 0 assumes tightly packed * @param {Number} offset Number of elements to skip at the beginning of the array * @param {Number} count Number of vec3s to iterate over. If 0 iterates over entire array * @param {Function} fn Function to call for each vector in the array * @param {Object} [arg] additional argument to pass to fn * @returns {Array} a * @function */ var forEach = function () { var vec = create(); return function (a, stride, offset, count, fn, arg) { var i, l; if (!stride) { stride = 3; } if (!offset) { offset = 0; } if (count) { l = Math.min(count * stride + offset, a.length); } else { l = a.length; } for (i = offset; i < l; i += stride) { vec[0] = a[i]; vec[1] = a[i + 1]; vec[2] = a[i + 2]; fn(vec, vec, arg); a[i] = vec[0]; a[i + 1] = vec[1]; a[i + 2] = vec[2]; } return a; }; }(); /***/ }), /***/ "./node_modules/_gl-matrix@3.3.0@gl-matrix/esm/vec4.js": /*!*************************************************************!*\ !*** ./node_modules/_gl-matrix@3.3.0@gl-matrix/esm/vec4.js ***! \*************************************************************/ /*! exports provided: create, clone, fromValues, copy, set, add, subtract, multiply, divide, ceil, floor, min, max, round, scale, scaleAndAdd, distance, squaredDistance, length, squaredLength, negate, inverse, normalize, dot, cross, lerp, random, transformMat4, transformQuat, zero, str, exactEquals, equals, sub, mul, div, dist, sqrDist, len, sqrLen, forEach */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "create", function() { return create; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "clone", function() { return clone; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "fromValues", function() { return fromValues; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "copy", function() { return copy; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "set", function() { return set; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "add", function() { return add; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "subtract", function() { return subtract; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "multiply", function() { return multiply; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "divide", function() { return divide; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ceil", function() { return ceil; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "floor", function() { return floor; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "min", function() { return min; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "max", function() { return max; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "round", function() { return round; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "scale", function() { return scale; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "scaleAndAdd", function() { return scaleAndAdd; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "distance", function() { return distance; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "squaredDistance", function() { return squaredDistance; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "length", function() { return length; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "squaredLength", function() { return squaredLength; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "negate", function() { return negate; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "inverse", function() { return inverse; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "normalize", function() { return normalize; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "dot", function() { return dot; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "cross", function() { return cross; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "lerp", function() { return lerp; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "random", function() { return random; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "transformMat4", function() { return transformMat4; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "transformQuat", function() { return transformQuat; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "zero", function() { return zero; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "str", function() { return str; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "exactEquals", function() { return exactEquals; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "equals", function() { return equals; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "sub", function() { return sub; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "mul", function() { return mul; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "div", function() { return div; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "dist", function() { return dist; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "sqrDist", function() { return sqrDist; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "len", function() { return len; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "sqrLen", function() { return sqrLen; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "forEach", function() { return forEach; }); /* harmony import */ var _common_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./common.js */ "./node_modules/_gl-matrix@3.3.0@gl-matrix/esm/common.js"); /** * 4 Dimensional Vector * @module vec4 */ /** * Creates a new, empty vec4 * * @returns {vec4} a new 4D vector */ function create() { var out = new _common_js__WEBPACK_IMPORTED_MODULE_0__["ARRAY_TYPE"](4); if (_common_js__WEBPACK_IMPORTED_MODULE_0__["ARRAY_TYPE"] != Float32Array) { out[0] = 0; out[1] = 0; out[2] = 0; out[3] = 0; } return out; } /** * Creates a new vec4 initialized with values from an existing vector * * @param {ReadonlyVec4} a vector to clone * @returns {vec4} a new 4D vector */ function clone(a) { var out = new _common_js__WEBPACK_IMPORTED_MODULE_0__["ARRAY_TYPE"](4); out[0] = a[0]; out[1] = a[1]; out[2] = a[2]; out[3] = a[3]; return out; } /** * Creates a new vec4 initialized with the given values * * @param {Number} x X component * @param {Number} y Y component * @param {Number} z Z component * @param {Number} w W component * @returns {vec4} a new 4D vector */ function fromValues(x, y, z, w) { var out = new _common_js__WEBPACK_IMPORTED_MODULE_0__["ARRAY_TYPE"](4); out[0] = x; out[1] = y; out[2] = z; out[3] = w; return out; } /** * Copy the values from one vec4 to another * * @param {vec4} out the receiving vector * @param {ReadonlyVec4} a the source vector * @returns {vec4} out */ function copy(out, a) { out[0] = a[0]; out[1] = a[1]; out[2] = a[2]; out[3] = a[3]; return out; } /** * Set the components of a vec4 to the given values * * @param {vec4} out the receiving vector * @param {Number} x X component * @param {Number} y Y component * @param {Number} z Z component * @param {Number} w W component * @returns {vec4} out */ function set(out, x, y, z, w) { out[0] = x; out[1] = y; out[2] = z; out[3] = w; return out; } /** * Adds two vec4's * * @param {vec4} out the receiving vector * @param {ReadonlyVec4} a the first operand * @param {ReadonlyVec4} b the second operand * @returns {vec4} out */ function add(out, a, b) { out[0] = a[0] + b[0]; out[1] = a[1] + b[1]; out[2] = a[2] + b[2]; out[3] = a[3] + b[3]; return out; } /** * Subtracts vector b from vector a * * @param {vec4} out the receiving vector * @param {ReadonlyVec4} a the first operand * @param {ReadonlyVec4} b the second operand * @returns {vec4} out */ function subtract(out, a, b) { out[0] = a[0] - b[0]; out[1] = a[1] - b[1]; out[2] = a[2] - b[2]; out[3] = a[3] - b[3]; return out; } /** * Multiplies two vec4's * * @param {vec4} out the receiving vector * @param {ReadonlyVec4} a the first operand * @param {ReadonlyVec4} b the second operand * @returns {vec4} out */ function multiply(out, a, b) { out[0] = a[0] * b[0]; out[1] = a[1] * b[1]; out[2] = a[2] * b[2]; out[3] = a[3] * b[3]; return out; } /** * Divides two vec4's * * @param {vec4} out the receiving vector * @param {ReadonlyVec4} a the first operand * @param {ReadonlyVec4} b the second operand * @returns {vec4} out */ function divide(out, a, b) { out[0] = a[0] / b[0]; out[1] = a[1] / b[1]; out[2] = a[2] / b[2]; out[3] = a[3] / b[3]; return out; } /** * Math.ceil the components of a vec4 * * @param {vec4} out the receiving vector * @param {ReadonlyVec4} a vector to ceil * @returns {vec4} out */ function ceil(out, a) { out[0] = Math.ceil(a[0]); out[1] = Math.ceil(a[1]); out[2] = Math.ceil(a[2]); out[3] = Math.ceil(a[3]); return out; } /** * Math.floor the components of a vec4 * * @param {vec4} out the receiving vector * @param {ReadonlyVec4} a vector to floor * @returns {vec4} out */ function floor(out, a) { out[0] = Math.floor(a[0]); out[1] = Math.floor(a[1]); out[2] = Math.floor(a[2]); out[3] = Math.floor(a[3]); return out; } /** * Returns the minimum of two vec4's * * @param {vec4} out the receiving vector * @param {ReadonlyVec4} a the first operand * @param {ReadonlyVec4} b the second operand * @returns {vec4} out */ function min(out, a, b) { out[0] = Math.min(a[0], b[0]); out[1] = Math.min(a[1], b[1]); out[2] = Math.min(a[2], b[2]); out[3] = Math.min(a[3], b[3]); return out; } /** * Returns the maximum of two vec4's * * @param {vec4} out the receiving vector * @param {ReadonlyVec4} a the first operand * @param {ReadonlyVec4} b the second operand * @returns {vec4} out */ function max(out, a, b) { out[0] = Math.max(a[0], b[0]); out[1] = Math.max(a[1], b[1]); out[2] = Math.max(a[2], b[2]); out[3] = Math.max(a[3], b[3]); return out; } /** * Math.round the components of a vec4 * * @param {vec4} out the receiving vector * @param {ReadonlyVec4} a vector to round * @returns {vec4} out */ function round(out, a) { out[0] = Math.round(a[0]); out[1] = Math.round(a[1]); out[2] = Math.round(a[2]); out[3] = Math.round(a[3]); return out; } /** * Scales a vec4 by a scalar number * * @param {vec4} out the receiving vector * @param {ReadonlyVec4} a the vector to scale * @param {Number} b amount to scale the vector by * @returns {vec4} out */ function scale(out, a, b) { out[0] = a[0] * b; out[1] = a[1] * b; out[2] = a[2] * b; out[3] = a[3] * b; return out; } /** * Adds two vec4's after scaling the second operand by a scalar value * * @param {vec4} out the receiving vector * @param {ReadonlyVec4} a the first operand * @param {ReadonlyVec4} b the second operand * @param {Number} scale the amount to scale b by before adding * @returns {vec4} out */ function scaleAndAdd(out, a, b, scale) { out[0] = a[0] + b[0] * scale; out[1] = a[1] + b[1] * scale; out[2] = a[2] + b[2] * scale; out[3] = a[3] + b[3] * scale; return out; } /** * Calculates the euclidian distance between two vec4's * * @param {ReadonlyVec4} a the first operand * @param {ReadonlyVec4} b the second operand * @returns {Number} distance between a and b */ function distance(a, b) { var x = b[0] - a[0]; var y = b[1] - a[1]; var z = b[2] - a[2]; var w = b[3] - a[3]; return Math.hypot(x, y, z, w); } /** * Calculates the squared euclidian distance between two vec4's * * @param {ReadonlyVec4} a the first operand * @param {ReadonlyVec4} b the second operand * @returns {Number} squared distance between a and b */ function squaredDistance(a, b) { var x = b[0] - a[0]; var y = b[1] - a[1]; var z = b[2] - a[2]; var w = b[3] - a[3]; return x * x + y * y + z * z + w * w; } /** * Calculates the length of a vec4 * * @param {ReadonlyVec4} a vector to calculate length of * @returns {Number} length of a */ function length(a) { var x = a[0]; var y = a[1]; var z = a[2]; var w = a[3]; return Math.hypot(x, y, z, w); } /** * Calculates the squared length of a vec4 * * @param {ReadonlyVec4} a vector to calculate squared length of * @returns {Number} squared length of a */ function squaredLength(a) { var x = a[0]; var y = a[1]; var z = a[2]; var w = a[3]; return x * x + y * y + z * z + w * w; } /** * Negates the components of a vec4 * * @param {vec4} out the receiving vector * @param {ReadonlyVec4} a vector to negate * @returns {vec4} out */ function negate(out, a) { out[0] = -a[0]; out[1] = -a[1]; out[2] = -a[2]; out[3] = -a[3]; return out; } /** * Returns the inverse of the components of a vec4 * * @param {vec4} out the receiving vector * @param {ReadonlyVec4} a vector to invert * @returns {vec4} out */ function inverse(out, a) { out[0] = 1.0 / a[0]; out[1] = 1.0 / a[1]; out[2] = 1.0 / a[2]; out[3] = 1.0 / a[3]; return out; } /** * Normalize a vec4 * * @param {vec4} out the receiving vector * @param {ReadonlyVec4} a vector to normalize * @returns {vec4} out */ function normalize(out, a) { var x = a[0]; var y = a[1]; var z = a[2]; var w = a[3]; var len = x * x + y * y + z * z + w * w; if (len > 0) { len = 1 / Math.sqrt(len); } out[0] = x * len; out[1] = y * len; out[2] = z * len; out[3] = w * len; return out; } /** * Calculates the dot product of two vec4's * * @param {ReadonlyVec4} a the first operand * @param {ReadonlyVec4} b the second operand * @returns {Number} dot product of a and b */ function dot(a, b) { return a[0] * b[0] + a[1] * b[1] + a[2] * b[2] + a[3] * b[3]; } /** * Returns the cross-product of three vectors in a 4-dimensional space * * @param {ReadonlyVec4} result the receiving vector * @param {ReadonlyVec4} U the first vector * @param {ReadonlyVec4} V the second vector * @param {ReadonlyVec4} W the third vector * @returns {vec4} result */ function cross(out, u, v, w) { var A = v[0] * w[1] - v[1] * w[0], B = v[0] * w[2] - v[2] * w[0], C = v[0] * w[3] - v[3] * w[0], D = v[1] * w[2] - v[2] * w[1], E = v[1] * w[3] - v[3] * w[1], F = v[2] * w[3] - v[3] * w[2]; var G = u[0]; var H = u[1]; var I = u[2]; var J = u[3]; out[0] = H * F - I * E + J * D; out[1] = -(G * F) + I * C - J * B; out[2] = G * E - H * C + J * A; out[3] = -(G * D) + H * B - I * A; return out; } /** * Performs a linear interpolation between two vec4's * * @param {vec4} out the receiving vector * @param {ReadonlyVec4} a the first operand * @param {ReadonlyVec4} b the second operand * @param {Number} t interpolation amount, in the range [0-1], between the two inputs * @returns {vec4} out */ function lerp(out, a, b, t) { var ax = a[0]; var ay = a[1]; var az = a[2]; var aw = a[3]; out[0] = ax + t * (b[0] - ax); out[1] = ay + t * (b[1] - ay); out[2] = az + t * (b[2] - az); out[3] = aw + t * (b[3] - aw); return out; } /** * Generates a random vector with the given scale * * @param {vec4} out the receiving vector * @param {Number} [scale] Length of the resulting vector. If ommitted, a unit vector will be returned * @returns {vec4} out */ function random(out, scale) { scale = scale || 1.0; // Marsaglia, George. Choosing a Point from the Surface of a // Sphere. Ann. Math. Statist. 43 (1972), no. 2, 645--646. // http://projecteuclid.org/euclid.aoms/1177692644; var v1, v2, v3, v4; var s1, s2; do { v1 = _common_js__WEBPACK_IMPORTED_MODULE_0__["RANDOM"]() * 2 - 1; v2 = _common_js__WEBPACK_IMPORTED_MODULE_0__["RANDOM"]() * 2 - 1; s1 = v1 * v1 + v2 * v2; } while (s1 >= 1); do { v3 = _common_js__WEBPACK_IMPORTED_MODULE_0__["RANDOM"]() * 2 - 1; v4 = _common_js__WEBPACK_IMPORTED_MODULE_0__["RANDOM"]() * 2 - 1; s2 = v3 * v3 + v4 * v4; } while (s2 >= 1); var d = Math.sqrt((1 - s1) / s2); out[0] = scale * v1; out[1] = scale * v2; out[2] = scale * v3 * d; out[3] = scale * v4 * d; return out; } /** * Transforms the vec4 with a mat4. * * @param {vec4} out the receiving vector * @param {ReadonlyVec4} a the vector to transform * @param {ReadonlyMat4} m matrix to transform with * @returns {vec4} out */ function transformMat4(out, a, m) { var x = a[0], y = a[1], z = a[2], w = a[3]; out[0] = m[0] * x + m[4] * y + m[8] * z + m[12] * w; out[1] = m[1] * x + m[5] * y + m[9] * z + m[13] * w; out[2] = m[2] * x + m[6] * y + m[10] * z + m[14] * w; out[3] = m[3] * x + m[7] * y + m[11] * z + m[15] * w; return out; } /** * Transforms the vec4 with a quat * * @param {vec4} out the receiving vector * @param {ReadonlyVec4} a the vector to transform * @param {ReadonlyQuat} q quaternion to transform with * @returns {vec4} out */ function transformQuat(out, a, q) { var x = a[0], y = a[1], z = a[2]; var qx = q[0], qy = q[1], qz = q[2], qw = q[3]; // calculate quat * vec var ix = qw * x + qy * z - qz * y; var iy = qw * y + qz * x - qx * z; var iz = qw * z + qx * y - qy * x; var iw = -qx * x - qy * y - qz * z; // calculate result * inverse quat out[0] = ix * qw + iw * -qx + iy * -qz - iz * -qy; out[1] = iy * qw + iw * -qy + iz * -qx - ix * -qz; out[2] = iz * qw + iw * -qz + ix * -qy - iy * -qx; out[3] = a[3]; return out; } /** * Set the components of a vec4 to zero * * @param {vec4} out the receiving vector * @returns {vec4} out */ function zero(out) { out[0] = 0.0; out[1] = 0.0; out[2] = 0.0; out[3] = 0.0; return out; } /** * Returns a string representation of a vector * * @param {ReadonlyVec4} a vector to represent as a string * @returns {String} string representation of the vector */ function str(a) { return "vec4(" + a[0] + ", " + a[1] + ", " + a[2] + ", " + a[3] + ")"; } /** * Returns whether or not the vectors have exactly the same elements in the same position (when compared with ===) * * @param {ReadonlyVec4} a The first vector. * @param {ReadonlyVec4} b The second vector. * @returns {Boolean} True if the vectors are equal, false otherwise. */ function exactEquals(a, b) { return a[0] === b[0] && a[1] === b[1] && a[2] === b[2] && a[3] === b[3]; } /** * Returns whether or not the vectors have approximately the same elements in the same position. * * @param {ReadonlyVec4} a The first vector. * @param {ReadonlyVec4} b The second vector. * @returns {Boolean} True if the vectors are equal, false otherwise. */ function equals(a, b) { var a0 = a[0], a1 = a[1], a2 = a[2], a3 = a[3]; var b0 = b[0], b1 = b[1], b2 = b[2], b3 = b[3]; return Math.abs(a0 - b0) <= _common_js__WEBPACK_IMPORTED_MODULE_0__["EPSILON"] * Math.max(1.0, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= _common_js__WEBPACK_IMPORTED_MODULE_0__["EPSILON"] * Math.max(1.0, Math.abs(a1), Math.abs(b1)) && Math.abs(a2 - b2) <= _common_js__WEBPACK_IMPORTED_MODULE_0__["EPSILON"] * Math.max(1.0, Math.abs(a2), Math.abs(b2)) && Math.abs(a3 - b3) <= _common_js__WEBPACK_IMPORTED_MODULE_0__["EPSILON"] * Math.max(1.0, Math.abs(a3), Math.abs(b3)); } /** * Alias for {@link vec4.subtract} * @function */ var sub = subtract; /** * Alias for {@link vec4.multiply} * @function */ var mul = multiply; /** * Alias for {@link vec4.divide} * @function */ var div = divide; /** * Alias for {@link vec4.distance} * @function */ var dist = distance; /** * Alias for {@link vec4.squaredDistance} * @function */ var sqrDist = squaredDistance; /** * Alias for {@link vec4.length} * @function */ var len = length; /** * Alias for {@link vec4.squaredLength} * @function */ var sqrLen = squaredLength; /** * Perform some operation over an array of vec4s. * * @param {Array} a the array of vectors to iterate over * @param {Number} stride Number of elements between the start of each vec4. If 0 assumes tightly packed * @param {Number} offset Number of elements to skip at the beginning of the array * @param {Number} count Number of vec4s to iterate over. If 0 iterates over entire array * @param {Function} fn Function to call for each vector in the array * @param {Object} [arg] additional argument to pass to fn * @returns {Array} a * @function */ var forEach = function () { var vec = create(); return function (a, stride, offset, count, fn, arg) { var i, l; if (!stride) { stride = 4; } if (!offset) { offset = 0; } if (count) { l = Math.min(count * stride + offset, a.length); } else { l = a.length; } for (i = offset; i < l; i += stride) { vec[0] = a[i]; vec[1] = a[i + 1]; vec[2] = a[i + 2]; vec[3] = a[i + 3]; fn(vec, vec, arg); a[i] = vec[0]; a[i + 1] = vec[1]; a[i + 2] = vec[2]; a[i + 3] = vec[3]; } return a; }; }(); /***/ }), /***/ "./node_modules/_process@0.11.10@process/browser.js": /*!**********************************************************!*\ !*** ./node_modules/_process@0.11.10@process/browser.js ***! \**********************************************************/ /*! no static exports found */ /***/ (function(module, exports) { // shim for using process in browser var process = module.exports = {}; // cached from whatever global is present so that test runners that stub it // don't break things. But we need to wrap it in a try catch in case it is // wrapped in strict mode code which doesn't define any globals. It's inside a // function because try/catches deoptimize in certain engines. var cachedSetTimeout; var cachedClearTimeout; function defaultSetTimout() { throw new Error('setTimeout has not been defined'); } function defaultClearTimeout() { throw new Error('clearTimeout has not been defined'); } (function () { try { if (typeof setTimeout === 'function') { cachedSetTimeout = setTimeout; } else { cachedSetTimeout = defaultSetTimout; } } catch (e) { cachedSetTimeout = defaultSetTimout; } try { if (typeof clearTimeout === 'function') { cachedClearTimeout = clearTimeout; } else { cachedClearTimeout = defaultClearTimeout; } } catch (e) { cachedClearTimeout = defaultClearTimeout; } })(); function runTimeout(fun) { if (cachedSetTimeout === setTimeout) { //normal enviroments in sane situations return setTimeout(fun, 0); } // if setTimeout wasn't available but was latter defined if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) { cachedSetTimeout = setTimeout; return setTimeout(fun, 0); } try { // when when somebody has screwed with setTimeout but no I.E. maddness return cachedSetTimeout(fun, 0); } catch (e) { try { // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally return cachedSetTimeout.call(null, fun, 0); } catch (e) { // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error return cachedSetTimeout.call(this, fun, 0); } } } function runClearTimeout(marker) { if (cachedClearTimeout === clearTimeout) { //normal enviroments in sane situations return clearTimeout(marker); } // if clearTimeout wasn't available but was latter defined if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) { cachedClearTimeout = clearTimeout; return clearTimeout(marker); } try { // when when somebody has screwed with setTimeout but no I.E. maddness return cachedClearTimeout(marker); } catch (e) { try { // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally return cachedClearTimeout.call(null, marker); } catch (e) { // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error. // Some versions of I.E. have different rules for clearTimeout vs setTimeout return cachedClearTimeout.call(this, marker); } } } var queue = []; var draining = false; var currentQueue; var queueIndex = -1; function cleanUpNextTick() { if (!draining || !currentQueue) { return; } draining = false; if (currentQueue.length) { queue = currentQueue.concat(queue); } else { queueIndex = -1; } if (queue.length) { drainQueue(); } } function drainQueue() { if (draining) { return; } var timeout = runTimeout(cleanUpNextTick); draining = true; var len = queue.length; while (len) { currentQueue = queue; queue = []; while (++queueIndex < len) { if (currentQueue) { currentQueue[queueIndex].run(); } } queueIndex = -1; len = queue.length; } currentQueue = null; draining = false; runClearTimeout(timeout); } process.nextTick = function (fun) { var args = new Array(arguments.length - 1); if (arguments.length > 1) { for (var i = 1; i < arguments.length; i++) { args[i - 1] = arguments[i]; } } queue.push(new Item(fun, args)); if (queue.length === 1 && !draining) { runTimeout(drainQueue); } }; // v8 likes predictible objects function Item(fun, array) { this.fun = fun; this.array = array; } Item.prototype.run = function () { this.fun.apply(null, this.array); }; process.title = 'browser'; process.browser = true; process.env = {}; process.argv = []; process.version = ''; // empty string to avoid regexp issues process.versions = {}; function noop() {} process.on = noop; process.addListener = noop; process.once = noop; process.off = noop; process.removeListener = noop; process.removeAllListeners = noop; process.emit = noop; process.prependListener = noop; process.prependOnceListener = noop; process.listeners = function (name) { return []; }; process.binding = function (name) { throw new Error('process.binding is not supported'); }; process.cwd = function () { return '/'; }; process.chdir = function (dir) { throw new Error('process.chdir is not supported'); }; process.umask = function () { return 0; }; /***/ }), /***/ "./node_modules/_tslib@1.13.0@tslib/tslib.es6.js": /*!*******************************************************!*\ !*** ./node_modules/_tslib@1.13.0@tslib/tslib.es6.js ***! \*******************************************************/ /*! exports provided: __extends, __assign, __rest, __decorate, __param, __metadata, __awaiter, __generator, __createBinding, __exportStar, __values, __read, __spread, __spreadArrays, __await, __asyncGenerator, __asyncDelegator, __asyncValues, __makeTemplateObject, __importStar, __importDefault, __classPrivateFieldGet, __classPrivateFieldSet */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__extends", function() { return __extends; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__assign", function() { return __assign; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__rest", function() { return __rest; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__decorate", function() { return __decorate; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__param", function() { return __param; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__metadata", function() { return __metadata; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__awaiter", function() { return __awaiter; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__generator", function() { return __generator; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__createBinding", function() { return __createBinding; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__exportStar", function() { return __exportStar; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__values", function() { return __values; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__read", function() { return __read; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__spread", function() { return __spread; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__spreadArrays", function() { return __spreadArrays; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__await", function() { return __await; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__asyncGenerator", function() { return __asyncGenerator; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__asyncDelegator", function() { return __asyncDelegator; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__asyncValues", function() { return __asyncValues; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__makeTemplateObject", function() { return __makeTemplateObject; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__importStar", function() { return __importStar; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__importDefault", function() { return __importDefault; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__classPrivateFieldGet", function() { return __classPrivateFieldGet; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__classPrivateFieldSet", function() { return __classPrivateFieldSet; }); /*! ***************************************************************************** Copyright (c) Microsoft Corporation. Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ***************************************************************************** */ /* global Reflect, Promise */ var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; } || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return extendStatics(d, b); }; function __extends(d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); } var __assign = function () { __assign = Object.assign || function __assign(t) { for (var s, i = 1, n = arguments.length; i < n; i++) { s = arguments[i]; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; } return t; }; return __assign.apply(this, arguments); }; function __rest(s, e) { var t = {}; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p]; if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]]; } return t; } function __decorate(decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; } function __param(paramIndex, decorator) { return function (target, key) { decorator(target, key, paramIndex); }; } function __metadata(metadataKey, metadataValue) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue); } function __awaiter(thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); } function __generator(thisArg, body) { var _ = { label: 0, sent: function () { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function () { return this; }), g; function verb(n) { return function (v) { return step([n, v]); }; } function step(op) { if (f) throw new TypeError("Generator is already executing."); while (_) try { if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; if (y = 0, t) op = [op[0] & 2, t.value]; switch (op[0]) { case 0: case 1: t = op; break; case 4: _.label++; return { value: op[1], done: false }; case 5: _.label++; y = op[1]; op = [0]; continue; case 7: op = _.ops.pop(); _.trys.pop(); continue; default: if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) { _.label = op[1]; break; } if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } if (t[2]) _.ops.pop(); _.trys.pop(); continue; } op = body.call(thisArg, _); } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; } } function __createBinding(o, m, k, k2) { if (k2 === undefined) k2 = k; o[k2] = m[k]; } function __exportStar(m, exports) { for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) exports[p] = m[p]; } function __values(o) { var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; if (m) return m.call(o); if (o && typeof o.length === "number") return { next: function () { if (o && i >= o.length) o = void 0; return { value: o && o[i++], done: !o }; } }; throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); } function __read(o, n) { var m = typeof Symbol === "function" && o[Symbol.iterator]; if (!m) return o; var i = m.call(o), r, ar = [], e; try { while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); } catch (error) { e = { error: error }; } finally { try { if (r && !r.done && (m = i["return"])) m.call(i); } finally { if (e) throw e.error; } } return ar; } function __spread() { for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i])); return ar; } function __spreadArrays() { for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length; for (var r = Array(s), k = 0, i = 0; i < il; i++) for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) r[k] = a[j]; return r; } ; function __await(v) { return this instanceof __await ? (this.v = v, this) : new __await(v); } function __asyncGenerator(thisArg, _arguments, generator) { if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); var g = generator.apply(thisArg, _arguments || []), i, q = []; return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i; function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; } function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } } function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); } function fulfill(value) { resume("next", value); } function reject(value) { resume("throw", value); } function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); } } function __asyncDelegator(o) { var i, p; return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i; function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; } } function __asyncValues(o) { if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); var m = o[Symbol.asyncIterator], i; return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i); function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; } function settle(resolve, reject, d, v) { Promise.resolve(v).then(function (v) { resolve({ value: v, done: d }); }, reject); } } function __makeTemplateObject(cooked, raw) { if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; } return cooked; } ; function __importStar(mod) { if (mod && mod.__esModule) return mod; var result = {}; if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; result.default = mod; return result; } function __importDefault(mod) { return mod && mod.__esModule ? mod : { default: mod }; } function __classPrivateFieldGet(receiver, privateMap) { if (!privateMap.has(receiver)) { throw new TypeError("attempted to get private field on non-instance"); } return privateMap.get(receiver); } function __classPrivateFieldSet(receiver, privateMap, value) { if (!privateMap.has(receiver)) { throw new TypeError("attempted to set private field on non-instance"); } privateMap.set(receiver, value); return value; } /***/ }), /***/ "./package.json": /*!**********************!*\ !*** ./package.json ***! \**********************/ /*! exports provided: name, version, description, main, module, unpkg, types, files, scripts, repository, keywords, publishConfig, author, license, bugs, devDependencies, homepage, dependencies, __npminstall_done, default */ /***/ (function(module) { module.exports = JSON.parse("{\"name\":\"@antv/g-canvas\",\"version\":\"0.5.0-beta.1\",\"description\":\"A canvas library which providing 2d\",\"main\":\"lib/index.js\",\"module\":\"esm/index.js\",\"unpkg\":\"dist/g.min.js\",\"types\":\"lib/index.d.ts\",\"files\":[\"package.json\",\"esm\",\"lib\",\"dist\",\"LICENSE\",\"README.md\"],\"scripts\":{\"build\":\"npm run clean && run-p build:*\",\"buildx\":\"run-p build:*\",\"build:esm\":\"tsc -p tsconfig.json --target ES5 --module ESNext --outDir esm\",\"build:cjs\":\"tsc -p tsconfig.json --target ES5 --module commonjs --outDir lib\",\"build:umd\":\"webpack --config webpack.config.js --mode development\",\"clean\":\"rm -rf esm lib dist\",\"coverage\":\"npm run coverage-generator && npm run coverage-viewer\",\"coverage-generator\":\"torch --coverage --compile --source-pattern src/*.js,src/**/*.js --opts tests/mocha.opts\",\"coverage-viewer\":\"torch-coverage\",\"test\":\"torch --renderer --compile --opts tests/mocha.opts\",\"test-live\":\"torch --compile --interactive tests/unit/\",\"tsc\":\"tsc --noEmit\",\"typecheck\":\"tsc --noEmit\",\"dist\":\"webpack --config webpack.config.js --mode production\"},\"repository\":{\"type\":\"git\",\"url\":\"git+https://github.com/antvis/g.git\"},\"keywords\":[\"util\",\"antv\",\"g\"],\"publishConfig\":{\"access\":\"public\"},\"author\":\"https://github.com/orgs/antvis/people\",\"license\":\"ISC\",\"bugs\":{\"url\":\"https://github.com/antvis/g/issues\"},\"devDependencies\":{\"@antv/torch\":\"^1.0.0\",\"less\":\"^3.9.0\",\"npm-run-all\":\"^4.1.5\",\"webpack\":\"^4.26.1\",\"webpack-cli\":\"^3.1.2\"},\"homepage\":\"https://github.com/antvis/g#readme\",\"dependencies\":{\"@antv/g-base\":\"^0.5.0-beta.1\",\"@antv/g-math\":\"^0.1.3\",\"@antv/matrix-util\":\"^3.0.2\",\"@antv/path-util\":\"~2.0.5\",\"@antv/util\":\"~2.0.0\",\"gl-matrix\":\"^3.0.0\"},\"__npminstall_done\":false}"); /***/ }), /***/ "./src/canvas.ts": /*!***********************!*\ !*** ./src/canvas.ts ***! \***********************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var tslib_1 = __webpack_require__(/*! tslib */ "./node_modules/_tslib@1.13.0@tslib/tslib.es6.js"); var g_base_1 = __webpack_require__(/*! @antv/g-base */ "./node_modules/_@antv_g-base@0.5.0-beta.1@@antv/g-base/esm/index.js"); var hit_1 = __webpack_require__(/*! ./util/hit */ "./src/util/hit.ts"); var Shape = __webpack_require__(/*! ./shape */ "./src/shape/index.ts"); var group_1 = __webpack_require__(/*! ./group */ "./src/group.ts"); var draw_1 = __webpack_require__(/*! ./util/draw */ "./src/util/draw.ts"); var util_1 = __webpack_require__(/*! ./util/util */ "./src/util/util.ts"); var Canvas = /** @class */ (function (_super) { tslib_1.__extends(Canvas, _super); function Canvas() { return _super !== null && _super.apply(this, arguments) || this; } Canvas.prototype.getDefaultCfg = function () { var cfg = _super.prototype.getDefaultCfg.call(this); // 设置渲染引擎为 canvas,只读属性 cfg['renderer'] = 'canvas'; // 是否自动绘制,不需要用户调用 draw 方法 cfg['autoDraw'] = true; // 是否允许局部刷新图表 cfg['localRefresh'] = true; cfg['refreshElements'] = []; // 是否在视图内自动裁剪 cfg['clipView'] = true; // 是否使用快速拾取的方案,默认为 false,上层可以打开 cfg['quickHit'] = false; return cfg; }; /** * 一些方法调用会引起画布变化 * @param {ChangeType} changeType 改变的类型 */ Canvas.prototype.onCanvasChange = function (changeType) { /** * 触发画布更新的三种 changeType * 1. attr: 修改画布的绘图属性 * 2. sort: 画布排序,图形的层次会发生变化 * 3. changeSize: 改变画布大小 */ if (changeType === 'attr' || changeType === 'sort' || changeType === 'changeSize') { this.set('refreshElements', [this]); this.draw(); } }; Canvas.prototype.getShapeBase = function () { return Shape; }; Canvas.prototype.getGroupBase = function () { return group_1.default; }; /** * 获取屏幕像素比 */ Canvas.prototype.getPixelRatio = function () { var pixelRatio = this.get('pixelRatio') || util_1.getPixelRatio(); // 不足 1 的取 1,超出 1 的取整 return pixelRatio >= 1 ? Math.floor(pixelRatio) : 1; }; Canvas.prototype.getViewRange = function () { return { minX: 0, minY: 0, maxX: this.cfg.width, maxY: this.cfg.height, }; }; // 复写基类的方法生成标签 Canvas.prototype.createDom = function () { var element = document.createElement('canvas'); var context = element.getContext('2d'); // 缓存 context 对象 this.set('context', context); return element; }; Canvas.prototype.setDOMSize = function (width, height) { _super.prototype.setDOMSize.call(this, width, height); var context = this.get('context'); var el = this.get('el'); var pixelRatio = this.getPixelRatio(); el.width = pixelRatio * width; el.height = pixelRatio * height; // 设置 canvas 元素的宽度和高度,会重置缩放,因此 context.scale 需要在每次设置宽、高后调用 if (pixelRatio > 1) { context.scale(pixelRatio, pixelRatio); } }; // 复写基类方法 Canvas.prototype.clear = function () { _super.prototype.clear.call(this); this._clearFrame(); // 需要清理掉延迟绘制的帧 var context = this.get('context'); var element = this.get('el'); context.clearRect(0, 0, element.width, element.height); }; Canvas.prototype.getShape = function (x, y) { var shape; if (this.get('quickHit')) { shape = hit_1.getShape(this, x, y); } else { shape = _super.prototype.getShape.call(this, x, y, null); } return shape; }; // 对绘制区域边缘取整,避免浮点数问题 Canvas.prototype._getRefreshRegion = function () { var elements = this.get('refreshElements'); var viewRegion = this.getViewRange(); var region; // 如果是当前画布整体发生了变化,则直接重绘整个画布 if (elements.length && elements[0] === this) { region = viewRegion; } else { region = draw_1.getMergedRegion(elements); if (region) { region.minX = Math.floor(region.minX); region.minY = Math.floor(region.minY); region.maxX = Math.ceil(region.maxX); region.maxY = Math.ceil(region.maxY); var clipView = this.get('clipView'); // 自动裁剪不在 view 内的区域 if (clipView) { region = draw_1.mergeView(region, viewRegion); } } } return region; }; /** * 刷新图形元素,这里仅仅是放入队列,下次绘制时进行绘制 * @param {IElement} element 图形元素 */ Canvas.prototype.refreshElement = function (element) { var refreshElements = this.get('refreshElements'); refreshElements.push(element); // if (this.get('autoDraw')) { // this._startDraw(); // } }; // 清理还在进行的绘制 Canvas.prototype._clearFrame = function () { var drawFrame = this.get('drawFrame'); if (drawFrame) { // 如果全部渲染时,存在局部渲染,则抛弃掉局部渲染 util_1.clearAnimationFrame(drawFrame); this.set('drawFrame', null); this.set('refreshElements', []); } }; // 手工调用绘制接口 Canvas.prototype.draw = function () { var drawFrame = this.get('drawFrame'); if (this.get('autoDraw') && drawFrame) { return; } this._startDraw(); }; // 绘制所有图形 Canvas.prototype._drawAll = function () { var context = this.get('context'); var element = this.get('el'); var children = this.getChildren(); context.clearRect(0, 0, element.width, element.height); draw_1.applyAttrsToContext(context, this); draw_1.drawChildren(context, children); // 对于 https://github.com/antvis/g/issues/422 的场景,全局渲染的模式下也会记录更新的元素队列,因此全局渲染完后也需要置空 this.set('refreshElements', []); }; // 绘制局部 Canvas.prototype._drawRegion = function () { var context = this.get('context'); var children = this.getChildren(); var region = this._getRefreshRegion(); var refreshElements = this.get('refreshElements'); // 需要注意可能没有 region 的场景 // 一般发生在设置了 localRefresh ,在没有图形发生变化的情况下,用户调用了 draw if (region) { // 清理指定区域 context.clearRect(region.minX, region.minY, region.maxX - region.minX, region.maxY - region.minY); // 保存上下文,设置 clip context.save(); context.beginPath(); context.rect(region.minX, region.minY, region.maxX - region.minX, region.maxY - region.minY); context.clip(); draw_1.applyAttrsToContext(context, this); // 确认更新的元素,这个优化可以提升 10 倍左右的性能,10W 个带有 group 的节点,局部渲染会从 90ms 下降到 5-6 ms draw_1.checkRefresh(this, children, region); // 绘制子元素 draw_1.drawChildren(context, children, region); context.restore(); } else if (refreshElements.length) { // 防止发生改变的 elements 没有 region 的场景,这会发生在多个情况下 // 1. 空的 group // 2. 所有 elements 没有在绘图区域 // 3. group 下面的 elements 隐藏掉 // 如果不进行清理 hasChanged 的状态会不正确 draw_1.clearChanged(refreshElements); } this.set('refreshElements', []); }; // 触发绘制 Canvas.prototype._startDraw = function () { var _this = this; var drawFrame = this.get('drawFrame'); if (!drawFrame) { drawFrame = util_1.requestAnimationFrame(function () { if (_this.get('localRefresh')) { _this._drawRegion(); } else { _this._drawAll(); } _this.set('drawFrame', null); }); this.set('drawFrame', drawFrame); } }; Canvas.prototype.skipDraw = function () { }; return Canvas; }(g_base_1.AbstractCanvas)); exports.default = Canvas; /***/ }), /***/ "./src/group.ts": /*!**********************!*\ !*** ./src/group.ts ***! \**********************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var tslib_1 = __webpack_require__(/*! tslib */ "./node_modules/_tslib@1.13.0@tslib/tslib.es6.js"); var g_base_1 = __webpack_require__(/*! @antv/g-base */ "./node_modules/_@antv_g-base@0.5.0-beta.1@@antv/g-base/esm/index.js"); var Shape = __webpack_require__(/*! ./shape */ "./src/shape/index.ts"); var draw_1 = __webpack_require__(/*! ./util/draw */ "./src/util/draw.ts"); var util_1 = __webpack_require__(/*! @antv/util */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/index.js"); var util_2 = __webpack_require__(/*! ./util/util */ "./src/util/util.ts"); var Group = /** @class */ (function (_super) { tslib_1.__extends(Group, _super); function Group() { return _super !== null && _super.apply(this, arguments) || this; } /** * 一些方法调用会引起画布变化 * @param {ChangeType} changeType 改变的类型 */ Group.prototype.onCanvasChange = function (changeType) { draw_1.refreshElement(this, changeType); }; Group.prototype.getShapeBase = function () { return Shape; }; Group.prototype.getGroupBase = function () { return Group; }; // 同 shape 中的方法重复了 Group.prototype._applyClip = function (context, clip) { if (clip) { context.save(); // 将 clip 的属性挂载到 context 上 draw_1.applyAttrsToContext(context, clip); // 绘制 clip 路径 clip.createPath(context); context.restore(); // 裁剪 context.clip(); clip._afterDraw(); } }; // 这个方法以前直接使用的 getCanvasBBox,由于 group 上没有缓存,所以每次重新计算,导致性能开销比较大 // 大概能够节省全局渲染 15-20% 的性能,如果不在这里加缓存优化后 10W 个节点无法达到 5-6 ms,大概能够 30-40ms Group.prototype.cacheCanvasBBox = function () { var children = this.cfg.children; var xArr = []; var yArr = []; util_1.each(children, function (child) { var bbox = child.cfg.cacheCanvasBBox; // isInview 的判定是一旦图形或者分组渲染就要计算是否在视图内, // 这个判定 10W 个图形下差不多能够节省 5-6 ms 的开销 if (bbox && child.cfg.isInView) { xArr.push(bbox.minX, bbox.maxX); yArr.push(bbox.minY, bbox.maxY); } }); var bbox = null; if (xArr.length) { var minX = Math.min.apply(null, xArr); var maxX = Math.max.apply(null, xArr); var minY = Math.min.apply(null, yArr); var maxY = Math.max.apply(null, yArr); bbox = { minX: minX, minY: minY, x: minX, y: minY, maxX: maxX, maxY: maxY, width: maxX - minX, height: maxY - minY, }; var canvas = this.cfg.canvas; if (canvas) { var viewRange = canvas.getViewRange(); // 如果这个地方判定 isInView == false 设置 bbox 为 false 的话,拾取的性能会更高 // 但是目前 10W 图形的拾取在 2-5ms 内,这个优化意义不大,可以后期观察再看 this.set('isInView', util_2.intersectRect(bbox, viewRange)); } } else { this.set('isInView', false); } this.set('cacheCanvasBBox', bbox); }; Group.prototype.draw = function (context, region) { var children = this.cfg.children; var allowDraw = region ? this.cfg.refresh : true; // 局部刷新需要判定 // 这个地方需要判定,在 G6 的场景每个 group 都有 transform 的场景下性能会开销非常大 // 通过 refresh 的判定,可以不刷新没有发生过变化的分组,不在视窗内的分组等等 // 如果想进一步提升局部渲染性能,可以进一步优化 refresh 的判定,依然有潜力 if (children.length && allowDraw) { context.save(); // group 上的矩阵和属性也会应用到上下文上 // 先将 attrs 应用到上下文中,再设置 clip。因为 clip 应该被当前元素的 matrix 所影响 draw_1.applyAttrsToContext(context, this); this._applyClip(context, this.getClip()); draw_1.drawChildren(context, children, region); context.restore(); this.cacheCanvasBBox(); } // 这里的成本比较大,如果不绘制则不再 // this.set('cacheCanvasBBox', this.getCanvasBBox()); this.cfg.refresh = null; // 绘制后,消除更新标记 this.set('hasChanged', false); }; // 绘制时被跳过,一般发生在分组隐藏时 Group.prototype.skipDraw = function () { this.set('cacheCanvasBBox', null); this.set('hasChanged', false); }; return Group; }(g_base_1.AbstractGroup)); exports.default = Group; /***/ }), /***/ "./src/index.ts": /*!**********************!*\ !*** ./src/index.ts ***! \**********************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Shape = exports.version = void 0; var tslib_1 = __webpack_require__(/*! tslib */ "./node_modules/_tslib@1.13.0@tslib/tslib.es6.js"); var Shape = __webpack_require__(/*! ./shape */ "./src/shape/index.ts"); exports.Shape = Shape; var pkg = __webpack_require__(/*! ../package.json */ "./package.json"); exports.version = pkg.version; tslib_1.__exportStar(__webpack_require__(/*! ./types */ "./src/types.ts"), exports); tslib_1.__exportStar(__webpack_require__(/*! ./interfaces */ "./src/interfaces.ts"), exports); var g_base_1 = __webpack_require__(/*! @antv/g-base */ "./node_modules/_@antv_g-base@0.5.0-beta.1@@antv/g-base/esm/index.js"); Object.defineProperty(exports, "Event", { enumerable: true, get: function () { return g_base_1.Event; } }); var canvas_1 = __webpack_require__(/*! ./canvas */ "./src/canvas.ts"); Object.defineProperty(exports, "Canvas", { enumerable: true, get: function () { return canvas_1.default; } }); var group_1 = __webpack_require__(/*! ./group */ "./src/group.ts"); Object.defineProperty(exports, "Group", { enumerable: true, get: function () { return group_1.default; } }); /***/ }), /***/ "./src/interfaces.ts": /*!***************************!*\ !*** ./src/interfaces.ts ***! \***************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var tslib_1 = __webpack_require__(/*! tslib */ "./node_modules/_tslib@1.13.0@tslib/tslib.es6.js"); // 导出 g-base 中的 interfaces tslib_1.__exportStar(__webpack_require__(/*! @antv/g-base/lib/interfaces */ "./node_modules/_@antv_g-base@0.5.0-beta.1@@antv/g-base/lib/interfaces.js"), exports); /***/ }), /***/ "./src/shape/base.ts": /*!***************************!*\ !*** ./src/shape/base.ts ***! \***************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var tslib_1 = __webpack_require__(/*! tslib */ "./node_modules/_tslib@1.13.0@tslib/tslib.es6.js"); var g_base_1 = __webpack_require__(/*! @antv/g-base */ "./node_modules/_@antv_g-base@0.5.0-beta.1@@antv/g-base/esm/index.js"); var util_1 = __webpack_require__(/*! ../util/util */ "./src/util/util.ts"); var draw_1 = __webpack_require__(/*! ../util/draw */ "./src/util/draw.ts"); var index_1 = __webpack_require__(/*! @antv/g-base/lib/bbox/index */ "./node_modules/_@antv_g-base@0.5.0-beta.1@@antv/g-base/lib/bbox/index.js"); var Shape = __webpack_require__(/*! ./index */ "./src/shape/index.ts"); var group_1 = __webpack_require__(/*! ../group */ "./src/group.ts"); var ShapeBase = /** @class */ (function (_super) { tslib_1.__extends(ShapeBase, _super); function ShapeBase() { return _super !== null && _super.apply(this, arguments) || this; } ShapeBase.prototype.getDefaultAttrs = function () { var attrs = _super.prototype.getDefaultAttrs.call(this); // 设置默认值 return tslib_1.__assign(tslib_1.__assign({}, attrs), { lineWidth: 1, lineAppendWidth: 0, strokeOpacity: 1, fillOpacity: 1 }); }; ShapeBase.prototype.getShapeBase = function () { return Shape; }; ShapeBase.prototype.getGroupBase = function () { return group_1.default; }; /** * 一些方法调用会引起画布变化 * @param {ChangeType} changeType 改变的类型 */ ShapeBase.prototype.onCanvasChange = function (changeType) { draw_1.refreshElement(this, changeType); }; ShapeBase.prototype.calculateBBox = function () { var type = this.get('type'); var lineWidth = this.getHitLineWidth(); // const attrs = this.attr(); var bboxMethod = index_1.getBBoxMethod(type); var box = bboxMethod(this); var halfLineWidth = lineWidth / 2; var minX = box.x - halfLineWidth; var minY = box.y - halfLineWidth; var maxX = box.x + box.width + halfLineWidth; var maxY = box.y + box.height + halfLineWidth; return { x: minX, minX: minX, y: minY, minY: minY, width: box.width + lineWidth, height: box.height + lineWidth, maxX: maxX, maxY: maxY, }; }; ShapeBase.prototype.isFill = function () { return !!this.attrs['fill'] || this.isClipShape(); }; ShapeBase.prototype.isStroke = function () { return !!this.attrs['stroke']; }; // 同 shape 中的方法重复了 ShapeBase.prototype._applyClip = function (context, clip) { if (clip) { context.save(); // 将 clip 的属性挂载到 context 上 draw_1.applyAttrsToContext(context, clip); // 绘制 clip 路径 clip.createPath(context); context.restore(); // 裁剪 context.clip(); clip._afterDraw(); } }; // 绘制图形时需要考虑 region 限制 ShapeBase.prototype.draw = function (context, region) { var clip = this.cfg.clipShape; // 如果指定了 region,同时不允许刷新时,直接返回 if (region) { if (this.cfg.refresh === false) { // this._afterDraw(); this.set('hasChanged', false); return; } // 是否相交需要考虑 clip 的包围盒 var bbox = this.getCanvasBBox(); if (!util_1.intersectRect(region, bbox)) { this.set('hasChanged', false); // 存在多种情形需要更新 cacheCanvasBBox 和 isInview 的判定 // 1. 之前图形在视窗内,但是现在不再视窗内 // 2. 如果当前的图形以及父元素都没有发生过变化,refresh = false 不会走到这里,所以这里的图形都是父元素发生变化,但是没有在视图内的元素 if (this.cfg.isInView) { this._afterDraw(); } return; } } context.save(); // 先将 attrs 应用到上下文中,再设置 clip。因为 clip 应该被当前元素的 matrix 所影响 draw_1.applyAttrsToContext(context, this); this._applyClip(context, clip); this.drawPath(context); context.restore(); this._afterDraw(); }; ShapeBase.prototype.getCanvasViewBox = function () { var canvas = this.cfg.canvas; if (canvas) { // @ts-ignore return canvas.getViewRange(); } return null; }; ShapeBase.prototype.cacheCanvasBBox = function () { var canvasBBox = this.getCanvasViewBox(); // 绘制的时候缓存包围盒 if (canvasBBox) { var bbox = this.getCanvasBBox(); var isInView = util_1.intersectRect(bbox, canvasBBox); this.set('isInView', isInView); // 不再视窗内 cacheCanvasBBox 设置成 null,会提升局部渲染的性能, // 因为在局部渲染影响的包围盒计算时不考虑这个图形的包围盒 // 父元素 cacheCanvasBBox 计算的时候也不计算 if (isInView) { this.set('cacheCanvasBBox', bbox); } else { this.set('cacheCanvasBBox', null); } } }; ShapeBase.prototype._afterDraw = function () { this.cacheCanvasBBox(); // 绘制后消除标记 this.set('hasChanged', false); this.set('refresh', null); }; ShapeBase.prototype.skipDraw = function () { this.set('cacheCanvasBBox', null); this.set('isInView', null); this.set('hasChanged', false); }; /** * 绘制图形的路径 * @param {CanvasRenderingContext2D} context 上下文 */ ShapeBase.prototype.drawPath = function (context) { this.createPath(context); this.strokeAndFill(context); this.afterDrawPath(context); }; /** * @protected * 填充图形 * @param {CanvasRenderingContext2D} context context 上下文 */ ShapeBase.prototype.fill = function (context) { context.fill(); }; /** * @protected * 绘制图形边框 * @param {CanvasRenderingContext2D} context context 上下文 */ ShapeBase.prototype.stroke = function (context) { context.stroke(); }; // 绘制或者填充 ShapeBase.prototype.strokeAndFill = function (context) { var _a = this.attrs, lineWidth = _a.lineWidth, opacity = _a.opacity, strokeOpacity = _a.strokeOpacity, fillOpacity = _a.fillOpacity; if (this.isFill()) { if (!util_1.isNil(fillOpacity) && fillOpacity !== 1) { context.globalAlpha = fillOpacity; this.fill(context); context.globalAlpha = opacity; } else { this.fill(context); } } if (this.isStroke()) { if (lineWidth > 0) { if (!util_1.isNil(strokeOpacity) && strokeOpacity !== 1) { context.globalAlpha = strokeOpacity; } this.stroke(context); } } this.afterDrawPath(context); }; /** * @protected * 绘制图形的路径 * @param {CanvasRenderingContext2D} context 上下文 */ ShapeBase.prototype.createPath = function (context) { }; /** * 绘制完成 path 后的操作 * @param {CanvasRenderingContext2D} context 上下文 */ ShapeBase.prototype.afterDrawPath = function (context) { }; ShapeBase.prototype.isInShape = function (refX, refY) { // return HitUtil.isHitShape(this, refX, refY); var isStroke = this.isStroke(); var isFill = this.isFill(); var lineWidth = this.getHitLineWidth(); return this.isInStrokeOrPath(refX, refY, isStroke, isFill, lineWidth); }; // 之所以不拆成 isInStroke 和 isInPath 在于两者存在一些共同的计算 ShapeBase.prototype.isInStrokeOrPath = function (x, y, isStroke, isFill, lineWidth) { return false; }; /** * 获取线拾取的宽度 * @returns {number} 线的拾取宽度 */ ShapeBase.prototype.getHitLineWidth = function () { if (!this.isStroke()) { return 0; } var attrs = this.attrs; return attrs['lineWidth'] + attrs['lineAppendWidth']; }; return ShapeBase; }(g_base_1.AbstractShape)); exports.default = ShapeBase; /***/ }), /***/ "./src/shape/circle.ts": /*!*****************************!*\ !*** ./src/shape/circle.ts ***! \*****************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /** * @fileoverview 圆 * @author dxq613@gmail.com */ Object.defineProperty(exports, "__esModule", { value: true }); var tslib_1 = __webpack_require__(/*! tslib */ "./node_modules/_tslib@1.13.0@tslib/tslib.es6.js"); var base_1 = __webpack_require__(/*! ./base */ "./src/shape/base.ts"); var util_1 = __webpack_require__(/*! ../util/util */ "./src/util/util.ts"); // TODO: 暂时不需要圆的工具方法,后续如果需要支持 pointAt,tangentAngle 时再引入 // import CircleUtil from '@antv/g-math/lib/circle'; var Circle = /** @class */ (function (_super) { tslib_1.__extends(Circle, _super); function Circle() { return _super !== null && _super.apply(this, arguments) || this; } Circle.prototype.getDefaultAttrs = function () { var attrs = _super.prototype.getDefaultAttrs.call(this); return tslib_1.__assign(tslib_1.__assign({}, attrs), { x: 0, y: 0, r: 0 }); }; Circle.prototype.isInStrokeOrPath = function (x, y, isStroke, isFill, lineWidth) { var attrs = this.attr(); var cx = attrs.x; var cy = attrs.y; var r = attrs.r; var halfLineWidth = lineWidth / 2; var absDistance = util_1.distance(cx, cy, x, y); // 直接用距离,如果同时存在边和填充时,可以减少两次计算 if (isFill && isStroke) { return absDistance <= r + halfLineWidth; } if (isFill) { return absDistance <= r; } if (isStroke) { return absDistance >= r - halfLineWidth && absDistance <= r + halfLineWidth; } return false; }; Circle.prototype.createPath = function (context) { var attrs = this.attr(); var cx = attrs.x; var cy = attrs.y; var r = attrs.r; context.beginPath(); context.arc(cx, cy, r, 0, Math.PI * 2, false); context.closePath(); }; return Circle; }(base_1.default)); exports.default = Circle; /***/ }), /***/ "./src/shape/ellipse.ts": /*!******************************!*\ !*** ./src/shape/ellipse.ts ***! \******************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /** * @fileoverview 椭圆 * @author dxq613@gmail.com */ Object.defineProperty(exports, "__esModule", { value: true }); var tslib_1 = __webpack_require__(/*! tslib */ "./node_modules/_tslib@1.13.0@tslib/tslib.es6.js"); var base_1 = __webpack_require__(/*! ./base */ "./src/shape/base.ts"); // 暂时不需要 // import EllipseUtil from '@antv/g-math/lib/ellipse'; // 根据椭圆公式计算 x*x/rx*rx + y*y/ry*ry; function ellipseDistance(squareX, squareY, rx, ry) { return squareX / (rx * rx) + squareY / (ry * ry); } var Ellipse = /** @class */ (function (_super) { tslib_1.__extends(Ellipse, _super); function Ellipse() { return _super !== null && _super.apply(this, arguments) || this; } Ellipse.prototype.getDefaultAttrs = function () { var attrs = _super.prototype.getDefaultAttrs.call(this); return tslib_1.__assign(tslib_1.__assign({}, attrs), { x: 0, y: 0, rx: 0, ry: 0 }); }; Ellipse.prototype.isInStrokeOrPath = function (x, y, isStroke, isFill, lineWidth) { var attrs = this.attr(); var halfLineWith = lineWidth / 2; var cx = attrs.x; var cy = attrs.y; var rx = attrs.rx, ry = attrs.ry; var squareX = (x - cx) * (x - cx); var squareY = (y - cy) * (y - cy); // 使用椭圆的公式: x*x/rx*rx + y*y/ry*ry = 1; if (isFill && isStroke) { return ellipseDistance(squareX, squareY, rx + halfLineWith, ry + halfLineWith) <= 1; } if (isFill) { return ellipseDistance(squareX, squareY, rx, ry) <= 1; } if (isStroke) { return (ellipseDistance(squareX, squareY, rx - halfLineWith, ry - halfLineWith) >= 1 && ellipseDistance(squareX, squareY, rx + halfLineWith, ry + halfLineWith) <= 1); } return false; }; Ellipse.prototype.createPath = function (context) { var attrs = this.attr(); var cx = attrs.x; var cy = attrs.y; var rx = attrs.rx; var ry = attrs.ry; context.beginPath(); // 兼容逻辑 if (context.ellipse) { context.ellipse(cx, cy, rx, ry, 0, 0, Math.PI * 2, false); } else { // 如果不支持,则使用圆来绘制,进行变形 var r = rx > ry ? rx : ry; var scaleX = rx > ry ? 1 : rx / ry; var scaleY = rx > ry ? ry / rx : 1; context.save(); context.translate(cx, cy); context.scale(scaleX, scaleY); context.arc(0, 0, r, 0, Math.PI * 2); context.restore(); context.closePath(); } }; return Ellipse; }(base_1.default)); exports.default = Ellipse; /***/ }), /***/ "./src/shape/image.ts": /*!****************************!*\ !*** ./src/shape/image.ts ***! \****************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /** * @fileoverview 图片 * @author dxq613@gmail.com */ Object.defineProperty(exports, "__esModule", { value: true }); var tslib_1 = __webpack_require__(/*! tslib */ "./node_modules/_tslib@1.13.0@tslib/tslib.es6.js"); var base_1 = __webpack_require__(/*! ./base */ "./src/shape/base.ts"); var util_1 = __webpack_require__(/*! ../util/util */ "./src/util/util.ts"); function isCanvas(dom) { return dom instanceof HTMLElement && util_1.isString(dom.nodeName) && dom.nodeName.toUpperCase() === 'CANVAS'; } var ImageShape = /** @class */ (function (_super) { tslib_1.__extends(ImageShape, _super); function ImageShape() { return _super !== null && _super.apply(this, arguments) || this; } ImageShape.prototype.getDefaultAttrs = function () { var attrs = _super.prototype.getDefaultAttrs.call(this); return tslib_1.__assign(tslib_1.__assign({}, attrs), { x: 0, y: 0, width: 0, height: 0 }); }; ImageShape.prototype.initAttrs = function (attrs) { this._setImage(attrs.img); }; // image 不计算 stroke ImageShape.prototype.isStroke = function () { return false; }; // 仅仅使用包围盒检测来进行拾取 // 所以不需要复写 isInStrokeOrPath 的方法 ImageShape.prototype.isOnlyHitBox = function () { return true; }; ImageShape.prototype._afterLoading = function () { if (this.get('toDraw') === true) { var canvas = this.get('canvas'); if (canvas) { // 这段应该改成局部渲染 canvas.draw(); } else { // 这种方式如果发生遮挡会出现问题 this.createPath(this.get('context')); } } }; ImageShape.prototype._setImage = function (img) { var _this = this; var attrs = this.attrs; if (util_1.isString(img)) { var image_1 = new Image(); image_1.onload = function () { // 图片未加载完,则已经被销毁 if (_this.destroyed) { return false; } // 缓存原始地址,可以做对比,防止重复加载图片 // 如果考虑到在加载过程中可能替换 img 属性,则情况更加复杂 // this.set('imgSrc', img); // 这里会循环调用 _setImage 方法,但不会再走这个分支 _this.attr('img', image_1); _this.set('loading', false); _this._afterLoading(); var callback = _this.get('callback'); if (callback) { callback.call(_this); } }; image_1.src = img; // 设置跨域 image_1.crossOrigin = 'Anonymous'; // loading 过程中不绘制 this.set('loading', true); } else if (img instanceof Image) { // 如果是一个 image 对象,则设置宽高 if (!attrs.width) { attrs.width = img.width; } if (!attrs.height) { attrs.height = img.height; } } else if (isCanvas(img)) { // 如果设置了 canvas 对象 if (!attrs.width) { attrs.width = Number(img.getAttribute('width')); } if (!attrs.height) { attrs.height, Number(img.getAttribute('height')); } } }; ImageShape.prototype.onAttrChange = function (name, value, originValue) { _super.prototype.onAttrChange.call(this, name, value, originValue); // 如果加载的已经是当前图片,则不再处理 if (name === 'img') { // 可以加缓冲,&& this.get('imgSrc') !== value this._setImage(value); } }; ImageShape.prototype.createPath = function (context) { // 正在加载则不绘制 if (this.get('loading')) { this.set('toDraw', true); // 加载完成后绘制 this.set('context', context); return; } var attrs = this.attr(); var x = attrs.x, y = attrs.y, width = attrs.width, height = attrs.height, sx = attrs.sx, sy = attrs.sy, swidth = attrs.swidth, sheight = attrs.sheight; var img = attrs.img; if (img instanceof Image || isCanvas(img)) { if (!util_1.isNil(sx) && !util_1.isNil(sy) && !util_1.isNil(swidth) && !util_1.isNil(sheight)) { context.drawImage(img, sx, sy, swidth, sheight, x, y, width, height); } else { context.drawImage(img, x, y, width, height); } } }; return ImageShape; }(base_1.default)); exports.default = ImageShape; /***/ }), /***/ "./src/shape/index.ts": /*!****************************!*\ !*** ./src/shape/index.ts ***! \****************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var base_1 = __webpack_require__(/*! ./base */ "./src/shape/base.ts"); Object.defineProperty(exports, "Base", { enumerable: true, get: function () { return base_1.default; } }); var circle_1 = __webpack_require__(/*! ./circle */ "./src/shape/circle.ts"); Object.defineProperty(exports, "Circle", { enumerable: true, get: function () { return circle_1.default; } }); var ellipse_1 = __webpack_require__(/*! ./ellipse */ "./src/shape/ellipse.ts"); Object.defineProperty(exports, "Ellipse", { enumerable: true, get: function () { return ellipse_1.default; } }); var image_1 = __webpack_require__(/*! ./image */ "./src/shape/image.ts"); Object.defineProperty(exports, "Image", { enumerable: true, get: function () { return image_1.default; } }); var line_1 = __webpack_require__(/*! ./line */ "./src/shape/line.ts"); Object.defineProperty(exports, "Line", { enumerable: true, get: function () { return line_1.default; } }); var marker_1 = __webpack_require__(/*! ./marker */ "./src/shape/marker.ts"); Object.defineProperty(exports, "Marker", { enumerable: true, get: function () { return marker_1.default; } }); var path_1 = __webpack_require__(/*! ./path */ "./src/shape/path.ts"); Object.defineProperty(exports, "Path", { enumerable: true, get: function () { return path_1.default; } }); var polygon_1 = __webpack_require__(/*! ./polygon */ "./src/shape/polygon.ts"); Object.defineProperty(exports, "Polygon", { enumerable: true, get: function () { return polygon_1.default; } }); var polyline_1 = __webpack_require__(/*! ./polyline */ "./src/shape/polyline.ts"); Object.defineProperty(exports, "Polyline", { enumerable: true, get: function () { return polyline_1.default; } }); var rect_1 = __webpack_require__(/*! ./rect */ "./src/shape/rect.ts"); Object.defineProperty(exports, "Rect", { enumerable: true, get: function () { return rect_1.default; } }); var text_1 = __webpack_require__(/*! ./text */ "./src/shape/text.ts"); Object.defineProperty(exports, "Text", { enumerable: true, get: function () { return text_1.default; } }); /***/ }), /***/ "./src/shape/line.ts": /*!***************************!*\ !*** ./src/shape/line.ts ***! \***************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var tslib_1 = __webpack_require__(/*! tslib */ "./node_modules/_tslib@1.13.0@tslib/tslib.es6.js"); /** * @fileoverview 圆 * @author dxq613@gmail.com */ var line_1 = __webpack_require__(/*! @antv/g-math/lib/line */ "./node_modules/_@antv_g-math@0.1.3@@antv/g-math/lib/line.js"); var base_1 = __webpack_require__(/*! ./base */ "./src/shape/base.ts"); var line_2 = __webpack_require__(/*! ../util/in-stroke/line */ "./src/util/in-stroke/line.ts"); var ArrowUtil = __webpack_require__(/*! ../util/arrow */ "./src/util/arrow.ts"); var Line = /** @class */ (function (_super) { tslib_1.__extends(Line, _super); function Line() { return _super !== null && _super.apply(this, arguments) || this; } Line.prototype.getDefaultAttrs = function () { var attrs = _super.prototype.getDefaultAttrs.call(this); return tslib_1.__assign(tslib_1.__assign({}, attrs), { x1: 0, y1: 0, x2: 0, y2: 0, startArrow: false, endArrow: false }); }; Line.prototype.initAttrs = function (attrs) { this.setArrow(); }; // 更新属性时,检测是否更改了箭头 Line.prototype.onAttrChange = function (name, value, originValue) { _super.prototype.onAttrChange.call(this, name, value, originValue); // 由于箭头的绘制依赖于 line 的诸多 attrs,因此这里不再对每个 attr 进行判断,attr 每次变化都会影响箭头的更新 this.setArrow(); }; Line.prototype.setArrow = function () { var attrs = this.attr(); var x1 = attrs.x1, y1 = attrs.y1, x2 = attrs.x2, y2 = attrs.y2, startArrow = attrs.startArrow, endArrow = attrs.endArrow; if (startArrow) { ArrowUtil.addStartArrow(this, attrs, x2, y2, x1, y1); } if (endArrow) { ArrowUtil.addEndArrow(this, attrs, x1, y1, x2, y2); } }; Line.prototype.isInStrokeOrPath = function (x, y, isStroke, isFill, lineWidth) { if (!isStroke || !lineWidth) { return false; } var _a = this.attr(), x1 = _a.x1, y1 = _a.y1, x2 = _a.x2, y2 = _a.y2; return line_2.default(x1, y1, x2, y2, lineWidth, x, y); }; Line.prototype.createPath = function (context) { var attrs = this.attr(); var x1 = attrs.x1, y1 = attrs.y1, x2 = attrs.x2, y2 = attrs.y2, startArrow = attrs.startArrow, endArrow = attrs.endArrow; var startArrowDistance = { dx: 0, dy: 0, }; var endArrowDistance = { dx: 0, dy: 0, }; if (startArrow && startArrow.d) { startArrowDistance = ArrowUtil.getShortenOffset(x1, y1, x2, y2, attrs.startArrow.d); } if (endArrow && endArrow.d) { endArrowDistance = ArrowUtil.getShortenOffset(x1, y1, x2, y2, attrs.endArrow.d); } context.beginPath(); // 如果自定义箭头,线条相应缩进 context.moveTo(x1 + startArrowDistance.dx, y1 + startArrowDistance.dy); context.lineTo(x2 - endArrowDistance.dx, y2 - endArrowDistance.dy); }; Line.prototype.afterDrawPath = function (context) { var startArrowShape = this.get('startArrowShape'); var endArrowShape = this.get('endArrowShape'); if (startArrowShape) { startArrowShape.draw(context); } if (endArrowShape) { endArrowShape.draw(context); } }; /** * Get length of line * @return {number} length */ Line.prototype.getTotalLength = function () { var _a = this.attr(), x1 = _a.x1, y1 = _a.y1, x2 = _a.x2, y2 = _a.y2; return line_1.default.length(x1, y1, x2, y2); }; /** * Get point according to ratio * @param {number} ratio * @return {Point} point */ Line.prototype.getPoint = function (ratio) { var _a = this.attr(), x1 = _a.x1, y1 = _a.y1, x2 = _a.x2, y2 = _a.y2; return line_1.default.pointAt(x1, y1, x2, y2, ratio); }; return Line; }(base_1.default)); exports.default = Line; /***/ }), /***/ "./src/shape/marker.ts": /*!*****************************!*\ !*** ./src/shape/marker.ts ***! \*****************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /** * @fileoverview Marker * @author dxq613@gmail.com */ Object.defineProperty(exports, "__esModule", { value: true }); var tslib_1 = __webpack_require__(/*! tslib */ "./node_modules/_tslib@1.13.0@tslib/tslib.es6.js"); var util_1 = __webpack_require__(/*! @antv/util */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/index.js"); var path_2_absolute_1 = __webpack_require__(/*! @antv/path-util/lib/path-2-absolute */ "./node_modules/_@antv_path-util@2.0.8@@antv/path-util/lib/path-2-absolute.js"); var base_1 = __webpack_require__(/*! ./base */ "./src/shape/base.ts"); var util_2 = __webpack_require__(/*! ../util/util */ "./src/util/util.ts"); var draw_1 = __webpack_require__(/*! ../util/draw */ "./src/util/draw.ts"); var Symbols = { // 圆 circle: function (x, y, r) { return [ ['M', x - r, y], ['A', r, r, 0, 1, 0, x + r, y], ['A', r, r, 0, 1, 0, x - r, y], ]; }, // 正方形 square: function (x, y, r) { return [['M', x - r, y - r], ['L', x + r, y - r], ['L', x + r, y + r], ['L', x - r, y + r], ['Z']]; }, // 菱形 diamond: function (x, y, r) { return [['M', x - r, y], ['L', x, y - r], ['L', x + r, y], ['L', x, y + r], ['Z']]; }, // 三角形 triangle: function (x, y, r) { var diffY = r * Math.sin((1 / 3) * Math.PI); return [['M', x - r, y + diffY], ['L', x, y - diffY], ['L', x + r, y + diffY], ['Z']]; }, // 倒三角形 'triangle-down': function (x, y, r) { var diffY = r * Math.sin((1 / 3) * Math.PI); return [['M', x - r, y - diffY], ['L', x + r, y - diffY], ['L', x, y + diffY], ['Z']]; }, }; var Marker = /** @class */ (function (_super) { tslib_1.__extends(Marker, _super); function Marker() { return _super !== null && _super.apply(this, arguments) || this; } Marker.prototype.initAttrs = function (attrs) { this._resetParamsCache(); }; // 重置绘制 path 存储的缓存 Marker.prototype._resetParamsCache = function () { // 为了加速 path 的绘制、拾取和计算,这个地方可以缓存很多东西 // 这些缓存都是第一次需要时计算和存储,虽然增加了复杂度,但是频繁调用的方法,性能有很大提升 this.set('paramsCache', {}); // 清理缓存 }; // 更新属性时,检测是否更改了 path Marker.prototype.onAttrChange = function (name, value, originValue) { _super.prototype.onAttrChange.call(this, name, value, originValue); if (['symbol', 'x', 'y', 'r', 'radius'].indexOf(name) !== -1) { // path 相关属性更改时,清理缓存 this._resetParamsCache(); } }; // 仅仅使用包围盒检测来进行拾取 // 所以不需要复写 isInStrokeOrPath 的方法 Marker.prototype.isOnlyHitBox = function () { return true; }; Marker.prototype._getR = function (attrs) { // 兼容 r 和 radius 两种写法,推荐使用 r return util_1.isNil(attrs.r) ? attrs.radius : attrs.r; }; Marker.prototype._getPath = function () { var attrs = this.attr(); var x = attrs.x, y = attrs.y; var symbol = attrs.symbol || 'circle'; var r = this._getR(attrs); var method; var path; if (util_2.isFunction(symbol)) { method = symbol; path = method(x, y, r); // 将 path 转成绝对路径 path = path_2_absolute_1.default(path); } else { // 内置 symbol 的 path 都是绝对路径,直接绘制即可,不需要对 path 进行特殊处理 method = Marker.Symbols[symbol]; path = method(x, y, r); } if (!method) { console.warn(symbol + " marker is not supported."); return null; } return path; }; Marker.prototype.createPath = function (context) { var path = this._getPath(); var paramsCache = this.get('paramsCache'); draw_1.drawPath(this, context, { path: path }, paramsCache); }; Marker.Symbols = Symbols; return Marker; }(base_1.default)); exports.default = Marker; /***/ }), /***/ "./src/shape/path.ts": /*!***************************!*\ !*** ./src/shape/path.ts ***! \***************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var tslib_1 = __webpack_require__(/*! tslib */ "./node_modules/_tslib@1.13.0@tslib/tslib.es6.js"); var cubic_1 = __webpack_require__(/*! @antv/g-math/lib/cubic */ "./node_modules/_@antv_g-math@0.1.3@@antv/g-math/lib/cubic.js"); var util_1 = __webpack_require__(/*! @antv/util */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/index.js"); var base_1 = __webpack_require__(/*! ./base */ "./src/shape/base.ts"); var path_2_absolute_1 = __webpack_require__(/*! @antv/path-util/lib/path-2-absolute */ "./node_modules/_@antv_path-util@2.0.8@@antv/path-util/lib/path-2-absolute.js"); var path_2_segments_1 = __webpack_require__(/*! @antv/path-util/lib/path-2-segments */ "./node_modules/_@antv_path-util@2.0.8@@antv/path-util/lib/path-2-segments.js"); var draw_1 = __webpack_require__(/*! ../util/draw */ "./src/util/draw.ts"); var point_in_path_1 = __webpack_require__(/*! ../util/in-path/point-in-path */ "./src/util/in-path/point-in-path.ts"); var polygon_1 = __webpack_require__(/*! ../util/in-path/polygon */ "./src/util/in-path/polygon.ts"); var path_1 = __webpack_require__(/*! ../util/path */ "./src/util/path.ts"); var ArrowUtil = __webpack_require__(/*! ../util/arrow */ "./src/util/arrow.ts"); // 是否在多个多边形内部 function isInPolygons(polygons, x, y) { var isHit = false; for (var i = 0; i < polygons.length; i++) { var points = polygons[i]; isHit = polygon_1.default(points, x, y); if (isHit) { break; } } return isHit; } var Path = /** @class */ (function (_super) { tslib_1.__extends(Path, _super); function Path() { return _super !== null && _super.apply(this, arguments) || this; } Path.prototype.getDefaultAttrs = function () { var attrs = _super.prototype.getDefaultAttrs.call(this); return tslib_1.__assign(tslib_1.__assign({}, attrs), { startArrow: false, endArrow: false }); }; Path.prototype.initAttrs = function (attrs) { this._setPathArr(attrs.path); this.setArrow(); }; // 更新属性时,检测是否更改了 path Path.prototype.onAttrChange = function (name, value, originValue) { _super.prototype.onAttrChange.call(this, name, value, originValue); if (name === 'path') { this._setPathArr(value); } // 由于箭头的绘制依赖于 line 的诸多 attrs,因此这里不再对每个 attr 进行判断,attr 每次变化都会影响箭头的更新 this.setArrow(); }; // 将 path 转换成绝对路径 Path.prototype._setPathArr = function (path) { // 转换 path 的格式 this.attrs.path = path_2_absolute_1.default(path); var hasArc = path_1.default.hasArc(path); // 为了加速 path 的绘制、拾取和计算,这个地方可以缓存很多东西 // 这些缓存都是第一次需要时计算和存储,虽然增加了复杂度,但是频繁调用的方法,性能有很大提升 this.set('hasArc', hasArc); this.set('paramsCache', {}); // 清理缓存 this.set('segments', null); // 延迟生成 path,在动画场景下可能不会有拾取 this.set('curve', null); this.set('tCache', null); this.set('totalLength', null); }; Path.prototype.getSegments = function () { var segments = this.get('segements'); if (!segments) { segments = path_2_segments_1.default(this.attr('path')); this.set('segments', segments); } return segments; }; Path.prototype.setArrow = function () { var attrs = this.attr(); var startArrow = attrs.startArrow, endArrow = attrs.endArrow; if (startArrow) { var tangent = this.getStartTangent(); ArrowUtil.addStartArrow(this, attrs, tangent[0][0], tangent[0][1], tangent[1][0], tangent[1][1]); } if (endArrow) { var tangent = this.getEndTangent(); ArrowUtil.addEndArrow(this, attrs, tangent[0][0], tangent[0][1], tangent[1][0], tangent[1][1]); } }; Path.prototype.isInStrokeOrPath = function (x, y, isStroke, isFill, lineWidth) { var segments = this.getSegments(); var hasArc = this.get('hasArc'); var isHit = false; if (isStroke) { isHit = path_1.default.isPointInStroke(segments, lineWidth, x, y); } if (!isHit && isFill) { if (hasArc) { // 存在曲线时,暂时使用 canvas 的 api 计算,后续可以进行多边形切割 isHit = point_in_path_1.default(this, x, y); } else { var path = this.attr('path'); var extractResutl = path_1.default.extractPolygons(path); // 提取出来的多边形包含闭合的和非闭合的,在这里统一按照多边形处理 isHit = isInPolygons(extractResutl.polygons, x, y) || isInPolygons(extractResutl.polylines, x, y); } } return isHit; }; Path.prototype.createPath = function (context) { var attrs = this.attr(); var paramsCache = this.get('paramsCache'); // 由于计算圆弧的参数成本很大,所以要缓存 draw_1.drawPath(this, context, attrs, paramsCache); }; Path.prototype.afterDrawPath = function (context) { var startArrowShape = this.get('startArrowShape'); var endArrowShape = this.get('endArrowShape'); if (startArrowShape) { startArrowShape.draw(context); } if (endArrowShape) { endArrowShape.draw(context); } }; /** * Get total length of path * @return {number} length */ Path.prototype.getTotalLength = function () { var totalLength = this.get('totalLength'); if (!util_1.isNil(totalLength)) { return totalLength; } this._calculateCurve(); this._setTcache(); return this.get('totalLength'); }; /** * Get point according to ratio * @param {number} ratio * @return {Point} point */ Path.prototype.getPoint = function (ratio) { var tCache = this.get('tCache'); if (!tCache) { this._calculateCurve(); this._setTcache(); tCache = this.get('tCache'); } var subt; var index; var curve = this.get('curve'); if (!tCache || tCache.length === 0) { if (curve) { return { x: curve[0][1], y: curve[0][2], }; } return null; } util_1.each(tCache, function (v, i) { if (ratio >= v[0] && ratio <= v[1]) { subt = (ratio - v[0]) / (v[1] - v[0]); index = i; } }); var seg = curve[index]; if (util_1.isNil(seg) || util_1.isNil(index)) { return null; } var l = seg.length; var nextSeg = curve[index + 1]; return cubic_1.default.pointAt(seg[l - 2], seg[l - 1], nextSeg[1], nextSeg[2], nextSeg[3], nextSeg[4], nextSeg[5], nextSeg[6], subt); }; Path.prototype._calculateCurve = function () { var path = this.attr().path; this.set('curve', path_1.default.pathToCurve(path)); }; Path.prototype._setTcache = function () { var totalLength = 0; var tempLength = 0; // 每段 curve 对应起止点的长度比例列表,形如: [[0, 0.25], [0.25, 0.6]. [0.6, 0.9], [0.9, 1]] var tCache = []; var segmentT; var segmentL; var segmentN; var l; var curve = this.get('curve'); if (!curve) { return; } util_1.each(curve, function (segment, i) { segmentN = curve[i + 1]; l = segment.length; if (segmentN) { totalLength += cubic_1.default.length(segment[l - 2], segment[l - 1], segmentN[1], segmentN[2], segmentN[3], segmentN[4], segmentN[5], segmentN[6]) || 0; } }); this.set('totalLength', totalLength); if (totalLength === 0) { this.set('tCache', []); return; } util_1.each(curve, function (segment, i) { segmentN = curve[i + 1]; l = segment.length; if (segmentN) { segmentT = []; segmentT[0] = tempLength / totalLength; segmentL = cubic_1.default.length(segment[l - 2], segment[l - 1], segmentN[1], segmentN[2], segmentN[3], segmentN[4], segmentN[5], segmentN[6]); // 当 path 不连续时,segmentL 可能为空,为空时需要作为 0 处理 tempLength += segmentL || 0; segmentT[1] = tempLength / totalLength; tCache.push(segmentT); } }); this.set('tCache', tCache); }; /** * Get start tangent vector * @return {Array} */ Path.prototype.getStartTangent = function () { var segments = this.getSegments(); var result; if (segments.length > 1) { var startPoint = segments[0].currentPoint; var endPoint = segments[1].currentPoint; var tangent = segments[1].startTangent; result = []; if (tangent) { result.push([startPoint[0] - tangent[0], startPoint[1] - tangent[1]]); result.push([startPoint[0], startPoint[1]]); } else { result.push([endPoint[0], endPoint[1]]); result.push([startPoint[0], startPoint[1]]); } } return result; }; /** * Get end tangent vector * @return {Array} */ Path.prototype.getEndTangent = function () { var segments = this.getSegments(); var length = segments.length; var result; if (length > 1) { var startPoint = segments[length - 2].currentPoint; var endPoint = segments[length - 1].currentPoint; var tangent = segments[length - 1].endTangent; result = []; if (tangent) { result.push([endPoint[0] - tangent[0], endPoint[1] - tangent[1]]); result.push([endPoint[0], endPoint[1]]); } else { result.push([startPoint[0], startPoint[1]]); result.push([endPoint[0], endPoint[1]]); } } return result; }; return Path; }(base_1.default)); exports.default = Path; /***/ }), /***/ "./src/shape/polygon.ts": /*!******************************!*\ !*** ./src/shape/polygon.ts ***! \******************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /** * @fileoverview 多边形 * @author dxq613@gmail.com */ Object.defineProperty(exports, "__esModule", { value: true }); var tslib_1 = __webpack_require__(/*! tslib */ "./node_modules/_tslib@1.13.0@tslib/tslib.es6.js"); var base_1 = __webpack_require__(/*! ./base */ "./src/shape/base.ts"); var polyline_1 = __webpack_require__(/*! ../util/in-stroke/polyline */ "./src/util/in-stroke/polyline.ts"); var polygon_1 = __webpack_require__(/*! ../util/in-path/polygon */ "./src/util/in-path/polygon.ts"); var Polygon = /** @class */ (function (_super) { tslib_1.__extends(Polygon, _super); function Polygon() { return _super !== null && _super.apply(this, arguments) || this; } Polygon.prototype.isInStrokeOrPath = function (x, y, isStroke, isFill, lineWidth) { var points = this.attr().points; var isHit = false; if (isStroke) { isHit = polyline_1.default(points, lineWidth, x, y, true); } if (!isHit && isFill) { isHit = polygon_1.default(points, x, y); // isPointInPath(shape, x, y); } return isHit; }; Polygon.prototype.createPath = function (context) { var attrs = this.attr(); var points = attrs.points; if (points.length < 2) { return; } context.beginPath(); for (var i = 0; i < points.length; i++) { var point = points[i]; if (i === 0) { context.moveTo(point[0], point[1]); } else { context.lineTo(point[0], point[1]); } } context.closePath(); }; return Polygon; }(base_1.default)); exports.default = Polygon; /***/ }), /***/ "./src/shape/polyline.ts": /*!*******************************!*\ !*** ./src/shape/polyline.ts ***! \*******************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var tslib_1 = __webpack_require__(/*! tslib */ "./node_modules/_tslib@1.13.0@tslib/tslib.es6.js"); var line_1 = __webpack_require__(/*! @antv/g-math/lib/line */ "./node_modules/_@antv_g-math@0.1.3@@antv/g-math/lib/line.js"); var polyline_1 = __webpack_require__(/*! @antv/g-math/lib/polyline */ "./node_modules/_@antv_g-math@0.1.3@@antv/g-math/lib/polyline.js"); var util_1 = __webpack_require__(/*! @antv/util */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/index.js"); var base_1 = __webpack_require__(/*! ./base */ "./src/shape/base.ts"); var polyline_2 = __webpack_require__(/*! ../util/in-stroke/polyline */ "./src/util/in-stroke/polyline.ts"); var ArrowUtil = __webpack_require__(/*! ../util/arrow */ "./src/util/arrow.ts"); var PolyLine = /** @class */ (function (_super) { tslib_1.__extends(PolyLine, _super); function PolyLine() { return _super !== null && _super.apply(this, arguments) || this; } PolyLine.prototype.getDefaultAttrs = function () { var attrs = _super.prototype.getDefaultAttrs.call(this); return tslib_1.__assign(tslib_1.__assign({}, attrs), { startArrow: false, endArrow: false }); }; PolyLine.prototype.initAttrs = function (attrs) { this.setArrow(); }; // 更新属性时,检测是否更改了 points PolyLine.prototype.onAttrChange = function (name, value, originValue) { _super.prototype.onAttrChange.call(this, name, value, originValue); this.setArrow(); if (['points'].indexOf(name) !== -1) { this._resetCache(); } }; PolyLine.prototype._resetCache = function () { this.set('totalLength', null); this.set('tCache', null); }; PolyLine.prototype.setArrow = function () { var attrs = this.attr(); var _a = this.attrs, points = _a.points, startArrow = _a.startArrow, endArrow = _a.endArrow; var length = points.length; var x1 = points[0][0]; var y1 = points[0][1]; var x2 = points[length - 1][0]; var y2 = points[length - 1][1]; if (startArrow) { ArrowUtil.addStartArrow(this, attrs, points[1][0], points[1][1], x1, y1); } if (endArrow) { ArrowUtil.addEndArrow(this, attrs, points[length - 2][0], points[length - 2][1], x2, y2); } }; // 不允许 fill PolyLine.prototype.isFill = function () { return false; }; PolyLine.prototype.isInStrokeOrPath = function (x, y, isStroke, isFill, lineWidth) { // 没有设置 stroke 不能被拾取, 没有线宽不能被拾取 if (!isStroke || !lineWidth) { return false; } var points = this.attr().points; return polyline_2.default(points, lineWidth, x, y, false); }; // 始终填充 PolyLine.prototype.isStroke = function () { return true; }; PolyLine.prototype.createPath = function (context) { var _a = this.attr(), points = _a.points, startArrow = _a.startArrow, endArrow = _a.endArrow; var length = points.length; if (points.length < 2) { return; } var x1 = points[0][0]; var y1 = points[0][1]; var x2 = points[length - 1][0]; var y2 = points[length - 1][1]; // 如果定义了箭头,并且是自定义箭头,线条相应缩进 if (startArrow && startArrow.d) { var distance = ArrowUtil.getShortenOffset(x1, y1, points[1][0], points[1][1], startArrow.d); x1 += distance.dx; y1 += distance.dy; } if (endArrow && endArrow.d) { var distance = ArrowUtil.getShortenOffset(points[length - 2][0], points[length - 2][1], x2, y2, endArrow.d); x2 -= distance.dx; y2 -= distance.dy; } context.beginPath(); context.moveTo(x1, y1); for (var i = 0; i < length - 1; i++) { var point = points[i]; context.lineTo(point[0], point[1]); } context.lineTo(x2, y2); }; PolyLine.prototype.afterDrawPath = function (context) { var startArrowShape = this.get('startArrowShape'); var endArrowShape = this.get('endArrowShape'); if (startArrowShape) { startArrowShape.draw(context); } if (endArrowShape) { endArrowShape.draw(context); } }; /** * Get length of polyline * @return {number} length */ PolyLine.prototype.getTotalLength = function () { var points = this.attr().points; // get totalLength from cache var totalLength = this.get('totalLength'); if (!util_1.isNil(totalLength)) { return totalLength; } this.set('totalLength', polyline_1.default.length(points)); return this.get('totalLength'); }; /** * Get point according to ratio * @param {number} ratio * @return {Point} point */ PolyLine.prototype.getPoint = function (ratio) { var points = this.attr().points; // get tCache from cache var tCache = this.get('tCache'); if (!tCache) { this._setTcache(); tCache = this.get('tCache'); } var subt; var index; util_1.each(tCache, function (v, i) { if (ratio >= v[0] && ratio <= v[1]) { subt = (ratio - v[0]) / (v[1] - v[0]); index = i; } }); return line_1.default.pointAt(points[index][0], points[index][1], points[index + 1][0], points[index + 1][1], subt); }; PolyLine.prototype._setTcache = function () { var points = this.attr().points; if (!points || points.length === 0) { return; } var totalLength = this.getTotalLength(); if (totalLength <= 0) { return; } var tempLength = 0; var tCache = []; var segmentT; var segmentL; util_1.each(points, function (p, i) { if (points[i + 1]) { segmentT = []; segmentT[0] = tempLength / totalLength; segmentL = line_1.default.length(p[0], p[1], points[i + 1][0], points[i + 1][1]); tempLength += segmentL; segmentT[1] = tempLength / totalLength; tCache.push(segmentT); } }); this.set('tCache', tCache); }; /** * Get start tangent vector * @return {Array} */ PolyLine.prototype.getStartTangent = function () { var points = this.attr().points; var result = []; result.push([points[1][0], points[1][1]]); result.push([points[0][0], points[0][1]]); return result; }; /** * Get end tangent vector * @return {Array} */ PolyLine.prototype.getEndTangent = function () { var points = this.attr().points; var l = points.length - 1; var result = []; result.push([points[l - 1][0], points[l - 1][1]]); result.push([points[l][0], points[l][1]]); return result; }; return PolyLine; }(base_1.default)); exports.default = PolyLine; /***/ }), /***/ "./src/shape/rect.ts": /*!***************************!*\ !*** ./src/shape/rect.ts ***! \***************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /** * @fileoverview 矩形 * @author dxq613@gmail.com */ Object.defineProperty(exports, "__esModule", { value: true }); var tslib_1 = __webpack_require__(/*! tslib */ "./node_modules/_tslib@1.13.0@tslib/tslib.es6.js"); var base_1 = __webpack_require__(/*! ./base */ "./src/shape/base.ts"); var parse_1 = __webpack_require__(/*! ../util/parse */ "./src/util/parse.ts"); var util_1 = __webpack_require__(/*! ../util/util */ "./src/util/util.ts"); var rect_1 = __webpack_require__(/*! ../util/in-stroke/rect */ "./src/util/in-stroke/rect.ts"); var rect_radius_1 = __webpack_require__(/*! ../util/in-stroke/rect-radius */ "./src/util/in-stroke/rect-radius.ts"); var point_in_path_1 = __webpack_require__(/*! ../util/in-path/point-in-path */ "./src/util/in-path/point-in-path.ts"); var Rect = /** @class */ (function (_super) { tslib_1.__extends(Rect, _super); function Rect() { return _super !== null && _super.apply(this, arguments) || this; } Rect.prototype.getDefaultAttrs = function () { var attrs = _super.prototype.getDefaultAttrs.call(this); return tslib_1.__assign(tslib_1.__assign({}, attrs), { x: 0, y: 0, width: 0, height: 0, radius: 0 }); }; Rect.prototype.isInStrokeOrPath = function (x, y, isStroke, isFill, lineWidth) { var attrs = this.attr(); var minX = attrs.x; var minY = attrs.y; var width = attrs.width; var height = attrs.height; var radius = attrs.radius; // 无圆角时的策略 if (!radius) { var halfWidth = lineWidth / 2; // 同时填充和带有边框 if (isFill && isStroke) { return util_1.inBox(minX - halfWidth, minY - halfWidth, width + halfWidth, height + halfWidth, x, y); } // 仅填充 if (isFill) { return util_1.inBox(minX, minY, width, height, x, y); } if (isStroke) { return rect_1.default(minX, minY, width, height, lineWidth, x, y); } } else { var isHit = false; if (isStroke) { isHit = rect_radius_1.default(minX, minY, width, height, radius, lineWidth, x, y); } // 仅填充时带有圆角的矩形直接通过图形拾取 // 以后可以改成纯数学的近似拾取,将圆弧切割成多边形 if (!isHit && isFill) { isHit = point_in_path_1.default(this, x, y); } return isHit; } }; Rect.prototype.createPath = function (context) { var attrs = this.attr(); var x = attrs.x; var y = attrs.y; var width = attrs.width; var height = attrs.height; var radius = attrs.radius; context.beginPath(); if (radius === 0) { // 改成原生的rect方法 context.rect(x, y, width, height); } else { var _a = parse_1.parseRadius(radius), r1 = _a[0], r2 = _a[1], r3 = _a[2], r4 = _a[3]; context.moveTo(x + r1, y); context.lineTo(x + width - r2, y); r2 !== 0 && context.arc(x + width - r2, y + r2, r2, -Math.PI / 2, 0); context.lineTo(x + width, y + height - r3); r3 !== 0 && context.arc(x + width - r3, y + height - r3, r3, 0, Math.PI / 2); context.lineTo(x + r4, y + height); r4 !== 0 && context.arc(x + r4, y + height - r4, r4, Math.PI / 2, Math.PI); context.lineTo(x, y + r1); r1 !== 0 && context.arc(x + r1, y + r1, r1, Math.PI, Math.PI * 1.5); context.closePath(); } }; return Rect; }(base_1.default)); exports.default = Rect; /***/ }), /***/ "./src/shape/text.ts": /*!***************************!*\ !*** ./src/shape/text.ts ***! \***************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /** * @fileoverview 文本 * @author dxq613@gmail.com */ Object.defineProperty(exports, "__esModule", { value: true }); var tslib_1 = __webpack_require__(/*! tslib */ "./node_modules/_tslib@1.13.0@tslib/tslib.es6.js"); var base_1 = __webpack_require__(/*! ./base */ "./src/shape/base.ts"); var util_1 = __webpack_require__(/*! ../util/util */ "./src/util/util.ts"); var text_1 = __webpack_require__(/*! @antv/g-base/lib/util/text */ "./node_modules/_@antv_g-base@0.5.0-beta.1@@antv/g-base/lib/util/text.js"); var Text = /** @class */ (function (_super) { tslib_1.__extends(Text, _super); function Text() { return _super !== null && _super.apply(this, arguments) || this; } // 默认文本属性 Text.prototype.getDefaultAttrs = function () { var attrs = _super.prototype.getDefaultAttrs.call(this); return tslib_1.__assign(tslib_1.__assign({}, attrs), { x: 0, y: 0, text: null, fontSize: 12, fontFamily: 'sans-serif', fontStyle: 'normal', fontWeight: 'normal', fontVariant: 'normal', textAlign: 'start', textBaseline: 'bottom' }); }; // 仅仅使用包围盒检测来进行拾取 Text.prototype.isOnlyHitBox = function () { return true; }; // 初始化时组合 font,同时判断 text 是否换行 Text.prototype.initAttrs = function (attrs) { this._assembleFont(); if (attrs.text) { this._setText(attrs.text); } }; // 组装字体 Text.prototype._assembleFont = function () { var attrs = this.attrs; attrs.font = text_1.assembleFont(attrs); }; // 如果文本换行,则缓存数组 Text.prototype._setText = function (text) { var textArr = null; if (util_1.isString(text) && text.indexOf('\n') !== -1) { textArr = text.split('\n'); } this.set('textArr', textArr); }; // 更新属性时,检测是否更改了 font、text Text.prototype.onAttrChange = function (name, value, originValue) { _super.prototype.onAttrChange.call(this, name, value, originValue); if (name.startsWith('font')) { this._assembleFont(); } if (name === 'text') { this._setText(value); } }; // 这个方法在 text 时没有可以做的事情,如果要支持文字背景时可以考虑 // createPath(context) { // } // 如果文本多行,需要获取文本间距 Text.prototype._getSpaceingY = function () { var attrs = this.attrs; var lineHeight = attrs.lineHeight; var fontSize = attrs.fontSize * 1; return lineHeight ? lineHeight - fontSize : fontSize * 0.14; }; // 绘制文本,考虑多行的场景 Text.prototype._drawTextArr = function (context, textArr, isFill) { var attrs = this.attrs; var textBaseline = attrs.textBaseline; var x = attrs.x; var y = attrs.y; var fontSize = attrs.fontSize * 1; var spaceingY = this._getSpaceingY(); var height = text_1.getTextHeight(attrs.text, attrs.fontSize, attrs.lineHeight); var subY; util_1.each(textArr, function (subText, index) { subY = y + index * (spaceingY + fontSize) - height + fontSize; // bottom; if (textBaseline === 'middle') subY += height - fontSize - (height - fontSize) / 2; if (textBaseline === 'top') subY += height - fontSize; if (isFill) { context.fillText(subText, x, subY); } else { context.strokeText(subText, x, subY); } }); }; // 绘制文本,同时考虑填充和绘制边框 Text.prototype._drawText = function (context, isFill) { var attrs = this.attr(); var x = attrs.x; var y = attrs.y; var textArr = this.get('textArr'); if (textArr) { this._drawTextArr(context, textArr, isFill); } else { var text = attrs.text; if (isFill) { context.fillText(text, x, y); } else { context.strokeText(text, x, y); } } }; // 复写绘制和填充的逻辑:对于文本,应该先绘制边框,再进行填充 Text.prototype.strokeAndFill = function (context) { var _a = this.attrs, lineWidth = _a.lineWidth, opacity = _a.opacity, strokeOpacity = _a.strokeOpacity, fillOpacity = _a.fillOpacity; if (this.isStroke()) { if (lineWidth > 0) { if (!util_1.isNil(strokeOpacity) && strokeOpacity !== 1) { context.globalAlpha = opacity; } this.stroke(context); } } if (this.isFill()) { if (!util_1.isNil(fillOpacity) && fillOpacity !== 1) { context.globalAlpha = fillOpacity; this.fill(context); context.globalAlpha = opacity; } else { this.fill(context); } } this.afterDrawPath(context); }; // 复写填充逻辑 Text.prototype.fill = function (context) { this._drawText(context, true); }; // 复写绘制边框的逻辑 Text.prototype.stroke = function (context) { this._drawText(context, false); }; return Text; }(base_1.default)); exports.default = Text; /***/ }), /***/ "./src/types.ts": /*!**********************!*\ !*** ./src/types.ts ***! \**********************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var tslib_1 = __webpack_require__(/*! tslib */ "./node_modules/_tslib@1.13.0@tslib/tslib.es6.js"); // 导出 g-base 中的 types tslib_1.__exportStar(__webpack_require__(/*! @antv/g-base/lib/types */ "./node_modules/_@antv_g-base@0.5.0-beta.1@@antv/g-base/lib/types.js"), exports); /***/ }), /***/ "./src/util/arc-params.ts": /*!********************************!*\ !*** ./src/util/arc-params.ts ***! \********************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var util_1 = __webpack_require__(/*! ./util */ "./src/util/util.ts"); // 向量长度 function vMag(v) { return Math.sqrt(v[0] * v[0] + v[1] * v[1]); } // u.v/|u||v|,计算夹角的余弦值 function vRatio(u, v) { // 当存在一个向量的长度为 0 时,夹角也为 0,即夹角的余弦值为 1 return vMag(u) * vMag(v) ? (u[0] * v[0] + u[1] * v[1]) / (vMag(u) * vMag(v)) : 1; } // 向量角度 function vAngle(u, v) { return (u[0] * v[1] < u[1] * v[0] ? -1 : 1) * Math.acos(vRatio(u, v)); } // A 0:rx 1:ry 2:x-axis-rotation 3:large-arc-flag 4:sweep-flag 5: x 6: y function getArcParams(startPoint, params) { var rx = params[1]; var ry = params[2]; var xRotation = util_1.mod(util_1.toRadian(params[3]), Math.PI * 2); var arcFlag = params[4]; var sweepFlag = params[5]; // 弧形起点坐标 var x1 = startPoint[0]; var y1 = startPoint[1]; // 弧形终点坐标 var x2 = params[6]; var y2 = params[7]; var xp = (Math.cos(xRotation) * (x1 - x2)) / 2.0 + (Math.sin(xRotation) * (y1 - y2)) / 2.0; var yp = (-1 * Math.sin(xRotation) * (x1 - x2)) / 2.0 + (Math.cos(xRotation) * (y1 - y2)) / 2.0; var lambda = (xp * xp) / (rx * rx) + (yp * yp) / (ry * ry); if (lambda > 1) { rx *= Math.sqrt(lambda); ry *= Math.sqrt(lambda); } var diff = rx * rx * (yp * yp) + ry * ry * (xp * xp); var f = diff ? Math.sqrt((rx * rx * (ry * ry) - diff) / diff) : 1; if (arcFlag === sweepFlag) { f *= -1; } if (isNaN(f)) { f = 0; } // 旋转前的起点坐标,且当长半轴和短半轴的长度为 0 时,坐标按 (0, 0) 处理 var cxp = ry ? (f * rx * yp) / ry : 0; var cyp = rx ? (f * -ry * xp) / rx : 0; // 椭圆圆心坐标 var cx = (x1 + x2) / 2.0 + Math.cos(xRotation) * cxp - Math.sin(xRotation) * cyp; var cy = (y1 + y2) / 2.0 + Math.sin(xRotation) * cxp + Math.cos(xRotation) * cyp; // 起始点的单位向量 var u = [(xp - cxp) / rx, (yp - cyp) / ry]; // 终止点的单位向量 var v = [(-1 * xp - cxp) / rx, (-1 * yp - cyp) / ry]; // 计算起始点和圆心的连线,与 x 轴正方向的夹角 var theta = vAngle([1, 0], u); // 计算圆弧起始点和终止点与椭圆圆心连线的夹角 var dTheta = vAngle(u, v); if (vRatio(u, v) <= -1) { dTheta = Math.PI; } if (vRatio(u, v) >= 1) { dTheta = 0; } if (sweepFlag === 0 && dTheta > 0) { dTheta = dTheta - 2 * Math.PI; } if (sweepFlag === 1 && dTheta < 0) { dTheta = dTheta + 2 * Math.PI; } return { cx: cx, cy: cy, // 弧形的起点和终点相同时,长轴和短轴的长度按 0 处理 rx: util_1.isSamePoint(startPoint, [x2, y2]) ? 0 : rx, ry: util_1.isSamePoint(startPoint, [x2, y2]) ? 0 : ry, startAngle: theta, endAngle: theta + dTheta, xRotation: xRotation, arcFlag: arcFlag, sweepFlag: sweepFlag, }; } exports.default = getArcParams; /***/ }), /***/ "./src/util/arrow.ts": /*!***************************!*\ !*** ./src/util/arrow.ts ***! \***************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.addEndArrow = exports.addStartArrow = exports.getShortenOffset = void 0; var tslib_1 = __webpack_require__(/*! tslib */ "./node_modules/_tslib@1.13.0@tslib/tslib.es6.js"); var shape_1 = __webpack_require__(/*! ../shape */ "./src/shape/index.ts"); var sin = Math.sin, cos = Math.cos, atan2 = Math.atan2, PI = Math.PI; function _addDefaultArrow(shape, attrs, x1, y1, x2, y2, isStart) { var stroke = attrs.stroke, lineWidth = attrs.lineWidth; var x = x1 - x2; var y = y1 - y2; var rad = atan2(y, x); var arrowShape = new shape_1.Path({ type: 'path', canvas: shape.get('canvas'), isArrowShape: true, attrs: { // 默认箭头的边长为 10,夹角为 60 度 path: "M" + 10 * cos(PI / 6) + "," + 10 * sin(PI / 6) + " L0,0 L" + 10 * cos(PI / 6) + ",-" + 10 * sin(PI / 6), // 使用 shape stroke 值 stroke: stroke, lineWidth: lineWidth, }, }); arrowShape.translate(x2, y2); arrowShape.rotateAtPoint(x2, y2, rad); shape.set(isStart ? 'startArrowShape' : 'endArrowShape', arrowShape); } /** * 箭头 path 的设置要求 * 1. 箭头顶点坐标需要为 (0, 0) * 2. 箭头夹角的中心分割线需要与 X 轴正方向对齐 */ function _addCustomizedArrow(shape, attrs, x1, y1, x2, y2, isStart) { var startArrow = attrs.startArrow, endArrow = attrs.endArrow, stroke = attrs.stroke, lineWidth = attrs.lineWidth; var arrowAttrs = isStart ? startArrow : endArrow; var d = arrowAttrs.d, arrowFill = arrowAttrs.fill, arrowStroke = arrowAttrs.stroke, arrowLineWidth = arrowAttrs.lineWidth, restAttrs = tslib_1.__rest(arrowAttrs, ["d", "fill", "stroke", "lineWidth"]); var x = x1 - x2; var y = y1 - y2; var rad = atan2(y, x); if (d) { x2 = x2 - cos(rad) * d; y2 = y2 - sin(rad) * d; } var arrowShape = new shape_1.Path({ type: 'path', canvas: shape.get('canvas'), isArrowShape: true, attrs: tslib_1.__assign(tslib_1.__assign({}, restAttrs), { // 支持单独设置箭头的 stroke 和 lineWidth,若为空则使用 shape 的值 stroke: arrowStroke || stroke, lineWidth: arrowLineWidth || lineWidth, // 箭头是否填充需要手动设置,不会继承自 shape 的值 fill: arrowFill }), }); arrowShape.translate(x2, y2); arrowShape.rotateAtPoint(x2, y2, rad); shape.set(isStart ? 'startArrowShape' : 'endArrowShape', arrowShape); } /** * 如果自定义箭头并且有 d 需要做偏移,如果直接画,线条会超出箭头尖端,因此需要根据箭头偏移 d, 返回线需要缩短的距离 * |---------------- * |<|-------------- * | * @param {number} x1 起始点 x * @param {number} y1 起始点 y * @param {number} x2 箭头作用点 x * @param {number} y2 箭头作用点 y * @param {number} d 箭头沿线条方向的偏移距离 * @return {{dx: number, dy: number}} 返回线条偏移距离 */ function getShortenOffset(x1, y1, x2, y2, d) { var rad = atan2(y2 - y1, x2 - x1); return { dx: cos(rad) * d, dy: sin(rad) * d, }; } exports.getShortenOffset = getShortenOffset; /** * 绘制起始箭头 * @param {IShape} shape 图形 * @param {ShapeAttrs} attrs shape 的绘图属性 * @param {number} x1 起始点 x * @param {number} y1 起始点 y * @param {number} x2 箭头作用点 x * @param {number} y2 箭头作用点 y */ function addStartArrow(shape, attrs, x1, y1, x2, y2) { if (typeof attrs.startArrow === 'object') { _addCustomizedArrow(shape, attrs, x1, y1, x2, y2, true); } else if (attrs.startArrow) { _addDefaultArrow(shape, attrs, x1, y1, x2, y2, true); } else { shape.set('startArrowShape', null); } } exports.addStartArrow = addStartArrow; /** * 绘制结束箭头 * @param {IShape} shape 图形 * @param {ShapeAttrs} attrs shape 的绘图属性 * @param {number} x1 起始点 x * @param {number} y1 起始点 y * @param {number} x2 箭头作用点 x * @param {number} y2 箭头作用点 y */ function addEndArrow(shape, attrs, x1, y1, x2, y2) { if (typeof attrs.endArrow === 'object') { _addCustomizedArrow(shape, attrs, x1, y1, x2, y2, false); } else if (attrs.endArrow) { _addDefaultArrow(shape, attrs, x1, y1, x2, y2, false); } else { shape.set('startArrowShape', null); } } exports.addEndArrow = addEndArrow; /***/ }), /***/ "./src/util/draw.ts": /*!**************************!*\ !*** ./src/util/draw.ts ***! \**************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.mergeView = exports.getMergedRegion = exports.getRefreshRegion = exports.refreshElement = exports.drawPath = exports.clearChanged = exports.checkChildrenRefresh = exports.checkRefresh = exports.drawChildren = exports.applyAttrsToContext = void 0; var util_1 = __webpack_require__(/*! @antv/util */ "./node_modules/_@antv_util@2.0.9@@antv/util/esm/index.js"); var parse_1 = __webpack_require__(/*! ./parse */ "./src/util/parse.ts"); var arc_params_1 = __webpack_require__(/*! ./arc-params */ "./src/util/arc-params.ts"); var util_2 = __webpack_require__(/*! ./util */ "./src/util/util.ts"); var ArrowUtil = __webpack_require__(/*! ../util/arrow */ "./src/util/arrow.ts"); var SHAPE_ATTRS_MAP = { fill: 'fillStyle', stroke: 'strokeStyle', opacity: 'globalAlpha', }; function applyAttrsToContext(context, element) { var attrs = element.attr(); for (var k in attrs) { var v = attrs[k]; // 转换一下不与 canvas 兼容的属性名 var name = SHAPE_ATTRS_MAP[k] ? SHAPE_ATTRS_MAP[k] : k; if (name === 'matrix' && v) { // 设置矩阵 context.transform(v[0], v[1], v[3], v[4], v[6], v[7]); } else if (name === 'lineDash' && context.setLineDash) { // 设置虚线,只支持数组形式,非数组形式不做任何操作 util_1.isArray(v) && context.setLineDash(v); } else { if (name === 'strokeStyle' || name === 'fillStyle') { // 如果存在渐变、pattern 这个开销有些大 // 可以考虑缓存机制,通过 hasUpdate 来避免一些运算 v = parse_1.parseStyle(context, element, v); } else if (name === 'globalAlpha') { // opacity 效果可以叠加,子元素的 opacity 需要与父元素 opacity 相乘 v = v * context.globalAlpha; } context[name] = v; } } } exports.applyAttrsToContext = applyAttrsToContext; function drawChildren(context, children, region) { for (var i = 0; i < children.length; i++) { var child = children[i]; if (child.cfg.visible) { child.draw(context, region); } else { child.skipDraw(); } } } exports.drawChildren = drawChildren; // 这个地方的逻辑比较复杂,简单画了一张图:https://www.yuque.com/antv/ou292n/pcgt5g#OW1QE function checkRefresh(canvas, children, region) { var refreshElements = canvas.get('refreshElements'); // 先遍历需要刷新的元素,将这些元素的父元素也设置 refresh util_1.each(refreshElements, function (el) { if (el !== canvas) { var parent = el.cfg.parent; while (parent && parent !== canvas && !parent.cfg.refresh) { parent.cfg.refresh = true; parent = parent.cfg.parent; } } }); if (refreshElements[0] === canvas) { setChildrenRefresh(children, region); } else { // 检查所有子元素是否可以刷新 checkChildrenRefresh(children, region); } } exports.checkRefresh = checkRefresh; // 检查所有的子元素是否应该更新 function checkChildrenRefresh(children, region) { for (var i = 0; i < children.length; i++) { var child = children[i]; if (child.cfg.visible) { // 如果当前图形/分组 refresh = true,说明其子节点存在 changed if (child.cfg.refresh) { if (child.isGroup()) { checkChildrenRefresh(child.cfg.children, region); } } else if (child.cfg.hasChanged) { // 如果节点发生了 change,则需要级联设置子元素的 refresh child.cfg.refresh = true; if (child.isGroup()) { setChildrenRefresh(child.cfg.children, region); } } else { // 这个分支说明此次局部刷新,所有的节点和父元素没有发生变化,仅需要检查包围盒(缓存)是否相交即可 child.cfg.refresh = checkElementRefresh(child, region); } } } } exports.checkChildrenRefresh = checkChildrenRefresh; // 由于对改变的图形放入 refreshElements 时做了优化,判定父元素 changed 时不加入 // 那么有可能会出现 elements 都为空,所以最终 group function clearChanged(elements) { for (var i = 0; i < elements.length; i++) { var el = elements[i]; el.cfg.hasChanged = false; // 级联清理 if (el.isGroup()) { clearChanged(el.cfg.children); } } } exports.clearChanged = clearChanged; // 当某个父元素发生改变时,调用这个方法级联设置 refresh function setChildrenRefresh(children, region) { for (var i = 0; i < children.length; i++) { var child = children[i]; // let refresh = true; // 获取缓存的 bbox,如果这个 bbox 还存在则说明父元素不是矩阵发生了改变 // const bbox = child.cfg.canvasBBox; // if (bbox) { // // 如果这时候 // refresh = intersectRect(bbox, region); // } child.cfg.refresh = true; // 如果需要刷新当前节点,所有的子元素设置 refresh if (child.isGroup()) { setChildrenRefresh(child.get('children'), region); } } } function checkElementRefresh(shape, region) { var bbox = shape.cfg.cacheCanvasBBox; var isAllow = shape.cfg.isInView && bbox && util_2.intersectRect(bbox, region); return isAllow; } // 绘制 path function drawPath(shape, context, attrs, arcParamsCache) { var path = attrs.path, startArrow = attrs.startArrow, endArrow = attrs.endArrow; var currentPoint = [0, 0]; // 当前图形 var startMovePoint = [0, 0]; // 开始 M 的点,可能会有多个 var distance = { dx: 0, dy: 0, }; context.beginPath(); for (var i = 0; i < path.length; i++) { var params = path[i]; var command = params[0]; if (i === 0 && startArrow && startArrow.d) { var tangent = shape.getStartTangent(); distance = ArrowUtil.getShortenOffset(tangent[0][0], tangent[0][1], tangent[1][0], tangent[1][1], startArrow.d); } else if (i === path.length - 2 && path[i + 1][0] === 'Z' && endArrow && endArrow.d) { // 为了防止结尾为 Z 的 segment 缩短不起效,需要取最后两个 segment 特殊处理 var lastPath = path[i + 1]; if (lastPath[0] === 'Z') { var tangent = shape.getEndTangent(); distance = ArrowUtil.getShortenOffset(tangent[0][0], tangent[0][1], tangent[1][0], tangent[1][1], endArrow.d); } } else if (i === path.length - 1 && endArrow && endArrow.d) { if (path[0] !== 'Z') { var tangent = shape.getEndTangent(); distance = ArrowUtil.getShortenOffset(tangent[0][0], tangent[0][1], tangent[1][0], tangent[1][1], endArrow.d); } } var dx = distance.dx, dy = distance.dy; // V,H,S,T 都在前面被转换成标准形式 switch (command) { case 'M': context.moveTo(params[1] - dx, params[2] - dy); startMovePoint = [params[1], params[2]]; break; case 'L': context.lineTo(params[1] - dx, params[2] - dy); break; case 'Q': context.quadraticCurveTo(params[1], params[2], params[3] - dx, params[4] - dy); break; case 'C': context.bezierCurveTo(params[1], params[2], params[3], params[4], params[5] - dx, params[6] - dy); break; case 'A': { var arcParams = void 0; // 为了加速绘制,可以提供参数的缓存,各个图形自己缓存 if (arcParamsCache) { arcParams = arcParamsCache[i]; if (!arcParams) { arcParams = arc_params_1.default(currentPoint, params); arcParamsCache[i] = arcParams; } } else { arcParams = arc_params_1.default(currentPoint, params); } var cx = arcParams.cx, cy = arcParams.cy, rx = arcParams.rx, ry = arcParams.ry, startAngle = arcParams.startAngle, endAngle = arcParams.endAngle, xRotation = arcParams.xRotation, sweepFlag = arcParams.sweepFlag; // 直接使用椭圆的 api if (context.ellipse) { context.ellipse(cx, cy, rx, ry, xRotation, startAngle, endAngle, 1 - sweepFlag); } else { var r = rx > ry ? rx : ry; var scaleX = rx > ry ? 1 : rx / ry; var scaleY = rx > ry ? ry / rx : 1; context.translate(cx, cy); context.rotate(xRotation); context.scale(scaleX, scaleY); context.arc(0, 0, r, startAngle, endAngle, 1 - sweepFlag); context.scale(1 / scaleX, 1 / scaleY); context.rotate(-xRotation); context.translate(-cx, -cy); } break; } case 'Z': context.closePath(); break; default: break; } // 有了 Z 后,当前节点从开始 M 的点开始 if (command === 'Z') { currentPoint = startMovePoint; } else { var len = params.length; currentPoint = [params[len - 2], params[len - 1]]; } } } exports.drawPath = drawPath; // 刷新图形元素(Shape 或者 Group) function refreshElement(element, changeType) { var canvas = element.get('canvas'); // 只有存在于 canvas 上时生效 if (canvas) { if (changeType === 'remove') { // 一旦 remove,则无法在 element 上拿到包围盒 // destroy 后所有属性都拿不到,所以需要暂存一下 // 这是一段 hack 的代码 element._cacheCanvasBBox = element.get('cacheCanvasBBox'); } // 防止反复刷新 if (!element.get('hasChanged')) { // 但是始终要标记为 hasChanged,便于后面进行局部渲染 element.set('hasChanged', true); // 本来只有局部渲染模式下,才需要记录更新的元素队列 // if (canvas.get('localRefresh')) { // canvas.refreshElement(element, changeType, canvas); // } // 但对于 https://github.com/antvis/g/issues/422 的场景,全局渲染的模式下也需要记录更新的元素队列 // 如果当前元素的父元素发生了改变,可以不放入队列,这句话大概能够提升 15% 的初次渲染性能 if (!(element.cfg.parent && element.cfg.parent.get('hasChanged'))) { canvas.refreshElement(element, changeType, canvas); if (canvas.get('autoDraw')) { canvas.draw(); } } } } } exports.refreshElement = refreshElement; function getRefreshRegion(element) { var region; if (!element.destroyed) { var cacheBox = element.get('cacheCanvasBBox'); var validCache = cacheBox && !!(cacheBox.width && cacheBox.height); var bbox = element.getCanvasBBox(); var validBBox = bbox && !!(bbox.width && bbox.height); // 是否是有效 bbox 判定,一些 NaN 或者 宽高为 0 的情况过滤掉 if (validCache && validBBox) { region = util_2.mergeRegion(cacheBox, bbox); } else if (validCache) { region = cacheBox; } else if (validBBox) { region = bbox; } } else { // 因为元素已经销毁所以无法获取到缓存的包围盒 region = element['_cacheCanvasBBox']; } return region; } exports.getRefreshRegion = getRefreshRegion; function getMergedRegion(elements) { if (!elements.length) { return null; } var minXArr = []; var minYArr = []; var maxXArr = []; var maxYArr = []; util_1.each(elements, function (el) { var region = getRefreshRegion(el); if (region) { minXArr.push(region.minX); minYArr.push(region.minY); maxXArr.push(region.maxX); maxYArr.push(region.maxY); } }); return { minX: Math.min.apply(null, minXArr), minY: Math.min.apply(null, minYArr), maxX: Math.max.apply(null, maxXArr), maxY: Math.max.apply(null, maxYArr), }; } exports.getMergedRegion = getMergedRegion; function mergeView(region, viewRegion) { if (!region || !viewRegion) { return null; } // 不相交,则直接返回 null if (!util_2.intersectRect(region, viewRegion)) { return null; } return { minX: Math.max(region.minX, viewRegion.minX), minY: Math.max(region.minY, viewRegion.minY), maxX: Math.min(region.maxX, viewRegion.maxX), maxY: Math.min(region.maxY, viewRegion.maxY), }; } exports.mergeView = mergeView; /***/ }), /***/ "./src/util/hit.ts": /*!*************************!*\ !*** ./src/util/hit.ts ***! \*************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getShape = void 0; var util_1 = __webpack_require__(/*! @antv/g-base/lib/util/util */ "./node_modules/_@antv_g-base@0.5.0-beta.1@@antv/g-base/lib/util/util.js"); var matrix_1 = __webpack_require__(/*! @antv/g-base/lib/util/matrix */ "./node_modules/_@antv_g-base@0.5.0-beta.1@@antv/g-base/lib/util/matrix.js"); function invertFromMatrix(v, matrix) { if (matrix) { var invertMatrix = matrix_1.invert(matrix); return matrix_1.multiplyVec2(invertMatrix, v); } return v; } function getRefXY(element, x, y) { // @ts-ignore var totalMatrix = element.getTotalMatrix(); if (totalMatrix) { var _a = invertFromMatrix([x, y, 1], totalMatrix), refX = _a[0], refY = _a[1]; return [refX, refY]; } return [x, y]; } // 拾取前的检测,只有通过检测才能继续拾取 function preTest(element, x, y) { // @ts-ignore if (element.isCanvas && element.isCanvas()) { return true; } // 不允许被拾取,则返回 null // @ts-ignore if (!util_1.isAllowCapture(element) || element.cfg.isInView === false) { return false; } if (element.cfg.clipShape) { // 如果存在 clip var _a = getRefXY(element, x, y), refX = _a[0], refY = _a[1]; if (element.isClipped(refX, refY)) { return false; } } // @ts-ignore ,这个地方调用过于频繁 var bbox = element.cfg.cacheCanvasBBox || element.getCanvasBBox(); // 如果没有缓存 bbox,则说明不可见 // 注释掉的这段可能会加速拾取,上面的语句改写成 const bbox = element.cfg.cacheCanvasBBox; // 这时候的拾取假设图形/分组在上一次绘制都在视窗内,但是上面已经判定了 isInView 所以意义不大 // 现在还调用 element.getCanvasBBox(); 一个很大的原因是便于单元测试 // if (!bbox) { // return false; // } if (!(x >= bbox.minX && x <= bbox.maxX && y >= bbox.minY && y <= bbox.maxY)) { return false; } return true; } // 这个方法复写了 g-base 的 getShape function getShape(container, x, y) { // 没有通过检测,则返回 null if (!preTest(container, x, y)) { return null; } var shape = null; var children = container.getChildren(); var count = children.length; for (var i = count - 1; i >= 0; i--) { var child = children[i]; if (child.isGroup()) { shape = getShape(child, x, y); } else if (preTest(child, x, y)) { var curShape = child; var _a = getRefXY(child, x, y), refX = _a[0], refY = _a[1]; // @ts-ignore if (curShape.isInShape(refX, refY)) { shape = child; } } if (shape) { break; } } return shape; } exports.getShape = getShape; /***/ }), /***/ "./src/util/in-path/point-in-path.ts": /*!*******************************************!*\ !*** ./src/util/in-path/point-in-path.ts ***! \*******************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var offscreen_1 = __webpack_require__(/*! @antv/g-base/lib/util/offscreen */ "./node_modules/_@antv_g-base@0.5.0-beta.1@@antv/g-base/lib/util/offscreen.js"); function isPointInPath(shape, x, y) { var ctx = offscreen_1.getOffScreenContext(); shape.createPath(ctx); return ctx.isPointInPath(x, y); } exports.default = isPointInPath; /***/ }), /***/ "./src/util/in-path/polygon.ts": /*!*************************************!*\ !*** ./src/util/in-path/polygon.ts ***! \*************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /** * @fileoverview 判断点是否在多边形内 * @author dxq613@gmail.com */ Object.defineProperty(exports, "__esModule", { value: true }); // 多边形的射线检测,参考:https://blog.csdn.net/WilliamSun0122/article/details/77994526 var tolerance = 1e-6; // 三态函数,判断两个double在eps精度下的大小关系 function dcmp(x) { if (Math.abs(x) < tolerance) { return 0; } return x < 0 ? -1 : 1; } // 判断点Q是否在p1和p2的线段上 function onSegment(p1, p2, q) { if ((q[0] - p1[0]) * (p2[1] - p1[1]) === (p2[0] - p1[0]) * (q[1] - p1[1]) && Math.min(p1[0], p2[0]) <= q[0] && q[0] <= Math.max(p1[0], p2[0]) && Math.min(p1[1], p2[1]) <= q[1] && q[1] <= Math.max(p1[1], p2[1])) { return true; } return false; } // 判断点P在多边形内-射线法 function isInPolygon(points, x, y) { var isHit = false; var n = points.length; if (n <= 2) { // svg 中点小于 3 个时,不显示,也无法被拾取 return false; } for (var i = 0; i < n; i++) { var p1 = points[i]; var p2 = points[(i + 1) % n]; if (onSegment(p1, p2, [x, y])) { // 点在多边形一条边上 return true; } // 前一个判断min(p1[1],p2[1]) 0 !== dcmp(p2[1] - y) > 0 && dcmp(x - ((y - p1[1]) * (p1[0] - p2[0])) / (p1[1] - p2[1]) - p1[0]) < 0) { isHit = !isHit; } } return isHit; } exports.default = isInPolygon; /***/ }), /***/ "./src/util/in-stroke/arc.ts": /*!***********************************!*\ !*** ./src/util/in-stroke/arc.ts ***! \***********************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var util_1 = __webpack_require__(/*! ../util */ "./src/util/util.ts"); function arc(cx, cy, r, startAngle, endAngle, lineWidth, x, y) { var angle = (Math.atan2(y - cy, x - cx) + Math.PI * 2) % (Math.PI * 2); // 转换到 0 - 2 * Math.PI 之间 if (angle < startAngle || angle > endAngle) { return false; } var point = { x: cx + r * Math.cos(angle), y: cy + r * Math.sin(angle), }; return util_1.distance(point.x, point.y, x, y) <= lineWidth / 2; } exports.default = arc; /***/ }), /***/ "./src/util/in-stroke/line.ts": /*!************************************!*\ !*** ./src/util/in-stroke/line.ts ***! \************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var line_1 = __webpack_require__(/*! @antv/g-math/lib/line */ "./node_modules/_@antv_g-math@0.1.3@@antv/g-math/lib/line.js"); function inLine(x1, y1, x2, y2, lineWidth, x, y) { var minX = Math.min(x1, x2); var maxX = Math.max(x1, x2); var minY = Math.min(y1, y2); var maxY = Math.max(y1, y2); var halfWidth = lineWidth / 2; // 因为目前的方案是计算点到直线的距离,而有可能会在延长线上,所以要先判断是否在包围盒内 // 这种方案会在水平或者竖直的情况下载线的延长线上有半 lineWidth 的误差 if (!(x >= minX - halfWidth && x <= maxX + halfWidth && y >= minY - halfWidth && y <= maxY + halfWidth)) { return false; } // 因为已经计算了包围盒,所以仅需要计算到直线的距离即可,可以显著提升性能 return line_1.default.pointToLine(x1, y1, x2, y2, x, y) <= lineWidth / 2; } exports.default = inLine; /***/ }), /***/ "./src/util/in-stroke/polyline.ts": /*!****************************************!*\ !*** ./src/util/in-stroke/polyline.ts ***! \****************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var line_1 = __webpack_require__(/*! ./line */ "./src/util/in-stroke/line.ts"); function inPolyline(points, lineWidth, x, y, isClose) { var count = points.length; if (count < 2) { return false; } for (var i = 0; i < count - 1; i++) { var x1 = points[i][0]; var y1 = points[i][1]; var x2 = points[i + 1][0]; var y2 = points[i + 1][1]; if (line_1.default(x1, y1, x2, y2, lineWidth, x, y)) { return true; } } // 如果封闭,则计算起始点和结束点的边 if (isClose) { var first = points[0]; var last = points[count - 1]; if (line_1.default(first[0], first[1], last[0], last[1], lineWidth, x, y)) { return true; } } return false; } exports.default = inPolyline; /***/ }), /***/ "./src/util/in-stroke/rect-radius.ts": /*!*******************************************!*\ !*** ./src/util/in-stroke/rect-radius.ts ***! \*******************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var line_1 = __webpack_require__(/*! ./line */ "./src/util/in-stroke/line.ts"); var arc_1 = __webpack_require__(/*! ./arc */ "./src/util/in-stroke/arc.ts"); function rectWithRadius(minX, minY, width, height, radius, lineWidth, x, y) { var halfWidth = lineWidth / 2; return (line_1.default(minX + radius, minY, minX + width - radius, minY, lineWidth, x, y) || line_1.default(minX + width, minY + radius, minX + width, minY + height - radius, lineWidth, x, y) || line_1.default(minX + width - radius, minY + height, minX + radius, minY + height, lineWidth, x, y) || line_1.default(minX, minY + height - radius, minX, minY + radius, lineWidth, x, y) || arc_1.default(minX + width - radius, minY + radius, radius, 1.5 * Math.PI, 2 * Math.PI, lineWidth, x, y) || arc_1.default(minX + width - radius, minY + height - radius, radius, 0, 0.5 * Math.PI, lineWidth, x, y) || arc_1.default(minX + radius, minY + height - radius, radius, 0.5 * Math.PI, Math.PI, lineWidth, x, y) || arc_1.default(minX + radius, minY + radius, radius, Math.PI, 1.5 * Math.PI, lineWidth, x, y)); } exports.default = rectWithRadius; /***/ }), /***/ "./src/util/in-stroke/rect.ts": /*!************************************!*\ !*** ./src/util/in-stroke/rect.ts ***! \************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var util_1 = __webpack_require__(/*! ../util */ "./src/util/util.ts"); function inRect(minX, minY, width, height, lineWidth, x, y) { var halfWidth = lineWidth / 2; // 将四个边看做矩形来检测,比边的检测算法要快 return (util_1.inBox(minX - halfWidth, minY - halfWidth, width, lineWidth, x, y) || // 上边 util_1.inBox(minX + width - halfWidth, minY - halfWidth, lineWidth, height, x, y) || // 右边 util_1.inBox(minX + halfWidth, minY + height - halfWidth, width, lineWidth, x, y) || // 下边 util_1.inBox(minX - halfWidth, minY + halfWidth, lineWidth, height, x, y)); // 左边 } exports.default = inRect; /***/ }), /***/ "./src/util/parse.ts": /*!***************************!*\ !*** ./src/util/parse.ts ***! \***************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.parseRadius = exports.parseStyle = exports.parsePattern = exports.parseRadialGradient = exports.parseLineGradient = void 0; var util_1 = __webpack_require__(/*! ./util */ "./src/util/util.ts"); var regexTags = /[MLHVQTCSAZ]([^MLHVQTCSAZ]*)/gi; var regexDot = /[^\s\,]+/gi; var regexLG = /^l\s*\(\s*([\d.]+)\s*\)\s*(.*)/i; var regexRG = /^r\s*\(\s*([\d.]+)\s*,\s*([\d.]+)\s*,\s*([\d.]+)\s*\)\s*(.*)/i; var regexPR = /^p\s*\(\s*([axyn])\s*\)\s*(.*)/i; var regexColorStop = /[\d.]+:(#[^\s]+|[^\)]+\))/gi; function addStop(steps, gradient) { var arr = steps.match(regexColorStop); util_1.each(arr, function (item) { var itemArr = item.split(':'); gradient.addColorStop(itemArr[0], itemArr[1]); }); } /** * 将边和填充设置的颜色转换成线性渐变对象 * @param {CanvasRenderingContext2D} context canvas 上下文 * @param {IElement} element 图形元素 * @param {string} gradientStr 颜色 * @returns {any} 渐变对象 */ function parseLineGradient(context, element, gradientStr) { var arr = regexLG.exec(gradientStr); var angle = (parseFloat(arr[1]) % 360) * (Math.PI / 180); var steps = arr[2]; var box = element.getBBox(); var start; var end; if (angle >= 0 && angle < (1 / 2) * Math.PI) { start = { x: box.minX, y: box.minY, }; end = { x: box.maxX, y: box.maxY, }; } else if ((1 / 2) * Math.PI <= angle && angle < Math.PI) { start = { x: box.maxX, y: box.minY, }; end = { x: box.minX, y: box.maxY, }; } else if (Math.PI <= angle && angle < (3 / 2) * Math.PI) { start = { x: box.maxX, y: box.maxY, }; end = { x: box.minX, y: box.minY, }; } else { start = { x: box.minX, y: box.maxY, }; end = { x: box.maxX, y: box.minY, }; } var tanTheta = Math.tan(angle); var tanTheta2 = tanTheta * tanTheta; var x = (end.x - start.x + tanTheta * (end.y - start.y)) / (tanTheta2 + 1) + start.x; var y = (tanTheta * (end.x - start.x + tanTheta * (end.y - start.y))) / (tanTheta2 + 1) + start.y; var gradient = context.createLinearGradient(start.x, start.y, x, y); addStop(steps, gradient); return gradient; } exports.parseLineGradient = parseLineGradient; /** * 将边和填充设置的颜色转换成圆形渐变对象 * @param {CanvasRenderingContext2D} context canvas 上下文 * @param {IElement} element 图形元素 * @param {string} gradientStr 颜色 * @returns {any} 渐变对象 */ function parseRadialGradient(context, element, gradientStr) { var arr = regexRG.exec(gradientStr); var fx = parseFloat(arr[1]); var fy = parseFloat(arr[2]); var fr = parseFloat(arr[3]); var steps = arr[4]; // 环半径为0时,默认无渐变,取渐变序列的最后一个颜色 if (fr === 0) { var colors = steps.match(regexColorStop); return colors[colors.length - 1].split(':')[1]; } var box = element.getBBox(); var width = box.maxX - box.minX; var height = box.maxY - box.minY; var r = Math.sqrt(width * width + height * height) / 2; var gradient = context.createRadialGradient(box.minX + width * fx, box.minY + height * fy, 0, box.minX + width / 2, box.minY + height / 2, fr * r); addStop(steps, gradient); return gradient; } exports.parseRadialGradient = parseRadialGradient; /** * 边和填充设置的颜色转换成 pattern * @param {CanvasRenderingContext2D} context canvas 上下文 * @param {IElement} element 图形元素 * @param {string} patternStr 生成 pattern 的字符串 */ function parsePattern(context, element, patternStr) { // 在转换过程中进行了缓存 if (element.get('patternSource') && element.get('patternSource') === patternStr) { return element.get('pattern'); } var pattern; var img; var arr = regexPR.exec(patternStr); var repeat = arr[1]; var source = arr[2]; // Function to be called when pattern loads function onload() { // Create pattern pattern = context.createPattern(img, repeat); element.set('pattern', pattern); // be a cache element.set('patternSource', patternStr); } switch (repeat) { case 'a': repeat = 'repeat'; break; case 'x': repeat = 'repeat-x'; break; case 'y': repeat = 'repeat-y'; break; case 'n': repeat = 'no-repeat'; break; default: repeat = 'no-repeat'; } img = new Image(); // If source URL is not a data URL if (!source.match(/^data:/i)) { // Set crossOrigin for this image img.crossOrigin = 'Anonymous'; } img.src = source; if (img.complete) { onload(); } else { img.onload = onload; // Fix onload() bug in IE9 img.src = img.src; } return pattern; } exports.parsePattern = parsePattern; function parseStyle(context, element, color) { if (util_1.isString(color)) { if (color[1] === '(' || color[2] === '(') { if (color[0] === 'l') { // regexLG.test(color) return parseLineGradient(context, element, color); } if (color[0] === 'r') { // regexRG.test(color) return parseRadialGradient(context, element, color); } if (color[0] === 'p') { // regexPR.test(color) return parsePattern(context, element, color); } } return color; } } exports.parseStyle = parseStyle; function parseRadius(radius) { var r1 = 0; var r2 = 0; var r3 = 0; var r4 = 0; if (util_1.isArray(radius)) { if (radius.length === 1) { r1 = r2 = r3 = r4 = radius[0]; } else if (radius.length === 2) { r1 = r3 = radius[0]; r2 = r4 = radius[1]; } else if (radius.length === 3) { r1 = radius[0]; r2 = r4 = radius[1]; r3 = radius[2]; } else { r1 = radius[0]; r2 = radius[1]; r3 = radius[2]; r4 = radius[3]; } } else { r1 = r2 = r3 = r4 = radius; } return [r1, r2, r3, r4]; } exports.parseRadius = parseRadius; /***/ }), /***/ "./src/util/path.ts": /*!**************************!*\ !*** ./src/util/path.ts ***! \**************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var tslib_1 = __webpack_require__(/*! tslib */ "./node_modules/_tslib@1.13.0@tslib/tslib.es6.js"); /** * @fileoverview path 的一些工具 * @author dxq613@gmail.com */ var g_base_1 = __webpack_require__(/*! @antv/g-base */ "./node_modules/_@antv_g-base@0.5.0-beta.1@@antv/g-base/esm/index.js"); var quadratic_1 = __webpack_require__(/*! @antv/g-math/lib/quadratic */ "./node_modules/_@antv_g-math@0.1.3@@antv/g-math/lib/quadratic.js"); var cubic_1 = __webpack_require__(/*! @antv/g-math/lib/cubic */ "./node_modules/_@antv_g-math@0.1.3@@antv/g-math/lib/cubic.js"); var util_1 = __webpack_require__(/*! ./util */ "./src/util/util.ts"); var line_1 = __webpack_require__(/*! ./in-stroke/line */ "./src/util/in-stroke/line.ts"); var arc_1 = __webpack_require__(/*! ./in-stroke/arc */ "./src/util/in-stroke/arc.ts"); var mat3_1 = __webpack_require__(/*! @antv/matrix-util/lib/mat3 */ "./node_modules/_@antv_matrix-util@3.0.3@@antv/matrix-util/lib/mat3.js"); var vec3 = __webpack_require__(/*! gl-matrix/vec3 */ "./node_modules/_gl-matrix@3.3.0@gl-matrix/esm/vec3.js"); function hasArc(path) { var hasArc = false; var count = path.length; for (var i = 0; i < count; i++) { var params = path[i]; var cmd = params[0]; if (cmd === 'C' || cmd === 'A' || cmd === 'Q') { hasArc = true; break; } } return hasArc; } function isPointInStroke(segments, lineWidth, x, y) { var isHit = false; var halfWidth = lineWidth / 2; for (var i = 0; i < segments.length; i++) { var segment = segments[i]; var currentPoint = segment.currentPoint, params = segment.params, prePoint = segment.prePoint, box = segment.box; // 如果在前面已经生成过包围盒,直接按照包围盒计算 if (box && !util_1.inBox(box.x - halfWidth, box.y - halfWidth, box.width + lineWidth, box.height + lineWidth, x, y)) { continue; } switch (segment.command) { // L 和 Z 都是直线, M 不进行拾取 case 'L': case 'Z': isHit = line_1.default(prePoint[0], prePoint[1], currentPoint[0], currentPoint[1], lineWidth, x, y); break; case 'Q': var qDistance = quadratic_1.default.pointDistance(prePoint[0], prePoint[1], params[1], params[2], params[3], params[4], x, y); isHit = qDistance <= lineWidth / 2; break; case 'C': var cDistance = cubic_1.default.pointDistance(prePoint[0], prePoint[1], params[1], params[2], params[3], params[4], params[5], params[6], x, y); isHit = cDistance <= lineWidth / 2; break; case 'A': // 计算点到椭圆圆弧的距离,暂时使用近似算法,后面可以改成切割法求最近距离 var arcParams = segment.arcParams; var cx = arcParams.cx, cy = arcParams.cy, rx = arcParams.rx, ry = arcParams.ry, startAngle = arcParams.startAngle, endAngle = arcParams.endAngle, xRotation = arcParams.xRotation; var p = [x, y, 1]; var r = rx > ry ? rx : ry; var scaleX = rx > ry ? 1 : rx / ry; var scaleY = rx > ry ? ry / rx : 1; var m = mat3_1.transform(null, [ ['t', -cx, -cy], ['r', -xRotation], ['s', 1 / scaleX, 1 / scaleY], ]); vec3.transformMat3(p, p, m); isHit = arc_1.default(0, 0, r, startAngle, endAngle, lineWidth, p[0], p[1]); break; default: break; } if (isHit) { break; } } return isHit; } /** * 提取出内部的闭合多边形和非闭合的多边形,假设 path 不存在圆弧 * @param {Array} path 路径 * @returns {Array} 点的集合 */ function extractPolygons(path) { var count = path.length; var polygons = []; var polylines = []; var points = []; // 防止第一个命令不是 'M' for (var i = 0; i < count; i++) { var params = path[i]; var cmd = params[0]; if (cmd === 'M') { // 遇到 'M' 判定是否是新数组,新数组中没有点 if (points.length) { // 如果存在点,则说明没有遇到 'Z',开始了一个新的多边形 polylines.push(points); points = []; // 创建新的点 } points.push([params[1], params[2]]); } else if (cmd === 'Z') { if (points.length) { // 存在点 polygons.push(points); points = []; // 开始新的点集合 } // 如果不存在点,同时 'Z',则说明是错误,不处理 } else { points.push([params[1], params[2]]); } } // 说明 points 未放入 polygons 或者 polyline // 仅当只有一个 M,没有 Z 时会发生这种情况 if (points.length > 0) { polylines.push(points); } return { polygons: polygons, polylines: polylines, }; } exports.default = tslib_1.__assign({ hasArc: hasArc, extractPolygons: extractPolygons, isPointInStroke: isPointInStroke }, g_base_1.PathUtil); /***/ }), /***/ "./src/util/util.ts": /*!**************************!*\ !*** ./src/util/util.ts ***! \**************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.isSamePoint = exports.mergeRegion = exports.intersectRect = exports.inBox = exports.distance = exports.getPixelRatio = void 0; function getPixelRatio() { return window ? window.devicePixelRatio : 1; } exports.getPixelRatio = getPixelRatio; /** * 两点之间的距离 * @param {number} x1 起始点 x * @param {number} y1 起始点 y * @param {number} x2 结束点 x * @param {number} y2 结束点 y */ function distance(x1, y1, x2, y2) { var dx = x1 - x2; var dy = y1 - y2; return Math.sqrt(dx * dx + dy * dy); } exports.distance = distance; /** * 是否在包围盒内 * @param {number} minX 包围盒开始的点 x * @param {number} minY 包围盒开始的点 y * @param {number} width 宽度 * @param {number} height 高度 * @param {[type]} x 检测点的 x * @param {[type]} y 监测点的 y */ function inBox(minX, minY, width, height, x, y) { return x >= minX && x <= minX + width && y >= minY && y <= minY + height; } exports.inBox = inBox; function intersectRect(box1, box2) { return !(box2.minX > box1.maxX || box2.maxX < box1.minX || box2.minY > box1.maxY || box2.maxY < box1.minY); } exports.intersectRect = intersectRect; // 合并两个区域 function mergeRegion(region1, region2) { if (!region1 || !region2) { return region1 || region2; } return { minX: Math.min(region1.minX, region2.minX), minY: Math.min(region1.minY, region2.minY), maxX: Math.max(region1.maxX, region2.maxX), maxY: Math.max(region1.maxY, region2.maxY), }; } exports.mergeRegion = mergeRegion; /** * 判断两个点是否重合,点坐标的格式为 [x, y] * @param {Array} point1 第一个点 * @param {Array} point2 第二个点 */ function isSamePoint(point1, point2) { return point1[0] === point2[0] && point1[1] === point2[1]; } exports.isSamePoint = isSamePoint; var is_nil_1 = __webpack_require__(/*! @antv/util/lib/is-nil */ "./node_modules/_@antv_util@2.0.9@@antv/util/lib/is-nil.js"); Object.defineProperty(exports, "isNil", { enumerable: true, get: function () { return is_nil_1.default; } }); var is_string_1 = __webpack_require__(/*! @antv/util/lib/is-string */ "./node_modules/_@antv_util@2.0.9@@antv/util/lib/is-string.js"); Object.defineProperty(exports, "isString", { enumerable: true, get: function () { return is_string_1.default; } }); var is_function_1 = __webpack_require__(/*! @antv/util/lib/is-function */ "./node_modules/_@antv_util@2.0.9@@antv/util/lib/is-function.js"); Object.defineProperty(exports, "isFunction", { enumerable: true, get: function () { return is_function_1.default; } }); var is_array_1 = __webpack_require__(/*! @antv/util/lib/is-array */ "./node_modules/_@antv_util@2.0.9@@antv/util/lib/is-array.js"); Object.defineProperty(exports, "isArray", { enumerable: true, get: function () { return is_array_1.default; } }); var each_1 = __webpack_require__(/*! @antv/util/lib/each */ "./node_modules/_@antv_util@2.0.9@@antv/util/lib/each.js"); Object.defineProperty(exports, "each", { enumerable: true, get: function () { return each_1.default; } }); var to_radian_1 = __webpack_require__(/*! @antv/util/lib/to-radian */ "./node_modules/_@antv_util@2.0.9@@antv/util/lib/to-radian.js"); Object.defineProperty(exports, "toRadian", { enumerable: true, get: function () { return to_radian_1.default; } }); var mod_1 = __webpack_require__(/*! @antv/util/lib/mod */ "./node_modules/_@antv_util@2.0.9@@antv/util/lib/mod.js"); Object.defineProperty(exports, "mod", { enumerable: true, get: function () { return mod_1.default; } }); var is_number_equal_1 = __webpack_require__(/*! @antv/util/lib/is-number-equal */ "./node_modules/_@antv_util@2.0.9@@antv/util/lib/is-number-equal.js"); Object.defineProperty(exports, "isNumberEqual", { enumerable: true, get: function () { return is_number_equal_1.default; } }); var request_animation_frame_1 = __webpack_require__(/*! @antv/util/lib/request-animation-frame */ "./node_modules/_@antv_util@2.0.9@@antv/util/lib/request-animation-frame.js"); Object.defineProperty(exports, "requestAnimationFrame", { enumerable: true, get: function () { return request_animation_frame_1.default; } }); var clear_animation_frame_1 = __webpack_require__(/*! @antv/util/lib/clear-animation-frame */ "./node_modules/_@antv_util@2.0.9@@antv/util/lib/clear-animation-frame.js"); Object.defineProperty(exports, "clearAnimationFrame", { enumerable: true, get: function () { return clear_animation_frame_1.default; } }); /***/ }) /******/ }); }); //# sourceMappingURL=g.min.js.map