Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

nudged

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nudged - npm Package Compare versions

Comparing version 1.5.0 to 1.6.0

48

index.js

@@ -57,2 +57,50 @@ exports.Transform = require('./lib/Transform')

// Expressions for createFromString
var cssMatrix = /\s*matrix\(([-+\w ,.%]+)\)/
var cssMatrixDelimiter = /\s*,\s*/
exports.createFromString = function (str) {
// Create a nudged.Transform instance from a string that uses
// the CSS transform matrix syntax: 'matrix(1.0, 2.0, 3.0, 4.0, 5.0, 6.0)'
//
// Together with nudged.Transform#toString(), this method makes an easy
// serialization and deserialization to and from strings.
//
// Note that the function does not yet support other CSS transform functions
// such as 'translate' or 'perspective'. It might also give unexpected
// results if the matrix exhibits shear or non-uniform scaling.
//
// Parameter:
// str
// string, the transform description
//
// Return
// a Transform
//
// Throws
// if no valid transform is found
//
var matrixMatch = str.match(cssMatrix)
if (!matrixMatch) {
throw new Error('Invalid CSS matrix string: ' + str)
}
var elemStrings = matrixMatch[1].split(cssMatrixDelimiter)
var elems = []
var i
for (i = 0; i < elemStrings.length; i += 1) {
elems.push(parseFloat(elemStrings[i]))
}
var s = elems[0]
var r = elems[1]
// skip [2][3] => forget shear or non-uniform scaling
var tx = elems[4]
var ty = elems[5]
return new exports.Transform(s, r, tx, ty)
}
exports.estimate = function (type, domain, range, pivot) {

@@ -59,0 +107,0 @@ // Parameter

2

lib/version.js
// generated by genversion
module.exports = '1.5.0'
module.exports = '1.6.0'
{
"name": "nudged",
"version": "1.5.0",
"version": "1.6.0",
"description": "Affine transformation estimator e.g. for multi-touch gestures and calibration",

@@ -5,0 +5,0 @@ "keywords": [

# nudged
[![NPM Version](https://img.shields.io/npm/v/nudged.svg)](https://www.npmjs.com/package/nudged)
[![Build Status](https://img.shields.io/travis/axelpale/nudged/master.svg)](https://travis-ci.org/axelpale/nudged)
[![Build Status](https://img.shields.io/travis/com/axelpale/nudged)](https://travis-ci.com/github/axelpale/nudged)

@@ -23,3 +23,3 @@ *Nudged* is **a JavaScript module** to efficiently estimate translation, scale, and/or rotation between two sets of 2D points. It has already been applied to **user interfaces, multi-touch recognition, geography, and eye tracker calibration**.

In general, you can apply Nudged in any situation where you want to capture a 2D transformation based on a movement of any number of control points. There are different See the image below for available types of transforms Nudged can estimate.
In general, you can apply Nudged in any situation where you want to capture a 2D transformation based on a movement of any number of control points. See the image below for available types of transforms Nudged can estimate.

@@ -177,2 +177,9 @@ <img src="doc/transformation-types.jpg" alt="Types of transformation estimators"/><br>

### nudged.createFromString(str)
Create a `nudged.Transform` instance from a CSS transform matrix string. Compatible with `nudged.Transform#toString()`.
> var css = 'matrix(1.0, 2.0, -2.0, 1.0, 3.0, 4.0)'
> var t = nudged.createFromString(css)
### nudged.estimate(type, domain, range, param?)

@@ -411,5 +418,5 @@

- When feature finished, merge:
- `$ git checkout master`
- `$ git merge feature-name`
- `$ git push`
- `$ git checkout master`
- `$ git merge feature-name`
- `$ git push`
- Delete the feature branch.

@@ -420,6 +427,6 @@ - Bump version in package.json, `npm run gv`, and run tests.

- Create [tag](https://git-scm.com/book/en/v2/Git-Basics-Tagging):
- `$ git tag -a 7.7.7 -m "v7.7.7 Superb Name"`
- `$ git tag -a 7.7.7 -m "v7.7.7 Superb Name"`
- `$ git push --tags`
- Publish to npm:
- `$ npm publish`
- `$ npm publish`

@@ -426,0 +433,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc