Spaces:
Paused
Paused
Download node_modules/abs-svg-path/index.js from Leon4gr45/UserSyncFrontend: direct link, hf CLI and curl.
- Browser
- Download file 991 Bytes
-
https://huggingface.co/spaces/Leon4gr45/UserSyncFrontend/resolve/main/node_modules/abs-svg-path/index.js
- Command line
-
hf download hf://spaces/Leon4gr45/UserSyncFrontend/node_modules/abs-svg-path/index.js
-
curl -L -o index.js https://huggingface.co/spaces/Leon4gr45/UserSyncFrontend/resolve/main/node_modules/abs-svg-path/index.js
991 Bytes
| module.exports = absolutize | |
| /** | |
| * redefine `path` with absolute coordinates | |
| * | |
| * @param {Array} path | |
| * @return {Array} | |
| */ | |
| function absolutize(path){ | |
| var startX = 0 | |
| var startY = 0 | |
| var x = 0 | |
| var y = 0 | |
| return path.map(function(seg){ | |
| seg = seg.slice() | |
| var type = seg[0] | |
| var command = type.toUpperCase() | |
| // is relative | |
| if (type != command) { | |
| seg[0] = command | |
| switch (type) { | |
| case 'a': | |
| seg[6] += x | |
| seg[7] += y | |
| break | |
| case 'v': | |
| seg[1] += y | |
| break | |
| case 'h': | |
| seg[1] += x | |
| break | |
| default: | |
| for (var i = 1; i < seg.length;) { | |
| seg[i++] += x | |
| seg[i++] += y | |
| } | |
| } | |
| } | |
| // update cursor state | |
| switch (command) { | |
| case 'Z': | |
| x = startX | |
| y = startY | |
| break | |
| case 'H': | |
| x = seg[1] | |
| break | |
| case 'V': | |
| y = seg[1] | |
| break | |
| case 'M': | |
| x = startX = seg[1] | |
| y = startY = seg[2] | |
| break | |
| default: | |
| x = seg[seg.length - 2] | |
| y = seg[seg.length - 1] | |
| } | |
| return seg | |
| }) | |
| } | |