Skip to content

Commit 15c02ae

Browse files
committed
point: add handles tag
1 parent fb965e6 commit 15c02ae

16 files changed

+224
-40
lines changed

app/build/mojs-curve-editor.js

Lines changed: 118 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ return /******/ (function(modules) { // webpackBootstrap
7575
/******/ }
7676
/******/
7777
/******/ var hotApplyOnUpdate = true;
78-
/******/ var hotCurrentHash = "ae2a7386cedcd40b60d0"; // eslint-disable-line no-unused-vars
78+
/******/ var hotCurrentHash = "beedde8670b73117e350"; // eslint-disable-line no-unused-vars
7979
/******/ var hotCurrentModuleData = {};
8080
/******/ var hotCurrentParents = []; // eslint-disable-line no-unused-vars
8181
/******/
@@ -3909,6 +3909,13 @@ return /******/ (function(modules) { // webpackBootstrap
39093909
data: { x: x, y: y, index: index },
39103910
isRecord: true
39113911
});
3912+
3913+
_store2.default.dispatch({
3914+
type: 'POINT_SELECT',
3915+
data: { index: index }
3916+
});
3917+
3918+
e.stopPropagation();
39123919
});
39133920
});
39143921
});
@@ -3919,7 +3926,9 @@ return /******/ (function(modules) { // webpackBootstrap
39193926
/* 13 */
39203927
/***/ function(module, exports, __webpack_require__) {
39213928

3922-
/* WEBPACK VAR INJECTION */(function(riot) {riot.tag2('point', '', '', 'class="{this.getClass()}" riot-style="{this.getStyle()}"', function(opts) {
3929+
/* WEBPACK VAR INJECTION */(function(riot) {__webpack_require__(135);
3930+
3931+
riot.tag2('point', '<little-handle each="{this.handles}"></little-handle>', '', 'class="{this.getClass()}" riot-style="{this.getStyle()}"', function(opts) {
39233932
'use strict';
39243933

39253934
var _this = this;
@@ -3945,13 +3954,22 @@ return /******/ (function(modules) { // webpackBootstrap
39453954
this.CLASSES = __webpack_require__(104);
39463955
__webpack_require__(105);
39473956

3948-
_store2.default.subscribe(this.update.bind(this));
39493957
var clamp = mojs.h.clamp;
39503958

3959+
this.getHandles = function () {
3960+
_this.handles = [_this.point.handle1, _this.point.handle2];
3961+
};
3962+
3963+
this.getHandles();
3964+
_store2.default.subscribe(function () {
3965+
_this.getHandles();_this.update();
3966+
});
3967+
39513968
this.getClass = function () {
39523969
var isSelected = _this.point.isSelected ? _this.CLASSES['is-selected'] : '';
3970+
var isHideHandles = _this.point.type === 'straight' ? _this.CLASSES['is-hide-handles'] : '';
39533971

3954-
return _this.CLASSES['point'] + ' ' + isSelected;
3972+
return _this.CLASSES['point'] + ' ' + isSelected + ' ' + isHideHandles;
39553973
};
39563974

39573975
this.getStyle = function () {
@@ -6778,8 +6796,8 @@ return /******/ (function(modules) { // webpackBootstrap
67786796
type: fallback(o.type, 'straight')
67796797
}, makePositionPoint(o), {
67806798
// add curve handles
6781-
handle1: makePositionPoint(o.handle1),
6782-
handle2: makePositionPoint(o.handle2)
6799+
handle1: makePositionPoint(o.handle1 || { x: -25, y: -25 }),
6800+
handle2: makePositionPoint(o.handle2 || { x: 25, y: -25 })
67836801
});
67846802
};
67856803

@@ -6811,6 +6829,10 @@ return /******/ (function(modules) { // webpackBootstrap
68116829
var action = arguments[1];
68126830

68136831
switch (action.type) {
6832+
// probably redundant
6833+
// case 'POINT_ADD': {
6834+
// return { ...state, isShow: true, type: 'straight' };
6835+
// }
68146836
case 'POINT_SELECT':
68156837
{
68166838
return (0, _extends3.default)({}, state, { isShow: !action.isDeselect, type: action.data.type });
@@ -9750,8 +9772,9 @@ return /******/ (function(modules) { // webpackBootstrap
97509772
/***/ function(module, exports) {
97519773

97529774
module.exports = {
9753-
"point": "_point_1bj5r_5",
9754-
"is-selected": "_is-selected_1bj5r_29"
9775+
"point": "_point_eogtk_5",
9776+
"is-selected": "_is-selected_eogtk_40",
9777+
"is-hide-handles": "_is-hide-handles_eogtk_50"
97559778
};
97569779

97579780
/***/ },
@@ -9789,7 +9812,7 @@ return /******/ (function(modules) { // webpackBootstrap
97899812

97909813

97919814
// module
9792-
exports.push([module.id, "._point_1bj5r_5{position:absolute;width:10px;height:10px;margin-left:-5px;margin-top:-5px;cursor:move;background:#fff;border-radius:50%;z-index:3;box-shadow:3px 3px 0 rgba(0,0,0,.5)}._point_1bj5r_5:after{content:'';position:absolute;left:50%;top:50%;width:20px;height:20px;margin-left:-10px;margin-top:-10px}._point_1bj5r_5._is-selected_1bj5r_29,._point_1bj5r_5:hover{border:2px solid #8c6d8b}", ""]);
9815+
exports.push([module.id, "._point_eogtk_5{position:absolute;width:10px;height:10px;margin-left:-5px;margin-top:-5px;cursor:move;background:#fff;border-radius:50%;z-index:3;box-shadow:3px 3px 0 rgba(0,0,0,.5);border:2px solid #fff}._point_eogtk_5 little-handle{position:absolute;left:50%;top:50%;margin-left:-3px;margin-top:-3px}._point_eogtk_5:after{content:'';position:absolute;left:50%;top:50%;width:20px;height:20px;margin-left:-10px;margin-top:-10px}._point_eogtk_5._is-selected_eogtk_40,._point_eogtk_5:hover{border-color:#8c6d8b}._point_eogtk_5._is-selected_eogtk_40 little-handle{display:block}._point_eogtk_5._is-hide-handles_eogtk_50 little-handle{display:none}", ""]);
97939816

97949817
// exports
97959818

@@ -9799,10 +9822,10 @@ return /******/ (function(modules) { // webpackBootstrap
97999822
/***/ function(module, exports) {
98009823

98019824
module.exports = {
9802-
"curve": "_curve_15852_5",
9803-
"curve__svg-wrapper": "_curve__svg-wrapper_15852_1",
9804-
"curve__svg": "_curve__svg_15852_1",
9805-
"curve__svg-segment": "_curve__svg-segment_15852_1"
9825+
"curve": "_curve_1jj2s_5",
9826+
"curve__svg-wrapper": "_curve__svg-wrapper_1jj2s_1",
9827+
"curve__svg": "_curve__svg_1jj2s_1",
9828+
"curve__svg-segment": "_curve__svg-segment_1jj2s_1"
98069829
};
98079830

98089831
/***/ },
@@ -9840,7 +9863,7 @@ return /******/ (function(modules) { // webpackBootstrap
98409863

98419864

98429865
// module
9843-
exports.push([module.id, "._curve_15852_5{position:absolute;left:0;top:10px;right:10px;bottom:10px;border-radius:2px;background:rgba(58,8,58,.75);border:1px solid #b3a0b2;box-shadow:inset 4px 4px 0 rgba(0,0,0,.5)}._curve__svg-wrapper_15852_1{position:absolute;left:-1px;top:-1px;width:100%}._curve__svg_15852_1{display:block;overflow:visible;width:100%}._curve__svg-segment_15852_1{stroke:#fff;stroke-width:2px;cursor:crosshair}._curve__svg-segment_15852_1:hover{stroke:#ff512f}", ""]);
9866+
exports.push([module.id, "._curve_1jj2s_5{position:absolute;left:0;top:10px;right:10px;bottom:10px;border-radius:2px;background:rgba(58,8,58,.75);border:1px solid #b3a0b2;box-shadow:inset 4px 4px 0 rgba(0,0,0,.5);z-index:2}._curve__svg-wrapper_1jj2s_1{position:absolute;left:-1px;top:-1px;width:100%}._curve__svg_1jj2s_1{display:block;overflow:visible;width:100%}._curve__svg-segment_1jj2s_1{stroke:#fff;stroke-width:2px;cursor:crosshair}._curve__svg-segment_1jj2s_1:hover{stroke:#ff512f}", ""]);
98449867

98459868
// exports
98469869

@@ -9863,9 +9886,9 @@ return /******/ (function(modules) { // webpackBootstrap
98639886
/***/ function(module, exports) {
98649887

98659888
module.exports = {
9866-
"code-panel": "_code-panel_1viyz_3",
9867-
"code-panel__input-wrapp": "_code-panel__input-wrapp_1viyz_1",
9868-
"code-panel__input-field": "_code-panel__input-field_1viyz_1"
9889+
"code-panel": "_code-panel_1pe78_3",
9890+
"code-panel__input-wrapp": "_code-panel__input-wrapp_1pe78_1",
9891+
"code-panel__input-field": "_code-panel__input-field_1pe78_1"
98699892
};
98709893

98719894
/***/ },
@@ -9903,7 +9926,7 @@ return /******/ (function(modules) { // webpackBootstrap
99039926

99049927

99059928
// module
9906-
exports.push([module.id, "._code-panel_1viyz_3{position:absolute;left:10px;top:-32px;width:391px;height:32px;margin:0 auto;border-radius:6px 6px 0 0;background:#3d1b3c;z-index:3}._code-panel__input-wrapp_1viyz_1{width:381px;height:23px;margin:5px;border-radius:2px;background:#3a083a;border:1px solid #b3a0b2;box-shadow:inset 3px 3px 0 rgba(0,0,0,.5)}._code-panel__input-field_1viyz_1{display:block;background:transparent;color:#fff;padding:.4em;border:none;width:100%}", ""]);
9929+
exports.push([module.id, "._code-panel_1pe78_3{position:absolute;left:10px;top:-32px;width:391px;height:32px;margin:0 auto;border-radius:6px 6px 0 0;background:#3d1b3c;z-index:1}._code-panel__input-wrapp_1pe78_1{width:381px;height:23px;margin:5px;border-radius:2px;background:#3a083a;border:1px solid #b3a0b2;box-shadow:inset 3px 3px 0 rgba(0,0,0,.5)}._code-panel__input-field_1pe78_1{display:block;background:transparent;color:#fff;padding:.4em;border:none;width:100%}", ""]);
99079930

99089931
// exports
99099932

@@ -10183,7 +10206,7 @@ return /******/ (function(modules) { // webpackBootstrap
1018310206
'disconnected': false,
1018410207
'asymmetric': false
1018510208
};
10186-
_this.buttons[state.type] = true;
10209+
_this.buttons[state.type || 'straight'] = true;
1018710210
};
1018810211

1018910212
this.getClass = function () {
@@ -10345,6 +10368,82 @@ return /******/ (function(modules) { // webpackBootstrap
1034510368
// exports
1034610369

1034710370

10371+
/***/ },
10372+
/* 135 */
10373+
/***/ function(module, exports, __webpack_require__) {
10374+
10375+
/* WEBPACK VAR INJECTION */(function(riot) {
10376+
riot.tag2('little-handle', '', '', 'class="{this.CLASSES[\'little-handle\']}" riot-style="{this.getStyle()}"', function(opts) {
10377+
'use strict';
10378+
10379+
var _this = this;
10380+
10381+
this.CLASSES = __webpack_require__(138);
10382+
__webpack_require__(136);
10383+
10384+
this.getStyle = function () {
10385+
// const {resize} = store.getState(),
10386+
// x = clamp(this.point.x + this.point.tempX, 0, 100),
10387+
// cleanX = x * resize.scalerX;
10388+
10389+
// let y = this.point.y + this.point.tempY;
10390+
var x = _this.x + _this.tempX,
10391+
y = _this.y + _this.tempY;
10392+
10393+
var translate = 'transform: translate(' + x + 'px, ' + y + 'px)';
10394+
return '' + mojs.h.prefix.css + translate + '; ' + translate;
10395+
};
10396+
});
10397+
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2)))
10398+
10399+
/***/ },
10400+
/* 136 */
10401+
/***/ function(module, exports, __webpack_require__) {
10402+
10403+
// style-loader: Adds some css to the DOM by adding a <style> tag
10404+
10405+
// load the styles
10406+
var content = __webpack_require__(137);
10407+
if(typeof content === 'string') content = [[module.id, content, '']];
10408+
// add the styles to the DOM
10409+
var update = __webpack_require__(11)(content, {});
10410+
if(content.locals) module.exports = content.locals;
10411+
// Hot Module Replacement
10412+
if(true) {
10413+
// When the styles change, update the <style> tags
10414+
if(!content.locals) {
10415+
module.hot.accept(137, function() {
10416+
var newContent = __webpack_require__(137);
10417+
if(typeof newContent === 'string') newContent = [[module.id, newContent, '']];
10418+
update(newContent);
10419+
});
10420+
}
10421+
// When the module is disposed, remove the <style> tags
10422+
module.hot.dispose(function() { update(); });
10423+
}
10424+
10425+
/***/ },
10426+
/* 137 */
10427+
/***/ function(module, exports, __webpack_require__) {
10428+
10429+
exports = module.exports = __webpack_require__(10)();
10430+
// imports
10431+
10432+
10433+
// module
10434+
exports.push([module.id, "._little-handle_xdcpx_3{width:6px;height:6px;background:#ff512f;position:absolute}._little-handle_xdcpx_3:after{content:'';position:absolute;width:200%;height:200%;left:50%;top:50%;margin-left:-100%;margin-top:-100%}", ""]);
10435+
10436+
// exports
10437+
10438+
10439+
/***/ },
10440+
/* 138 */
10441+
/***/ function(module, exports) {
10442+
10443+
module.exports = {
10444+
"little-handle": "_little-handle_xdcpx_3"
10445+
};
10446+
1034810447
/***/ }
1034910448
/******/ ])
1035010449
});

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

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

app/css/blocks/code-panel.postcss.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
margin: 0 auto;
1010
border-radius: calc( 6 * $PX ) calc( 6 * $PX ) 0 0;
1111
background: rgba( 61, 27, 60, 1 );
12-
z-index: 3;
12+
z-index: 1;
1313

1414
&__input-wrapp {
1515
width: 381px;
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"code-panel":"_code-panel_1viyz_3","code-panel__input-wrapp":"_code-panel__input-wrapp_1viyz_1","code-panel__input-field":"_code-panel__input-field_1viyz_1"}
1+
{"code-panel":"_code-panel_1pe78_3","code-panel__input-wrapp":"_code-panel__input-wrapp_1pe78_1","code-panel__input-field":"_code-panel__input-field_1pe78_1"}

0 commit comments

Comments
 (0)