Skip to content

Commit 1993485

Browse files
committed
curve: resize remove points normalization
1 parent 2691cde commit 1993485

File tree

4 files changed

+59
-68
lines changed

4 files changed

+59
-68
lines changed

app/build/mojs-curve-editor.js

Lines changed: 28 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -8141,8 +8141,8 @@ return /******/ (function(modules) { // webpackBootstrap
81418141
mc.on('tap', function (e) {
81428142
var state = _this2.props.state;
81438143

8144-
var ev = e.srcEvent,
8145-
target = ev.target;
8144+
var ev = e.srcEvent;
8145+
var target = ev.target;
81468146
// handle paths only
81478147
if (target.tagName.toLowerCase() !== 'path') {
81488148
return;
@@ -10915,41 +10915,32 @@ return /******/ (function(modules) { // webpackBootstrap
1091510915
return state;
1091610916
}
1091710917

10918-
case 'EDITOR_RESIZE':
10919-
{
10920-
var _data4 = action.data;
10921-
var _points7 = [].concat((0, _toConsumableArray3.default)(state.points));
10922-
var _type = _data4.type;
10923-
var resize = _data4.resize;
10924-
10925-
// return state if resize to the `right`
10926-
10927-
if (_type === 'right') {
10928-
return state;
10929-
}
10930-
10931-
// normalize points' y regarding resize
10932-
if (_type === 'top') {
10933-
for (var i = 0; i < _points7.length; i++) {
10934-
var borderTop = Math.min(resize.top + _data4.y, 0),
10935-
_point3 = _points7[i];
10936-
if (_point3.y < borderTop) {
10937-
_point3.y = borderTop;
10938-
}
10939-
}
10940-
} else if (_type === 'bottom') {
10941-
for (var i = 0; i < _points7.length; i++) {
10942-
var borderBottom = Math.max(resize.bottom + _data4.y, 0) + _constants2.default.CURVE_SIZE,
10943-
_point4 = _points7[i];
10944-
10945-
if (_point4.y > borderBottom) {
10946-
_point4.y = borderBottom;
10947-
}
10948-
}
10949-
}
10950-
10951-
return (0, _extends3.default)({}, state, { points: _points7 }, (0, _calculatePath2.default)(_points7));
10952-
}
10918+
// case 'EDITOR_RESIZE': {
10919+
// const {data} = action,
10920+
// points = [...state.points],
10921+
// {type, resize} = data;
10922+
10923+
// // return state if resize to the `right`
10924+
// if (type === 'right') { return state; }
10925+
10926+
// // normalize points' y regarding resize
10927+
// if ( type === 'top' ) {
10928+
// for (var i = 0; i < points.length; i++) {
10929+
// const borderTop = Math.min(resize.top + data.y, 0),
10930+
// point = points[i];
10931+
// if (point.y < borderTop) { point.y = borderTop; }
10932+
// }
10933+
// } else if ( type === 'bottom' ) {
10934+
// for (var i = 0; i < points.length; i++) {
10935+
// const borderBottom = Math.max(resize.bottom + data.y, 0) + C.CURVE_SIZE,
10936+
// point = points[i];
10937+
10938+
// if (point.y > borderBottom) { point.y = borderBottom; }
10939+
// }
10940+
// }
10941+
10942+
// return { ...state, points, ...calculatePath( points ) };
10943+
// }
1095310944

1095410945
}
1095510946
return state;

app/build/mojs-curve-editor.min.js

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/js/reducers/points-reducer.babel.js

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -160,32 +160,32 @@ const pointsReducer = (state = INITIAL_STATE, action) => {
160160
return state;
161161
}
162162

163-
case 'EDITOR_RESIZE': {
164-
const {data} = action,
165-
points = [...state.points],
166-
{type, resize} = data;
167-
168-
// return state if resize to the `right`
169-
if (type === 'right') { return state; }
170-
171-
// normalize points' y regarding resize
172-
if ( type === 'top' ) {
173-
for (var i = 0; i < points.length; i++) {
174-
const borderTop = Math.min(resize.top + data.y, 0),
175-
point = points[i];
176-
if (point.y < borderTop) { point.y = borderTop; }
177-
}
178-
} else if ( type === 'bottom' ) {
179-
for (var i = 0; i < points.length; i++) {
180-
const borderBottom = Math.max(resize.bottom + data.y, 0) + C.CURVE_SIZE,
181-
point = points[i];
182-
183-
if (point.y > borderBottom) { point.y = borderBottom; }
184-
}
185-
}
186-
187-
return { ...state, points, ...calculatePath( points ) };
188-
}
163+
// case 'EDITOR_RESIZE': {
164+
// const {data} = action,
165+
// points = [...state.points],
166+
// {type, resize} = data;
167+
168+
// // return state if resize to the `right`
169+
// if (type === 'right') { return state; }
170+
171+
// // normalize points' y regarding resize
172+
// if ( type === 'top' ) {
173+
// for (var i = 0; i < points.length; i++) {
174+
// const borderTop = Math.min(resize.top + data.y, 0),
175+
// point = points[i];
176+
// if (point.y < borderTop) { point.y = borderTop; }
177+
// }
178+
// } else if ( type === 'bottom' ) {
179+
// for (var i = 0; i < points.length; i++) {
180+
// const borderBottom = Math.max(resize.bottom + data.y, 0) + C.CURVE_SIZE,
181+
// point = points[i];
182+
183+
// if (point.y > borderBottom) { point.y = borderBottom; }
184+
// }
185+
// }
186+
187+
// return { ...state, points, ...calculatePath( points ) };
188+
// }
189189

190190
}
191191
return state;

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "mojs-curve-editor",
3-
"version": "1.1.4",
3+
"version": "1.1.5",
44
"description": "mojs GUI for editing easing/property curves",
55
"keywords": [
66
"mojs",

0 commit comments

Comments
 (0)