UNPKG

1.04 kBJavaScriptView Raw
1import { __decorate } from "tslib";
2import { singleton } from 'mana-syringe';
3import { Shape } from '../../types';
4import { parseNumber, clampedMergeNumbers } from '../parser';
5
6var CSSPropertyOffsetDistance =
7/** @class */
8function () {
9 function CSSPropertyOffsetDistance() {
10 this.parser = parseNumber;
11 this.mixer = clampedMergeNumbers(0, 1);
12 }
13
14 CSSPropertyOffsetDistance.prototype.postProcessor = function (object) {
15 if (!object.attributes.offsetPath) {
16 return;
17 }
18
19 var offsetPathNodeName = object.attributes.offsetPath.nodeName;
20
21 if (offsetPathNodeName === Shape.LINE || offsetPathNodeName === Shape.PATH || offsetPathNodeName === Shape.POLYLINE) {
22 var point = object.attributes.offsetPath.getPoint(object.parsedStyle.offsetDistance.value);
23
24 if (point) {
25 object.setLocalPosition(point.x, point.y);
26 }
27 }
28 };
29
30 CSSPropertyOffsetDistance = __decorate([singleton()], CSSPropertyOffsetDistance);
31 return CSSPropertyOffsetDistance;
32}();
33
34export { CSSPropertyOffsetDistance };
\No newline at end of file