StructV2/dist/sv.js

1 line
3.6 MiB
JavaScript
Raw Normal View History

2021-04-24 12:48:54 +00:00
!function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var n=e();for(var i in n)("object"==typeof exports?exports:t)[i]=n[i]}}(window,(function(){return function(t){var e={};function n(i){if(e[i])return e[i].exports;var l=e[i]={i:i,l:!1,exports:{}};return t[i].call(l.exports,l,l.exports,n),l.l=!0,l.exports}return n.m=t,n.c=e,n.d=function(t,e,i){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:i})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var l in t)n.d(i,l,function(e){return t[e]}.bind(null,l));return i},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=2)}([function(module,exports,__webpack_require__){"use strict";eval("\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nexports.Util = void 0;\r\nconst StructV_1 = __webpack_require__(2);\r\nexports.Util = {\r\n generateId() {\r\n return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {\r\n let r = Math.random() * 16 | 0, v = c == 'x' ? r : (r & 0x3 | 0x8);\r\n return v.toString(16);\r\n });\r\n },\r\n objectClone(obj) {\r\n return obj ? JSON.parse(JSON.stringify(obj)) : {};\r\n },\r\n removeFromList(list, fn) {\r\n for (let i = 0; i < list.length; i++) {\r\n fn(list[i]) && list.splice(i, 1) && i--;\r\n }\r\n },\r\n assert(condition, errorText) {\r\n if (condition) {\r\n throw errorText;\r\n }\r\n },\r\n textParser(text) {\r\n let fieldReg = /\\[[^\\]]*\\]/g;\r\n if (fieldReg.test(text)) {\r\n let contents = text.match(fieldReg), values = contents.map(item => item.replace(/\\[|\\]/g, ''));\r\n return values;\r\n }\r\n else {\r\n return text;\r\n }\r\n },\r\n clamp(value, max, min) {\r\n if (value <= max && value >= min)\r\n return value;\r\n if (value > max)\r\n return max;\r\n if (value < min)\r\n return min;\r\n },\r\n converterList(constructedDataType) {\r\n return [].concat(...Object.keys(constructedDataType).map(item => constructedDataType[item]));\r\n },\r\n convertG6Data(constructedData) {\r\n let nodes = [...exports.Util.converterList(constructedData.element), ...exports.Util.converterList(constructedData.pointer)], edges = exports.Util.converterList(constructedData.link);\r\n return {\r\n nodes: nodes.map(item => item.cloneProps()),\r\n edges: edges.map(item => item.cloneProps())\r\n };\r\n },\r\n calcRotateMatrix(matrix, rotation) {\r\n const Mat3 = StructV_1.SV.G6.Util.mat3;\r\n Mat3.rotate(matrix, matrix, rotation);\r\n return matrix;\r\n }\r\n};\r\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9zcmMvQ29tbW9uL3V0aWwudHM/YWZkMSJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUFDQSx5Q0FBZ0M7QUFPbkIsWUFBSSxHQUFHO0lBTWhCLFVBQVU7UUFDTixPQUFPLHNDQUFzQyxDQUFDLE9BQU8sQ0FBQyxPQUFPLEVBQUUsVUFBUyxDQUFDO1lBQ3JFLElBQUksQ0FBQyxHQUFHLElBQUksQ0FBQyxNQUFNLEVBQUUsR0FBQyxFQUFFLEdBQUMsQ0FBQyxFQUFFLENBQUMsR0FBRyxDQUFDLElBQUksR0FBRyxDQUFDLENBQUMsQ0FBQyxDQUFDLENBQUMsQ0FBQyxDQUFDLENBQUMsQ0FBQyxHQUFDLEdBQUcsR0FBQyxHQUFHLENBQUMsQ0FBQztZQUMzRCxPQUFPLENBQUMsQ0FBQyxRQUFRLENBQUMsRUFBRSxDQUFDLENBQUM7UUFDMUIsQ0FBQyxDQUFDLENBQUM7SUFDUCxDQUFDO0lBTUQsV0FBVyxDQUFtQixHQUFNO1FBQ2hDLE9BQU8sR0FBRyxFQUFDLENBQUMsSUFBSSxDQUFDLEtBQUssQ0FBQyxJQUFJLENBQUMsU0F