svg-path-simplify 0.4.1 → 0.4.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +19 -0
- package/README.md +6 -4
- package/dist/svg-path-simplify.esm.js +2450 -888
- package/dist/svg-path-simplify.esm.min.js +2 -2
- package/dist/svg-path-simplify.js +2450 -888
- package/dist/svg-path-simplify.min.js +2 -2
- package/dist/svg-path-simplify.pathdata.esm.js +167 -85
- package/dist/svg-path-simplify.pathdata.esm.min.js +2 -2
- package/docs/privacy-webapp.md +24 -0
- package/index.html +333 -132
- package/package.json +5 -2
- package/src/css_parse.js +317 -0
- package/src/detect_input.js +34 -4
- package/src/pathData_simplify_harmonize_cpts.js +77 -1
- package/src/pathSimplify-main.js +246 -262
- package/src/pathSimplify-presets.js +243 -0
- package/src/poly-fit-curve-schneider.js +14 -7
- package/src/simplify_poly_RC.js +102 -0
- package/src/simplify_poly_RDP.js +109 -1
- package/src/simplify_poly_radial_distance.js +3 -3
- package/src/string_helpers.js +144 -0
- package/src/svgii/convert_units.js +8 -2
- package/src/svgii/geometry.js +182 -3
- package/src/svgii/geometry_length.js +237 -0
- package/src/svgii/pathData_convert.js +43 -1
- package/src/svgii/pathData_fix_directions.js +6 -0
- package/src/svgii/pathData_fromPoly.js +3 -3
- package/src/svgii/pathData_getLength.js +86 -0
- package/src/svgii/pathData_parse.js +2 -0
- package/src/svgii/pathData_parse_els.js +189 -189
- package/src/svgii/pathData_split_to_groups.js +168 -0
- package/src/svgii/pathData_stringify.js +26 -64
- package/src/svgii/pathData_toPolygon.js +3 -4
- package/src/svgii/poly_analyze.js +61 -0
- package/src/svgii/poly_normalize.js +11 -2
- package/src/svgii/poly_to_pathdata.js +85 -24
- package/src/svgii/rounding.js +8 -7
- package/src/svgii/svg-styles-to-attributes-const.js +1 -0
- package/src/svgii/svg_cleanup.js +467 -421
- package/src/svgii/svg_cleanup_convertPathLength.js +32 -0
- package/src/svgii/svg_cleanup_general_svg_atts.js +97 -0
- package/src/svgii/svg_cleanup_normalize_transforms.js +83 -0
- package/src/svgii/svg_cleanup_remove_els_and_atts.js +72 -0
- package/src/svgii/svg_cleanup_ungroup.js +36 -0
- package/src/svgii/svg_el_parse_style_props.js +76 -28
- package/src/svgii/svg_getElementLength.js +67 -0
- package/tests/testSVG_shape.js +59 -0
- package/tests/testSVG_transform.js +61 -0
package/index.html
CHANGED
|
@@ -67,25 +67,25 @@
|
|
|
67
67
|
<script src="demo/samples.js" defer></script>
|
|
68
68
|
|
|
69
69
|
<!-- Md parser -->
|
|
70
|
-
<script src="https://cdn.jsdelivr.net/gh/UmemotoCtrl/mdpjs@0.1.4/js/mdp.min.js"
|
|
70
|
+
<script src="https://cdn.jsdelivr.net/gh/UmemotoCtrl/mdpjs@0.1.4/js/mdp.min.js" defer></script>
|
|
71
71
|
|
|
72
72
|
<!-- Zip creation -->
|
|
73
73
|
<script src="https://cdn.jsdelivr.net/npm/uzip@0.20201231.0/UZIP.min.js" async></script>
|
|
74
74
|
|
|
75
75
|
|
|
76
76
|
<!-- UI helpers -->
|
|
77
|
-
<link rel="preload" href="https://cdn.jsdelivr.net/npm/enhance-inputs@0.3.7/dist/enhanceInputs.min.css"
|
|
78
|
-
as="style" />
|
|
79
77
|
|
|
80
|
-
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/enhance-inputs@0.3.7/dist/enhanceInputs.min.css">
|
|
81
|
-
<script src="https://cdn.jsdelivr.net/npm/enhance-inputs@0.3.7/dist/enhanceInputs.min.js" defer></script>
|
|
82
78
|
|
|
79
|
+
<link rel="preload" href="https://cdn.jsdelivr.net/npm/enhance-inputs@0.4.1/dist/enhanceInputs.min.css"
|
|
80
|
+
as="style" />
|
|
81
|
+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/enhance-inputs@0.4.1/dist/enhanceInputs.min.css">
|
|
82
|
+
<script src="https://cdn.jsdelivr.net/npm/enhance-inputs@0.4.1/dist/enhanceInputs.min.js" defer></script>
|
|
83
83
|
<!--
|
|
84
|
-
|
|
85
|
-
|
|
84
|
+
|
|
85
|
+
<link rel="stylesheet" href="//localhost/___git/enhance-inputs/enhance-inputs/dist/enhanceInputs.css">
|
|
86
|
+
<script src="//localhost/___git/enhance-inputs/enhance-inputs/dist/enhanceInputs.js" defer></script>
|
|
86
87
|
-->
|
|
87
88
|
|
|
88
|
-
|
|
89
89
|
<!--
|
|
90
90
|
<script src="https://cdn.jsdelivr.net/npm/svg-path-simplify@0.1.2/dist/svg-path-simplify.min.js" defer></script>
|
|
91
91
|
-->
|
|
@@ -124,53 +124,20 @@
|
|
|
124
124
|
</p>
|
|
125
125
|
|
|
126
126
|
<h1 class="txt-cnt h1">Simplify SVG files and path data</h1>
|
|
127
|
-
<h2 class="p txt-cnt">
|
|
127
|
+
<h2 class="p txt-cnt">Optimize and sanitize SVG data by removing excessive commands and applying markup
|
|
128
128
|
minifications such as coordinate rounding, relative and applicable shorthand commands</h2>
|
|
129
129
|
|
|
130
|
-
<p
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
<h3>Simplification</h3>
|
|
136
|
-
<p>Enter your SVG pathData or complete file markup or upload SVG files.</p>
|
|
137
|
-
<p class="fnt-wgh-700">All data is processed 100% client-side – no data is transferred or analyzed
|
|
138
|
-
by any third-party service during simplification.</p>
|
|
139
|
-
|
|
140
|
-
<h3>Sharing and editing</h3>
|
|
141
|
-
<ul>
|
|
142
|
-
<li>Codepen – sends your current data to <a href="https://codepen.io">codepen.io</a> and creates
|
|
143
|
-
a new pen
|
|
144
|
-
for testing purposes</li>
|
|
145
|
-
<li>Edit – sends data to <a href="https://yqnn.github.io/svg-path-editor">svg-path-editor</a>
|
|
146
|
-
for further
|
|
147
|
-
path node editing</li>
|
|
148
|
-
</ul>
|
|
149
|
-
|
|
150
|
-
<h3>External scripts</h3>
|
|
151
|
-
<p>The webapp loads these external scripts from jsdelivr</p>
|
|
152
|
-
<ul>
|
|
153
|
-
<li><a href="https://github.com/WebReflection/linkedom">linkedom</a>
|
|
154
|
-
– used for web worker based multi file
|
|
155
|
-
processing</li>
|
|
156
|
-
<li><a href="https://github.com/photopea/UZIP.js">UZIP</a>
|
|
157
|
-
– for multifile zip exports</li>
|
|
158
|
-
<li><a href="https://github.com/herrstrietzel/enhance-inputs">enhance-inputs</a>
|
|
159
|
-
– used for GUI input
|
|
160
|
-
styling and updating logic</li>
|
|
161
|
-
</ul>
|
|
162
|
-
|
|
163
|
-
<h3>Local Storage</h3>
|
|
164
|
-
<p>Your current settings as well as your input SVG data is stored in local Storage. This provides to
|
|
165
|
-
apply the same settings to multiple files after reloads. You can delete this settings cache via
|
|
166
|
-
the reset settings button.</p>
|
|
167
|
-
<p>You image data is never transferred to the github server.</p>
|
|
168
|
-
|
|
169
|
-
</details>
|
|
130
|
+
<p>Use the usual shortcuts for copying, pasting or saving output: <kbd>Ctrl</kbd>/<kbd>⌘</kbd> +
|
|
131
|
+
<kbd>C</kbd>, <kbd>Ctrl</kbd>/<kbd>⌘</kbd> + <kbd>V</kbd>,
|
|
132
|
+
<kbd>Ctrl</kbd>/<kbd>⌘</kbd> + <kbd>S</kbd>
|
|
133
|
+
</p>
|
|
170
134
|
|
|
135
|
+
<!--
|
|
136
|
+
<p class="--btn-neg" data-ui="reset"></p>
|
|
137
|
+
-->
|
|
171
138
|
|
|
172
139
|
<p><input type="file" class="dsp-non --btn-neg" id="inputFile" name="svgFile" value="upload"
|
|
173
|
-
data-label="Upload SVG file/s" accept=".svg" data-ignore
|
|
140
|
+
data-label="Upload SVG file/s" accept=".svg" data-ignore multiple></p>
|
|
174
141
|
|
|
175
142
|
|
|
176
143
|
<p>
|
|
@@ -184,101 +151,139 @@
|
|
|
184
151
|
</textarea>
|
|
185
152
|
</label>
|
|
186
153
|
|
|
187
|
-
<details open>
|
|
188
|
-
<summary class="h3">SVG cleanup</summary>
|
|
189
|
-
<p>
|
|
190
|
-
<!--
|
|
191
|
-
<label><input type="checkbox" name="removePrologue" checked>removePrologue</label>
|
|
192
|
-
-->
|
|
193
154
|
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
155
|
+
<details open class="detailsRemoveElements">
|
|
156
|
+
<summary class="h3">SVG elements/nodes</summary>
|
|
157
|
+
|
|
158
|
+
<label><input type="checkbox" data-type="checkbox-switch" name="removeNameSpaced"
|
|
159
|
+
aria-description="Graphic applications often add a lot of propriatary/custom elements – not required for browser or exchange format usage"
|
|
160
|
+
checked>removeNameSpaced</label>
|
|
197
161
|
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
162
|
+
<label><input type="checkbox" data-type="checkbox-switch" name="cleanupDefs"
|
|
163
|
+
aria-description="Removes empty defs and moves all defs to the top of the SVG markup – many environments struggle with footer placements (figma problem)"
|
|
164
|
+
checked>cleanupDefs</label>
|
|
201
165
|
|
|
166
|
+
<label><input type="checkbox" data-type="checkbox-switch" name="cleanupClip" checked
|
|
167
|
+
aria-description="Removes unnecessary clip-paths – spanning the entire viewBox (e.g typical for figma)">cleanupClip</label>
|
|
202
168
|
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
checked>removeHidden</label>
|
|
169
|
+
<label><input type="checkbox" data-type="checkbox-switch" name="removeOffCanvas"
|
|
170
|
+
aria-description="Removes elements beyond viewBox/outside viewport">removeOffCanvas</label>
|
|
206
171
|
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
172
|
+
<label><input type="checkbox" data-type="checkbox-switch" name="removeComments"
|
|
173
|
+
aria-description="Remove custom comments – disable it if you placed explanatory comments yourself"
|
|
174
|
+
checked>removeComments</label>
|
|
210
175
|
|
|
211
|
-
|
|
212
|
-
|
|
176
|
+
<label><input type="checkbox" data-type="checkbox-switch" name="removeHidden"
|
|
177
|
+
aria-description="Graphic applications usually don't exclude hidden layers – enable it to remove them to remove undesired bloat"
|
|
178
|
+
checked>removeHidden</label>
|
|
213
179
|
|
|
214
180
|
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
181
|
+
<!-- elements in current svg-->
|
|
182
|
+
<div id="removeSvgElsWrp" class="enhancedInputsDynamic">
|
|
183
|
+
</div>
|
|
184
|
+
</details>
|
|
218
185
|
|
|
219
186
|
|
|
220
|
-
<label><input type="checkbox" data-type="checkbox-switch" name="removeOffCanvas"
|
|
221
|
-
aria-description="Removes elements beyond viewBox/outside viewport">removeOffCanvas</label>
|
|
222
187
|
|
|
223
|
-
|
|
224
|
-
|
|
188
|
+
<details open class="detailsRemoveSvgAttributes">
|
|
189
|
+
<summary class="h3">SVG attributes</summary>
|
|
225
190
|
|
|
191
|
+
<label><input type="checkbox" data-type="checkbox-switch" name="removeNameSpacedAtts"
|
|
192
|
+
aria-description="Graphic applications often add a lot of propriatary/custom attributes – not required for browser or exchange format usage"
|
|
193
|
+
checked>removeNameSpacedAtts</label>
|
|
226
194
|
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
195
|
+
|
|
196
|
+
<label><input type="checkbox" data-type="checkbox-switch" name="cleanupSVGAtts"
|
|
197
|
+
aria-description="Remove SVG non-presentational attributes from the root SVG"
|
|
198
|
+
checked>cleanupSVGAtts</label>
|
|
199
|
+
|
|
200
|
+
<label><input type="checkbox" data-type="checkbox-switch" name="allowMeta"
|
|
201
|
+
aria-description="Allows metadata elements as well as title and description elements">allowMeta</label>
|
|
202
|
+
|
|
203
|
+
<label><input type="checkbox" data-type="checkbox-switch" name="allowAriaAtts"
|
|
204
|
+
aria-description="Allows accessibility related ARIA attributes – probably added on purpose"
|
|
205
|
+
checked>allowAriaAtts</label>
|
|
206
|
+
|
|
207
|
+
<label><input type="checkbox" data-type="checkbox-switch" name="allowDataAtts"
|
|
208
|
+
aria-description="Allows custom data attributes – probably added on purpose"
|
|
209
|
+
checked>allowDataAtts</label>
|
|
210
|
+
|
|
211
|
+
<label><input type="checkbox" data-type="checkbox-switch" name="addViewBox" checked
|
|
212
|
+
aria-description="Adds a viewBox attribute if missing – counter-productive if your SVG layout is fluid">addViewBox</label>
|
|
213
|
+
|
|
214
|
+
<label><input type="checkbox" data-type="checkbox-switch" name="addDimensions"
|
|
215
|
+
aria-description="Many graphic applications won't translate viewBox correctly to artboard/document size">addDimensions</label>
|
|
216
|
+
|
|
217
|
+
<label><input type="checkbox" data-type="checkbox-switch"
|
|
218
|
+
name="removeDimensions">removeDimensions</label>
|
|
219
|
+
<label><input type="checkbox" data-type="checkbox-switch" name="removeIds"
|
|
220
|
+
aria-description="Graphic applications usually add unsemantic generic IDs for each layer – remove them unless you need them for JS selection (e.g event bindings)">removeIds</label>
|
|
221
|
+
<label><input type="checkbox" data-type="checkbox-switch"
|
|
222
|
+
aria-description="Graphic applications often add un semantic class names – remove these unless you have specified them on your own or these are required for CSS styling (e.g icon assets)"
|
|
223
|
+
name="removeClassNames">removeClassNames</label>
|
|
224
|
+
|
|
225
|
+
<label><input type="checkbox" data-type="checkbox-switch" name="omitNamespace"
|
|
226
|
+
aria-description="Removes xmlns attribute - only recommended when embedding svg in DOM">omitNamespace</label>
|
|
227
|
+
|
|
228
|
+
<div id="removeSVGAttsWrp" class="enhancedInputsDynamic">
|
|
229
|
+
</div>
|
|
232
230
|
</details>
|
|
233
231
|
|
|
232
|
+
|
|
234
233
|
<details open>
|
|
235
234
|
<summary class="h3">SVG style optimization</summary>
|
|
236
235
|
<p>
|
|
236
|
+
<!--
|
|
237
|
+
<label><input type="checkbox" data-type="checkbox-switch" name="convertPathLength"
|
|
238
|
+
aria-description="Converts pathLength attribute to absolute dasharray values – many graphic apps han't handle pathLength">convertPathLength</label>
|
|
239
|
+
|
|
240
|
+
-->
|
|
241
|
+
<label><input type="checkbox" data-type="checkbox-switch" name="stylesToAttributes"
|
|
242
|
+
aria-description="replaces inline styles with SVG atributes and removes obsolete attributes and styles">stylesToAttributes</label>
|
|
243
|
+
|
|
244
|
+
|
|
237
245
|
<label><input type="checkbox" data-type="checkbox-switch" name="cleanUpStrokes" checked
|
|
238
246
|
aria-description="removes stroke attributes when stroke color is missing">cleanUpStrokes</label>
|
|
239
247
|
|
|
240
|
-
<label><input type="checkbox" data-type="checkbox-switch" name="
|
|
241
|
-
aria-description="
|
|
248
|
+
<label><input type="checkbox" data-type="checkbox-switch" name="attributesToGroup"
|
|
249
|
+
aria-description="Try to combine style attributes in group">attributesToGroup</label>
|
|
242
250
|
|
|
243
251
|
<label><input type="checkbox" data-type="checkbox-switch" name="minifyRgbColors"
|
|
244
|
-
aria-description="Minifies RGB colors e.g for fill, stroke or stop-color"
|
|
245
|
-
|
|
252
|
+
aria-description="Minifies RGB colors e.g for fill, stroke or stop-color"
|
|
253
|
+
checked>minifyRgbColors</label>
|
|
246
254
|
|
|
247
255
|
</p>
|
|
248
256
|
|
|
249
257
|
</details>
|
|
250
258
|
|
|
251
259
|
|
|
252
|
-
<details open>
|
|
253
|
-
<summary class="h3">
|
|
260
|
+
<details open class="detailsRemoveElAttributes">
|
|
261
|
+
<summary class="h3">Child attributes</summary>
|
|
254
262
|
|
|
255
|
-
<
|
|
256
|
-
|
|
257
|
-
|
|
263
|
+
<label><input type="checkbox" data-type="checkbox-switch" name="fixHref"
|
|
264
|
+
aria-description="Replaces xlink:href with href – many applications still rely on xlink:href notation!">fixHref</label>
|
|
265
|
+
|
|
266
|
+
<label><input type="checkbox" data-type="checkbox-switch" name="legacyHref"
|
|
267
|
+
aria-description="Since many (non-browser) applications still depend on xlink:href notation you may convert href to xlink:href">legacyHref</label>
|
|
258
268
|
|
|
259
|
-
|
|
260
|
-
|
|
269
|
+
<!--dynamically added -->
|
|
270
|
+
<div id="removeElAttsWrp" class="enhancedInputsDynamic ">
|
|
271
|
+
</div>
|
|
272
|
+
</details>
|
|
261
273
|
|
|
262
274
|
|
|
275
|
+
<details open>
|
|
276
|
+
<summary class="h3">SVG merging/splitting</summary>
|
|
277
|
+
<p>
|
|
263
278
|
<label><input type="checkbox" data-type="checkbox-switch" name="mergePaths"
|
|
264
279
|
aria-description="Merge adjacent paths – can minify file size but won't allow you to select individual paths">mergePaths</label>
|
|
265
280
|
|
|
266
|
-
<label><input type="checkbox" data-type="checkbox-switch"
|
|
267
|
-
|
|
268
|
-
<label><input type="checkbox" data-type="checkbox-switch" name="removeIds"
|
|
269
|
-
aria-description="Graphic applications usually add unsemantic generic IDs for each layer – remove them unless you need them for JS selection (e.g event bindings)">removeIds</label>
|
|
270
|
-
<label><input type="checkbox" data-type="checkbox-switch"
|
|
271
|
-
aria-description="Graphic applications often add un semantic class names – remove these unless you have specified them on your own or these are required for CSS styling (e.g icon assets)"
|
|
272
|
-
name="removeClassNames">removeClassNames</label>
|
|
273
|
-
|
|
274
|
-
<label><input type="checkbox" data-type="checkbox-switch" name="omitNamespace"
|
|
275
|
-
aria-description="Removes xmlns attribute - only recommended when embedding svg in DOM">omitNamespace</label>
|
|
281
|
+
<label><input type="checkbox" data-type="checkbox-switch" name="unGroup"
|
|
282
|
+
aria-description="Applications often add too many nest groups – removing also converts any styles to elements">unGroup</label>
|
|
276
283
|
|
|
277
|
-
<label><input type="checkbox" data-type="checkbox-switch" name="
|
|
278
|
-
aria-description="
|
|
284
|
+
<label><input type="checkbox" data-type="checkbox-switch" name="splitCompound"
|
|
285
|
+
aria-description="Tries to split compound paths finding overlapping compound sub paths">splitCompound</label>
|
|
279
286
|
|
|
280
|
-
<label><input type="checkbox" data-type="checkbox-switch" name="legacyHref"
|
|
281
|
-
aria-description="Since many (non-browser) applications still depend on xlink:href notation you may convert href to xlink:href">legacyHref</label>
|
|
282
287
|
|
|
283
288
|
</p>
|
|
284
289
|
|
|
@@ -322,17 +327,29 @@
|
|
|
322
327
|
</p>
|
|
323
328
|
|
|
324
329
|
<p>
|
|
325
|
-
<label><input type="checkbox" data-type="checkbox-switch" name="
|
|
326
|
-
aria-description="convert paths to rects if applicable">rects</label>
|
|
330
|
+
<label><input type="checkbox" data-type="checkbox-switch" name="convertShapes[]" value="rect"
|
|
331
|
+
checked aria-description="convert paths to rects if applicable">rects</label>
|
|
327
332
|
|
|
328
|
-
<label><input type="checkbox" data-type="checkbox-switch" name="
|
|
329
|
-
|
|
333
|
+
<label><input type="checkbox" data-type="checkbox-switch" name="convertShapes[]" value="circle"
|
|
334
|
+
checked
|
|
335
|
+
aria-description="convert paths to circles or ellipses if applicable – ellipses/circles are usually more compact than paths – unless you merge paths">circles</label>
|
|
330
336
|
|
|
331
|
-
<label><input type="checkbox" data-type="checkbox-switch" name="
|
|
332
|
-
|
|
337
|
+
<label><input type="checkbox" data-type="checkbox-switch" name="convertShapes[]" value="ellipse"
|
|
338
|
+
checked
|
|
339
|
+
aria-description="convert paths to circles or ellipses if applicable – ellipses/circles are usually more compact than paths – unless you merge paths">ellipse</label>
|
|
333
340
|
|
|
334
|
-
|
|
335
|
-
|
|
341
|
+
|
|
342
|
+
<label><input type="checkbox" data-type="checkbox-switch" name="convertShapes[]" value="polygon"
|
|
343
|
+
checked
|
|
344
|
+
aria-description="convert paths to polys if applicable – polylines are quite inefficient as they are all absolute">polygon</label>
|
|
345
|
+
|
|
346
|
+
<label><input type="checkbox" data-type="checkbox-switch" name="convertShapes[]"
|
|
347
|
+
value="polyline" checked
|
|
348
|
+
aria-description="convert paths to polys if applicable – polylines are quite inefficient as they are all absolute">polyline</label>
|
|
349
|
+
|
|
350
|
+
|
|
351
|
+
<label><input type="checkbox" data-type="checkbox-switch" name="convertShapes[]" value="line"
|
|
352
|
+
checked aria-description="convert paths to lines if applicable">line</label>
|
|
336
353
|
</p>
|
|
337
354
|
|
|
338
355
|
|
|
@@ -393,7 +410,15 @@
|
|
|
393
410
|
aria-description="Higher tolerance = sloppier approximations and more distortions – default 1"></label>
|
|
394
411
|
</p>
|
|
395
412
|
|
|
413
|
+
|
|
414
|
+
|
|
396
415
|
<p>
|
|
416
|
+
|
|
417
|
+
<label><input type="checkbox" data-type="checkbox-switch" name="keepSmaller"
|
|
418
|
+
aria-description="Ditches simplified output if original was more compact – useful for batch processing"
|
|
419
|
+
checked>keepSmaller</label>
|
|
420
|
+
|
|
421
|
+
|
|
397
422
|
<label><input type="checkbox" data-type="checkbox-switch" name="simplifyBezier"
|
|
398
423
|
aria-description="Tries to combine adjacent Bézier commands"
|
|
399
424
|
checked>simplifyBezier</label>
|
|
@@ -531,10 +556,18 @@
|
|
|
531
556
|
-->
|
|
532
557
|
</p>
|
|
533
558
|
|
|
559
|
+
<p>
|
|
560
|
+
<label>Output Polygon
|
|
561
|
+
<textarea class="outputPoly code" name="polyOut" id="polyOut" data-tools="size copy"
|
|
562
|
+
data-ignore="true" readonly data-file="polygon.txt"></textarea>
|
|
563
|
+
</label>
|
|
564
|
+
</p>
|
|
565
|
+
|
|
566
|
+
|
|
534
567
|
</details>
|
|
535
568
|
|
|
536
569
|
|
|
537
|
-
|
|
570
|
+
<details open>
|
|
538
571
|
<summary class="h3">SVG output settings</summary>
|
|
539
572
|
<p>
|
|
540
573
|
<label><input type="checkbox" data-type="checkbox-switch" name="toRelative"
|
|
@@ -543,6 +576,10 @@
|
|
|
543
576
|
<label><input type="checkbox" data-type="checkbox-switch" name="toShorthands"
|
|
544
577
|
aria-description="Converts all commands to shorthand when applicable – reduces file size"
|
|
545
578
|
checked>toShorthands</label>
|
|
579
|
+
|
|
580
|
+
<label><input type="checkbox" data-type="checkbox-switch" name="toMixed"
|
|
581
|
+
aria-description="Choose the most compact command relative or absolute – you won't be able to change the start position as with all relative commands">toMixed</label>
|
|
582
|
+
|
|
546
583
|
<label><input type="checkbox" data-type="checkbox-switch" name="lineToCubic"
|
|
547
584
|
aria-description="converts lines to cubics – helpful for morphing animations">lineToCubic</label>
|
|
548
585
|
|
|
@@ -553,6 +590,7 @@
|
|
|
553
590
|
<ul class="ul-bll">
|
|
554
591
|
<li><strong>Minify</strong> = maximum string minification – my lead to problems in older
|
|
555
592
|
applications!</li>
|
|
593
|
+
<li><strong>Safe</strong> = avoid floating point and arc param concatenation</li>
|
|
556
594
|
<li><strong>Verbose</strong> = don't omit command type tokens</li>
|
|
557
595
|
<li><strong>Beautify</strong>strong> = don't omit command type tokens and separate commands
|
|
558
596
|
by new lines – handy for educational usage</li>
|
|
@@ -560,6 +598,7 @@
|
|
|
560
598
|
</details>
|
|
561
599
|
|
|
562
600
|
<p><label><input type="radio" name="minifyD" value="0" checked>minify</label>
|
|
601
|
+
<label><input type="radio" name="minifyD" value="0.5">safe</label>
|
|
563
602
|
<label><input type="radio" name="minifyD" value="1">verbose</label>
|
|
564
603
|
<label><input type="radio" name="minifyD" value="2">beautify</label>
|
|
565
604
|
</p>
|
|
@@ -570,15 +609,14 @@
|
|
|
570
609
|
</p>
|
|
571
610
|
|
|
572
611
|
<p>
|
|
573
|
-
<label class="wdt-100">decimals <input type="number" name="decimals" min="
|
|
574
|
-
aria-description="Manual floating point rounding precision – overriden when autoAccuracy is enabled"></label>
|
|
612
|
+
<label class="wdt-100">decimals <input type="number" name="decimals" min="-1" value="1"
|
|
613
|
+
aria-description="Manual floating point rounding precision – overriden when autoAccuracy is enabled: -1 means no rounding"></label>
|
|
575
614
|
</p>
|
|
576
615
|
</details>
|
|
577
616
|
|
|
578
617
|
|
|
579
618
|
<details open>
|
|
580
619
|
<summary class="h3">Output</summary>
|
|
581
|
-
|
|
582
620
|
<p>
|
|
583
621
|
<label>Output SVG
|
|
584
622
|
<textarea class="outputSvg code" name="dOutput" id="outputSvg" data-tools="size copy"
|
|
@@ -586,16 +624,12 @@
|
|
|
586
624
|
</label>
|
|
587
625
|
</p>
|
|
588
626
|
|
|
589
|
-
<p>
|
|
590
|
-
<label>Output Polygon
|
|
591
|
-
<textarea class="outputPoly code" name="polyOut" id="polyOut" data-tools="size copy"
|
|
592
|
-
data-ignore="true" readonly data-file="polygon.txt"></textarea>
|
|
593
|
-
</label>
|
|
594
|
-
</p>
|
|
595
627
|
</details>
|
|
596
628
|
|
|
597
629
|
|
|
598
630
|
|
|
631
|
+
<!--
|
|
632
|
+
|
|
599
633
|
<details>
|
|
600
634
|
<summary class="h3">Settings</summary>
|
|
601
635
|
<p>
|
|
@@ -609,6 +643,7 @@
|
|
|
609
643
|
|
|
610
644
|
</p>
|
|
611
645
|
</details>
|
|
646
|
+
-->
|
|
612
647
|
|
|
613
648
|
|
|
614
649
|
</aside>
|
|
@@ -618,21 +653,39 @@
|
|
|
618
653
|
<main class="main --spn-ld-2 --spn-ld-3 scrollbar scroll-content pst-rlt">
|
|
619
654
|
|
|
620
655
|
|
|
621
|
-
<header class="pst-sticky --pdd-1em z-ind-1000 pdd-1em">
|
|
656
|
+
<header class="header-top pst-sticky --pdd-1em z-ind-1000 pdd-1em">
|
|
622
657
|
|
|
623
658
|
<div class="header-nav">
|
|
659
|
+
|
|
660
|
+
<!-- reset -->
|
|
661
|
+
<button type="button" class="btn btnReset" title="Reset settings" data-icon="arrow-path"></button>
|
|
662
|
+
|
|
663
|
+
|
|
624
664
|
<label class="navToggle"><input type="checkbox" name="showNav" class="showNav" id="showNav"
|
|
625
665
|
data-icon="adjustments-vertical" checked title="show settings" data-sync="showNav0"></label>
|
|
626
666
|
|
|
667
|
+
<!-- load about -->
|
|
627
668
|
<a href="#" class="a-dialog" data-dialog="#about" data-dialog-title="Options" data-icon="question"
|
|
628
669
|
title="Available parameters"></a>
|
|
629
670
|
|
|
671
|
+
<!-- load privacy -->
|
|
672
|
+
<a href="#" class="a-dialog" data-dialog="#privacy" data-dialog-title="privacy"
|
|
673
|
+
data-icon="finger-print" title="Privacy"></a>
|
|
674
|
+
|
|
675
|
+
|
|
676
|
+
<!-- presets -->
|
|
677
|
+
<button type="button" class="btn btn-presets" title="Presets" data-icon="gear"
|
|
678
|
+
data-menu-anchor="menu2"></button>
|
|
679
|
+
|
|
680
|
+
|
|
681
|
+
|
|
630
682
|
<button type="button" class="elzoomo-btn elzoomo-btn-zoomin" title="zoom in"
|
|
631
683
|
data-icon="plus"></button>
|
|
632
684
|
<button type="button" class="elzoomo-btn elzoomo-btn-zoomout" title="zoom out"
|
|
633
685
|
data-icon="minus"></button>
|
|
634
686
|
</div>
|
|
635
687
|
|
|
688
|
+
<!-- github link -->
|
|
636
689
|
<a class="lnk-github" href="https://github.com/herrstrietzel/svg-path-simplify"
|
|
637
690
|
title="See github repository">
|
|
638
691
|
<svg viewBox="0 0 24 24" class="icn-svg">
|
|
@@ -650,11 +703,23 @@
|
|
|
650
703
|
<div class="grd-btns grd grd-1 grd-ld-2 wrp-btns --txt-rgh">
|
|
651
704
|
|
|
652
705
|
<div class="col col-switch">
|
|
706
|
+
<p class="mrg-0 radios-show-original">
|
|
707
|
+
<label class="inl-blc"> <input type="radio" name="showOriginal" value="hide"
|
|
708
|
+
data-secondary="true" checked>optimized</label>
|
|
709
|
+
<label class="inl-blc"> <input type="radio" name="showOriginal" value="show"
|
|
710
|
+
data-secondary="true">original</label>
|
|
711
|
+
</p>
|
|
653
712
|
<p class="mrg-0">
|
|
654
|
-
<
|
|
655
|
-
|
|
713
|
+
<span>
|
|
714
|
+
<label><input type="checkbox" data-type="checkbox-switch" name="showMarkers"
|
|
715
|
+
data-secondary="true" checked>showMarkers</label>
|
|
716
|
+
<button type="button" class="btn btn-info btn-inline btn-menu btnConfig"
|
|
717
|
+
title="Edit marker size" data-icon="gear" data-menu-anchor="menu1"></button>
|
|
718
|
+
|
|
719
|
+
</span>
|
|
720
|
+
|
|
656
721
|
|
|
657
|
-
<label><input type="checkbox" data-type="checkbox-switch"
|
|
722
|
+
<label><input type="checkbox" data-type="checkbox-switch" data-secondary="true"
|
|
658
723
|
name="showTransparency">showTransparency</label>
|
|
659
724
|
</p>
|
|
660
725
|
</div>
|
|
@@ -747,15 +812,18 @@
|
|
|
747
812
|
<g id="markers"></g>
|
|
748
813
|
</svg>
|
|
749
814
|
|
|
750
|
-
<div id="svgWrap" class="svgWrap"
|
|
815
|
+
<div id="svgWrap" class="svgWrap">
|
|
816
|
+
<div id="svgWrapO" class="svgWrapO"></div>
|
|
817
|
+
<div id="svgWrapS" class="svgWrapS"></div>
|
|
818
|
+
</div>
|
|
819
|
+
|
|
820
|
+
|
|
751
821
|
<div id="svgWrapMulti" class="svgWrapMulti grd grd-2 grd-md-4 grd-ld-6 gap-1em"></div>
|
|
752
822
|
|
|
753
823
|
</div>
|
|
754
824
|
|
|
755
825
|
</div>
|
|
756
826
|
|
|
757
|
-
|
|
758
|
-
|
|
759
827
|
</main>
|
|
760
828
|
|
|
761
829
|
|
|
@@ -784,10 +852,143 @@
|
|
|
784
852
|
</div>
|
|
785
853
|
</dialog>
|
|
786
854
|
|
|
855
|
+
<dialog class="sr-only" id="privacy">
|
|
856
|
+
<div class="md-cnt" data-md="./docs/privacy-webapp.md">
|
|
857
|
+
</div>
|
|
858
|
+
</dialog>
|
|
859
|
+
|
|
860
|
+
|
|
861
|
+
<!-- menu presets -->
|
|
862
|
+
<div class="menu menu-presets menu-right-top pdd-1em --menu-active" data-menu="menu2">
|
|
863
|
+
<h4 class="h4">Presets</h4>
|
|
864
|
+
|
|
865
|
+
<p>
|
|
866
|
+
<label>
|
|
867
|
+
<input data-secondary type="radio" name="preset" value="0" aria-description="Custom settings"
|
|
868
|
+
checked>Custom
|
|
869
|
+
</label>
|
|
870
|
+
</p>
|
|
871
|
+
<!--
|
|
872
|
+
|
|
873
|
+
-->
|
|
874
|
+
|
|
875
|
+
<p>
|
|
876
|
+
<label>
|
|
877
|
+
<input data-secondary type="radio" name="preset" value="null"
|
|
878
|
+
aria-description="Disable all – passthrough">null
|
|
879
|
+
</label>
|
|
880
|
+
</p>
|
|
881
|
+
|
|
882
|
+
<p>
|
|
883
|
+
<label>
|
|
884
|
+
<input data-secondary type="radio" name="preset" value="default"
|
|
885
|
+
aria-description="Back to default settings">default
|
|
886
|
+
</label>
|
|
887
|
+
</p>
|
|
888
|
+
|
|
889
|
+
<p>
|
|
890
|
+
<label>
|
|
891
|
+
<input data-secondary type="radio" name="preset" value="education"
|
|
892
|
+
aria-description="Prettified output - all absolute and longhand commands">
|
|
893
|
+
education
|
|
894
|
+
</label>
|
|
895
|
+
</p>
|
|
896
|
+
|
|
897
|
+
<p>
|
|
898
|
+
<label>
|
|
899
|
+
<input data-secondary type="radio" name="preset" value="editor"
|
|
900
|
+
aria-description="Maximum compatibility for graphic editors">
|
|
901
|
+
editor
|
|
902
|
+
</label>
|
|
903
|
+
</p>
|
|
904
|
+
|
|
905
|
+
<p>
|
|
906
|
+
<label>
|
|
907
|
+
<input data-secondary type="radio" name="preset" value="path"
|
|
908
|
+
aria-description="Convert all shapes to paths">
|
|
909
|
+
path
|
|
910
|
+
</label>
|
|
911
|
+
</p>
|
|
912
|
+
|
|
913
|
+
<p>
|
|
914
|
+
<label>
|
|
915
|
+
<input data-secondary type="radio" name="preset" value="detransform"
|
|
916
|
+
aria-description="Convert transforms to geometry">
|
|
917
|
+
detransform
|
|
918
|
+
</label>
|
|
919
|
+
</p>
|
|
920
|
+
|
|
921
|
+
<p>
|
|
922
|
+
<label>
|
|
923
|
+
<input data-secondary type="radio" name="preset" value="poly" aria-description="Convert Bézier to poly">
|
|
924
|
+
poly
|
|
925
|
+
</label>
|
|
926
|
+
</p>
|
|
927
|
+
|
|
928
|
+
<p>
|
|
929
|
+
<label>
|
|
930
|
+
<input data-secondary type="radio" name="preset" value="curvefit"
|
|
931
|
+
aria-description="Convert polygon to Bézier">
|
|
932
|
+
curvefit
|
|
933
|
+
</label>
|
|
934
|
+
</p>
|
|
935
|
+
|
|
936
|
+
|
|
937
|
+
<p>
|
|
938
|
+
<label>
|
|
939
|
+
<input data-secondary type="radio" name="preset" value="noSimplification"
|
|
940
|
+
aria-description="Retains original geometry but applies rounding, conversion to relative and shorthands">
|
|
941
|
+
noSimplification
|
|
942
|
+
</label>
|
|
943
|
+
</p>
|
|
944
|
+
|
|
945
|
+
|
|
946
|
+
<p>
|
|
947
|
+
<label>
|
|
948
|
+
<input data-secondary type="radio" name="preset" value="high"
|
|
949
|
+
aria-description="Prioritize filesize: Enables more optimizations: cubicToArcs, mixed value compression simplification">
|
|
950
|
+
high
|
|
951
|
+
</label>
|
|
952
|
+
</p>
|
|
953
|
+
|
|
954
|
+
<details class="mrg-0-5em mrg-top">
|
|
955
|
+
<summary class="h4">Current settings</summary>
|
|
956
|
+
<p>
|
|
957
|
+
<label>Current Settings
|
|
958
|
+
<textarea class="code" name="config" id="textConfig" data-tools="copy" data-secondary
|
|
959
|
+
readonly></textarea>
|
|
960
|
+
</label>
|
|
961
|
+
<label><input type="checkbox" data-type="checkbox-switch" name="omitDefaults" data-secondary
|
|
962
|
+
aria-description="only include settings that are not defaults" checked>omitDefaults</label>
|
|
963
|
+
|
|
964
|
+
</p>
|
|
965
|
+
</details>
|
|
966
|
+
|
|
967
|
+
|
|
968
|
+
</div>
|
|
969
|
+
|
|
970
|
+
|
|
971
|
+
|
|
972
|
+
<!-- menu marker size-->
|
|
973
|
+
<div class="menu menu-marker-size menu-top-right --menu-active" data-menu="menu1">
|
|
974
|
+
<p>
|
|
975
|
+
<label>Marker size
|
|
976
|
+
<input type="number" id="inpuMarkerSize" name="markerSize" value="0.3" min="0.05" max="1" step="0.05"
|
|
977
|
+
data-ignore>
|
|
978
|
+
</label>
|
|
979
|
+
</p>
|
|
980
|
+
</div>
|
|
981
|
+
|
|
982
|
+
|
|
787
983
|
<!--
|
|
788
984
|
<div id="spriteMap"></div>
|
|
789
985
|
-->
|
|
790
986
|
|
|
987
|
+
|
|
988
|
+
|
|
989
|
+
|
|
990
|
+
|
|
991
|
+
|
|
791
992
|
</body>
|
|
792
993
|
|
|
793
994
|
</html>
|