Latest repo

This commit is contained in:
Marc
2025-06-02 16:42:16 +00:00
parent 53ddf1a329
commit cde5fae175
27907 changed files with 3875388 additions and 1 deletions

35
node_modules/abs-svg-path/Readme.md generated vendored Normal file
View File

@@ -0,0 +1,35 @@
# abs-svg-path
redefine an svg path with absolute coordinates
## Installation
_With [packin](//github.com/jkroso/packin) or [component](//github.com/component/component)_
$ packin add jkroso/abs-svg-path
then in your app:
```js
var abs = require('abs-svg-path')
```
## API
### abs(path)
redefine `path` with absolute coordinates
```js
abs([['l',10,20],['l',30,40]]) // => [['L',10,20],['L',40,60]]
abs([
['q', 1,2, 33,44],
['L', 50,60],
['c', 1,2, 3,4, 33,44]
]) // => [['Q',1,2,33,44],['L', 50, 60],['C',51,62, 53,64, 83,104]]
```
## Running the tests
Just run `make test`

67
node_modules/abs-svg-path/index.js generated vendored Normal file
View File

@@ -0,0 +1,67 @@
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
})
}

19
node_modules/abs-svg-path/package.json generated vendored Normal file
View File

@@ -0,0 +1,19 @@
{
"name": "abs-svg-path",
"version": "0.1.1",
"description": "redefine an svg path with absolute coordinates",
"keywords": ["absolute","svg","path"],
"dependencies": {},
"devDependencies": {
"serve": "jkroso/serve",
"parse-svg-path": "*",
"mocha": "*",
"chai": "*",
"jsmd": "*"
},
"repository": "git://github.com/jkroso/abs-svg-path.git",
"bugs": "https://github.com/jkroso/abs-svg-path/issues",
"author": "Jake Rosoman",
"files": ["index.js"],
"license": "MIT"
}