Skip to content

Commit

Permalink
update libs
Browse files Browse the repository at this point in the history
  • Loading branch information
gre committed May 25, 2017
1 parent 766da74 commit fb0b67b
Show file tree
Hide file tree
Showing 6 changed files with 307 additions and 326 deletions.
2 changes: 1 addition & 1 deletion example/package.json
Expand Up @@ -3,7 +3,7 @@
"version": "0.1.0",
"private": true,
"devDependencies": {
"react-scripts": "0.7.0"
"react-scripts": "1.0.6"
},
"dependencies": {
"bezier-easing-editor": "file:..",
Expand Down
10 changes: 5 additions & 5 deletions package.json
Expand Up @@ -11,11 +11,11 @@
],
"scripts": {
"compile": "rm -rf lib/ && babel --presets es2015,stage-1,react --source-maps -d lib src",
"watch": "babel --presets es2015,stage-1,react --source-maps -w -d lib src",
"prepublish": "npm run compile"
},
"peerDependencies": {
"react": "*",
"react-dom": "*"
"react": "*"
},
"repository": {
"type": "git",
Expand All @@ -29,7 +29,7 @@
"editor"
],
"author": "Gaëtan Renaudeau",
"license": "GPLv3",
"license": "MIT",
"bugs": {
"url": "https://github.com/gre/bezier-easing-editor/issues"
},
Expand All @@ -42,7 +42,7 @@
},
"dependencies": {
"bezier-easing": "^2.0.3",
"object-assign": "^4.1.0",
"uncontrollable": "^4.0.3"
"prop-types": "^15.5.10",
"uncontrollable": "^4.1.0"
}
}
31 changes: 9 additions & 22 deletions src/BezierComponent.js
@@ -1,32 +1,19 @@
import React from "react";

function interp (a, b, x) {
return a * (1-x) + b * x;
function interp(a, b, x) {
return a * (1 - x) + b * x;
}

export default class BezierComponent extends React.Component {
constructor (props) {
super(props);
this.x = this.x.bind(this);
this.y = this.y.bind(this);
}
x = value => Math.round(interp(this.props.xFrom, this.props.xTo, value));
y = value => Math.round(interp(this.props.yFrom, this.props.yTo, value));
shouldComponentUpdate(nextProps) {
const {
xFrom,
yFrom,
xTo,
yTo
} = this.props;
return nextProps.xFrom !== xFrom ||
const { xFrom, yFrom, xTo, yTo } = this.props;
return (
nextProps.xFrom !== xFrom ||
nextProps.yFrom !== yFrom ||
nextProps.xTo !== xTo ||
nextProps.yTo !== yTo;
}
x (value) {
return Math.round(interp(this.props.xFrom, this.props.xTo, value));
}

y (value) {
return Math.round(interp(this.props.yFrom, this.props.yTo, value));
nextProps.yTo !== yTo
);
}
}

0 comments on commit fb0b67b

Please sign in to comment.