UNPKG

1.3 kBJavaScriptView Raw
1import { __decorate } from "tslib";
2import { singleton } from 'mana-syringe';
3import { Rectangle } from '../../shapes';
4import { CSSKeywordValue } from '../cssom';
5import { parsePath, mergePaths } from '../parser';
6
7var CSSPropertyPath =
8/** @class */
9function () {
10 function CSSPropertyPath() {
11 /**
12 * path2Curve
13 */
14 this.parser = parsePath;
15 this.mixer = mergePaths;
16 }
17
18 CSSPropertyPath.prototype.calculator = function (name, oldParsed, parsed) {
19 // unset
20 if (parsed instanceof CSSKeywordValue && parsed.value === 'unset') {
21 return {
22 absolutePath: [],
23 hasArc: false,
24 segments: [],
25 polygons: [],
26 polylines: [],
27 curve: [],
28 totalLength: 0,
29 curveSegments: [],
30 zCommandIndexes: [],
31 rect: new Rectangle(0, 0, 0, 0)
32 };
33 }
34
35 return parsed;
36 };
37 /**
38 * update local position
39 */
40
41
42 CSSPropertyPath.prototype.postProcessor = function (object) {
43 var _a = object.parsedStyle,
44 _b = _a.defX,
45 defX = _b === void 0 ? 0 : _b,
46 _c = _a.defY,
47 defY = _c === void 0 ? 0 : _c;
48 object.setLocalPosition(defX, defY);
49 };
50
51 CSSPropertyPath = __decorate([singleton()], CSSPropertyPath);
52 return CSSPropertyPath;
53}();
54
55export { CSSPropertyPath };
\No newline at end of file