1 | "use strict";
|
2 |
|
3 | Object.defineProperty(exports, "__esModule", {
|
4 | value: true
|
5 | });
|
6 | exports.parseCss = parseCss;
|
7 | exports.parseSvg = parseSvg;
|
8 |
|
9 | var _decompose = _interopRequireWildcard(require("./decompose.js"));
|
10 |
|
11 | function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
12 |
|
13 | function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
14 |
|
15 | var svgNode;
|
16 |
|
17 |
|
18 | function parseCss(value) {
|
19 | const m = new (typeof DOMMatrix === "function" ? DOMMatrix : WebKitCSSMatrix)(value + "");
|
20 | return m.isIdentity ? _decompose.identity : (0, _decompose.default)(m.a, m.b, m.c, m.d, m.e, m.f);
|
21 | }
|
22 |
|
23 | function parseSvg(value) {
|
24 | if (value == null) return _decompose.identity;
|
25 | if (!svgNode) svgNode = document.createElementNS("http://www.w3.org/2000/svg", "g");
|
26 | svgNode.setAttribute("transform", value);
|
27 | if (!(value = svgNode.transform.baseVal.consolidate())) return _decompose.identity;
|
28 | value = value.matrix;
|
29 | return (0, _decompose.default)(value.a, value.b, value.c, value.d, value.e, value.f);
|
30 | } |
\ | No newline at end of file |