|
2 | 2 | 'use strict'; |
3 | 3 |
|
4 | 4 | (function () { |
5 | | - function basicShapePolygonParse (input) { |
| 5 | + function basicShapePolygonParse (input, element) { |
6 | 6 | // TODO: Support the fill-rule option and % |
7 | 7 | var argumentList = input.split(','); |
8 | 8 | var coordinate = null; |
|
34 | 34 | return {type: 'path', path: path}; |
35 | 35 | } |
36 | 36 |
|
37 | | - function basicShapeCircleParse (input) { |
| 37 | + function basicShapeCircleParse (input, element) { |
38 | 38 | // TODO: Need element as an argument to this function |
39 | 39 | var radius; |
40 | 40 | var position = /at (.*?)$/.exec(input); |
|
69 | 69 | return {type: 'path', path: pathString}; |
70 | 70 | } |
71 | 71 |
|
72 | | - function basicShapeInsetParse (input) { |
| 72 | + function basicShapeInsetParse (input, element) { |
73 | 73 | // WIP |
74 | 74 | return null; |
75 | 75 | } |
76 | 76 |
|
77 | | - function basicShapeEllipseParse (input) { |
| 77 | + function basicShapeEllipseParse (input, element) { |
78 | 78 | // WIP |
79 | 79 | return null; |
80 | 80 | } |
81 | 81 |
|
82 | | - function parseNone (input) { |
| 82 | + function parseNone (input, element) { |
83 | 83 | if (input === 'none') { |
84 | 84 | return {type: null, angle: null, path: null}; |
85 | 85 | } |
86 | 86 | } |
87 | 87 |
|
88 | | - function parseRay (input) { |
| 88 | + function parseRay (input, element) { |
89 | 89 | var isInArray = internalScope.isInArray; |
90 | 90 | var parseAngleAsDegrees = internalScope.parseAngleAsDegrees; |
91 | 91 | var ray = /^ray\((.*)\)$/.exec(input); |
|
125 | 125 | return result; |
126 | 126 | } |
127 | 127 |
|
128 | | - function parsePath (input) { |
| 128 | + function parsePath (input, element) { |
129 | 129 | var path = /^path\(['"](.*)['"]\)$/.exec(input); |
130 | 130 | if (path === null) { |
131 | 131 | return undefined; |
|
134 | 134 | return {type: 'path', path: pathInput}; |
135 | 135 | } |
136 | 136 |
|
137 | | - function parseShape (input) { |
| 137 | + function parseShape (input, element) { |
138 | 138 | var isInArray = internalScope.isInArray; |
139 | 139 | var shapeType = /^[^\(]*/.exec(input); |
140 | 140 | if (shapeType == null) { |
|
151 | 151 | } |
152 | 152 | var toParse = [basicShapePolygonParse, basicShapeCircleParse, basicShapeInsetParse, basicShapeEllipseParse]; |
153 | 153 | for (var i = 0; i < toParse.length; i++) { |
154 | | - var result = toParse[i](shapeArguments[1]); |
| 154 | + var result = toParse[i](shapeArguments[1], element); |
155 | 155 | if (result) { |
156 | 156 | return result; |
157 | 157 | } |
158 | 158 | } |
159 | 159 | return undefined; |
160 | 160 | } |
161 | 161 |
|
162 | | - function offsetPathParse (input) { |
| 162 | + function offsetPathParse (input, element) { |
163 | 163 | // https://drafts.fxtf.org/motion-1/#offset-path-property |
164 | 164 | var toParse = [parseNone, parseRay, parsePath, parseShape]; |
165 | 165 | for (var i = 0; i < toParse.length; i++) { |
166 | | - var result = toParse[i](input); |
| 166 | + var result = toParse[i](input, element); |
167 | 167 | if (result) { |
168 | 168 | return result; |
169 | 169 | } |
|
0 commit comments