Skip to content

Commit 7dc482a

Browse files
committed
curve-editor: fix the later points to cause translate on parent
1 parent 0ce484e commit 7dc482a

11 files changed

+64
-46
lines changed

app/build/mojs-curve-editor.js

Lines changed: 34 additions & 25 deletions
Large diffs are not rendered by default.

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

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

app/css/blocks/curve-editor.postcss.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
top: 0;
2121
bottom: 0;
2222
padding: calc( $gap * $PX );
23+
cursor: move;
2324

2425
& [data-component="icon-divider"] {
2526
margin: calc( 10*$PX ) auto;
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"curve-editor":"_curve-editor_ggsv0_4","curve-editor__left":"_curve-editor__left_ggsv0_1","curve-editor__right":"_curve-editor__right_ggsv0_1","curve-editor__resize-handle":"_curve-editor__resize-handle_ggsv0_1","curve-editor__anchor-buttons":"_curve-editor__anchor-buttons_ggsv0_1","curve-editor__mojs-logo":"_curve-editor__mojs-logo_ggsv0_1"}
1+
{"curve-editor":"_curve-editor_1f8r5_4","curve-editor__left":"_curve-editor__left_1f8r5_1","curve-editor__right":"_curve-editor__right_1f8r5_1","curve-editor__resize-handle":"_curve-editor__resize-handle_1f8r5_1","curve-editor__anchor-buttons":"_curve-editor__anchor-buttons_1f8r5_1","curve-editor__mojs-logo":"_curve-editor__mojs-logo_1f8r5_1"}

app/css/blocks/curve.postcss.css

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

app/css/blocks/curve.postcss.css.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"curve":"_curve_1u41l_5","curve__background":"_curve__background_1u41l_1","curve__svg-wrapper":"_curve__svg-wrapper_1u41l_1","curve__svg":"_curve__svg_1u41l_1","curve__svg-segment":"_curve__svg-segment_1u41l_1"}
1+
{"curve":"_curve_gvcrn_5","curve__background":"_curve__background_gvcrn_1","curve__svg-wrapper":"_curve__svg-wrapper_gvcrn_1","curve__svg":"_curve__svg_gvcrn_1","curve__svg-segment":"_curve__svg-segment_gvcrn_1"}

app/js/reducers/point-controls-reducer.babel.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ const pointControls = (state = INITIAL_STATE, action) => {
1111
// return { ...state, isShow: true, type: 'straight' };
1212
// }
1313
case 'POINT_SELECT': {
14-
return { ...state, isShow: !action.isDeselect, type: action.data.type };
14+
const type = action.data.type;
15+
return { ...state, isShow: !action.isDeselect, type };
1516
}
1617
case 'POINT_CHANGE_TYPE': {
1718
return { ...state, type: action.data };

app/js/tags/curve-editor-left.babel.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import PointControls from './point-controls';
88
const CLASSES = require('../../css/blocks/curve-editor.postcss.css.json');
99

1010
const CurveEditorLeft = ({state}) => {
11-
return <div className={CLASSES['curve-editor__left']}>
11+
return <div className={CLASSES['curve-editor__left']} id="js-left-panel">
1212
<IconButton shape="code" />
1313
<IconDivider />
1414
<PointControls state={state}

app/js/tags/curve-editor.babel.jsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,8 @@ class CurveEditor extends Component {
5454

5555
componentDidMount () {
5656
const {store} = this.context,
57-
mc = propagating(new Hammer.Manager(this.base));
57+
el = this.base.querySelector('#js-left-panel'),
58+
mc = propagating(new Hammer.Manager(el));
5859

5960
mc.add(new Hammer.Pan({ threshold: 0 }));
6061
mc
@@ -66,7 +67,7 @@ class CurveEditor extends Component {
6667
const x = e.deltaX, y = e.deltaY;
6768
store.dispatch({ type: 'EDITOR_TRANSLATE_END', data: { x, y } })
6869
})
69-
.on('tap', (e) => { store.dispatch({ type: 'POINT_DESELECT_ALL' }); });
70+
// .on('tap', (e) => { store.dispatch({ type: 'POINT_DESELECT_ALL' }); });
7071

7172
this._addKeyUp();
7273
store.subscribe(this.forceUpdate.bind(this));

app/js/tags/curve.babel.jsx

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ class Curve extends Component {
2626
<svg height={ C.CURVE_SIZE }
2727
viewBox="0 0 100 100"
2828
preserveAspectRatio="none"
29+
id="js-svg"
2930
class={ CLASSES['curve__svg'] }>
3031

3132
<path d={path}
@@ -160,7 +161,7 @@ class Curve extends Component {
160161
const el = this.base.querySelector('#js-segments'),
161162
mc = propagating(new Hammer.Manager(el));
162163

163-
mc.add(new Hammer.Pan({ threshold: 0 }));
164+
// mc.add(new Hammer.Pan({ threshold: 0 }));
164165
mc.add(new Hammer.Tap);
165166

166167
mc
@@ -182,14 +183,20 @@ class Curve extends Component {
182183

183184
store.dispatch({
184185
type: 'POINT_SELECT',
185-
data: { index }
186+
data: { index, type: 'straight' }
186187
});
187188

188189
e.stopPropagation();
189-
})
190-
.on('tap', (e) => {
191-
e.stopPropagation();
192190
});
191+
192+
const svg = this.base.querySelector('#js-svg'),
193+
svgMc = propagating(new Hammer.Manager(svg));
194+
195+
svgMc.add(new Hammer.Tap);
196+
197+
svgMc
198+
.on('tap', (e) => { store.dispatch({ type: 'POINT_DESELECT_ALL' }); });
199+
193200
}
194201
}
195202

0 commit comments

Comments
 (0)