@@ -75,7 +75,7 @@ return /******/ (function(modules) { // webpackBootstrap
75
75
/******/ }
76
76
/******/
77
77
/******/ var hotApplyOnUpdate = true ;
78
- /******/ var hotCurrentHash = "3082a6b3aa4ce9ad3025 " ; // eslint-disable-line no-unused-vars
78
+ /******/ var hotCurrentHash = "4180f42de19836a486f4 " ; // eslint-disable-line no-unused-vars
79
79
/******/ var hotCurrentModuleData = { } ;
80
80
/******/ var hotCurrentParents = [ ] ; // eslint-disable-line no-unused-vars
81
81
/******/
@@ -3798,7 +3798,7 @@ return /******/ (function(modules) { // webpackBootstrap
3798
3798
/* WEBPACK VAR INJECTION */ ( function ( riot ) {
3799
3799
__webpack_require__ ( 13 ) ;
3800
3800
3801
- riot . tag2 ( 'curve' , '<div class="{this.CLASSES[\'curve__svg-wrapper\']}" riot-style="{this.styles.transform}"> <point each="{point, _index in points}" points-count="{parent.points.length}"></point> <svg height="358" viewbox="0 0 100 100" preserveaspectratio="none" class="{this.CLASSES[\'curve__svg\']}"> <path riot-d="{this.path}" stroke="#000000" stroke-opacity="0 .35" stroke-width="4" vector-effect="non-scaling-stroke" transform="translate(.75,.75)" fill="none"></path> <g id="js-segments"> <path each="{this.segments}" riot-d="{string}" data-index="{index}" stroke="white" stroke-width="" vector-effect="non-scaling-stroke" class="{this.CLASSES[\'curve__svg-segment\']}"></path> </g> </svg> </div>' , '' , 'class="{this.CLASSES[\'curve\']}" riot-style="{this.styles.background}"' , function ( opts ) {
3801
+ riot . tag2 ( 'curve' , '<div class="{this.CLASSES[\'curve__svg-wrapper\']}" riot-style="{this.styles.transform}"> <point each="{point, _index in points}" points-count="{parent.points.length}"></point> <svg height="358" viewbox="0 0 100 100" preserveaspectratio="none" class="{this.CLASSES[\'curve__svg\']}"> <path riot-d="{this.path}" stroke="#000000" stroke-opacity="1 .35" stroke-width="4" vector-effect="non-scaling-stroke" transform="translate(.75,.75)" fill="none"></path> <g id="js-segments"> <path each="{this.segments}" riot-d="{string}" data-index="{index}" stroke="white" stroke-width="" vector-effect="non-scaling-stroke" class="{this.CLASSES[\'curve__svg-segment\']}"></path> </g> </svg> </div>' , '' , 'class="{this.CLASSES[\'curve\']}" riot-style="{this.styles.background}"' , function ( opts ) {
3802
3802
'use strict' ;
3803
3803
3804
3804
var _this = this ;
@@ -3815,6 +3815,10 @@ return /******/ (function(modules) { // webpackBootstrap
3815
3815
3816
3816
var _constants2 = _interopRequireDefault ( _constants ) ;
3817
3817
3818
+ var _angleToPoint = __webpack_require__ ( 140 ) ;
3819
+
3820
+ var _angleToPoint2 = _interopRequireDefault ( _angleToPoint ) ;
3821
+
3818
3822
var _hammerjs = __webpack_require__ ( 102 ) ;
3819
3823
3820
3824
var _hammerjs2 = _interopRequireDefault ( _hammerjs ) ;
@@ -3828,44 +3832,53 @@ return /******/ (function(modules) { // webpackBootstrap
3828
3832
this . CLASSES = __webpack_require__ ( 111 ) ;
3829
3833
__webpack_require__ ( 112 ) ;
3830
3834
3831
- var angleToPoint = function angleToPoint ( angle , radius ) {
3832
- return mojs . h . getRadialPoint ( { angle : angle , radius : radius , center : { x : 0 , y : 0 } } ) ;
3835
+ var getPoint = function getPoint ( point ) {
3836
+ var handleIndex = arguments . length <= 1 || arguments [ 1 ] === undefined ? 1 : arguments [ 1 ] ;
3837
+
3838
+ var x = point . x + point . tempX ,
3839
+ y = point . y + point . tempY ,
3840
+ handle = point [ 'handle' + handleIndex ] ;
3841
+
3842
+ var CHAR = handleIndex === 2 ? 'C' : '' ;
3843
+ if ( point . type !== 'straight' ) {
3844
+ var handleCoords = ( 0 , _angleToPoint2 . default ) ( handle . angle , handle . radius ) ;
3845
+ return '' + CHAR + ( x + handleCoords . x / _constants2 . default . CURVE_PERCENT ) + ', ' + ( y + handleCoords . y ) / _constants2 . default . CURVE_PERCENT + ' ' ;
3846
+ } else {
3847
+ return '' + CHAR + x + ', ' + y / _constants2 . default . CURVE_PERCENT + ' ' ;
3848
+ }
3833
3849
} ;
3834
3850
3835
- var getPath = function getPath ( ) {
3851
+ var getSegment = function getSegment ( point , nextPoint , i ) {
3852
+ if ( ! nextPoint ) {
3853
+ return 1 ;
3854
+ }
3855
+
3836
3856
var str = '' ;
3837
- for ( var i = 0 ; i < _this . points . length ; i ++ ) {
3838
- var point = _this . points [ i ] ,
3839
- x = point . x + point . tempX ,
3840
- y = point . y + point . tempY ;
3841
3857
3842
- if ( i === 0 ) {
3843
- var nextPoint = _this . points [ i + 1 ] ;
3844
- var xNext = nextPoint . x + nextPoint . tempX ,
3845
- yNext = nextPoint . y + nextPoint . tempY ;
3858
+ var x = point . x + point . tempX ,
3859
+ y = point . y + point . tempY ,
3860
+ xNext = nextPoint . x + nextPoint . tempX ,
3861
+ yNext = nextPoint . y + nextPoint . tempY ;
3846
3862
3847
- str += 'M' + x + ', ' + y / _constants2 . default . CURVE_PERCENT + ' ' ;
3848
- if ( point . type !== 'straight' ) {
3849
- var handle2 = angleToPoint ( point . handle2 . angle , point . handle2 . radius ) ;
3850
- str += 'C' + ( point . x + handle2 . x ) + ', ' + ( point . y / 3.58 + handle2 . y / 3.58 ) + ' ' ;
3851
- } else {
3852
- str += 'C' + point . x + ', ' + point . y / 3.58 + ' ' ;
3853
- }
3863
+ if ( i === 0 ) {
3864
+ str += 'M' + x + ', ' + y / _constants2 . default . CURVE_PERCENT + ' ' ;
3865
+ }
3866
+ str += getPoint ( point , 2 ) ;
3867
+ str += getPoint ( nextPoint , 1 ) ;
3868
+ str += xNext + ', ' + yNext / _constants2 . default . CURVE_PERCENT + ' ' ;
3854
3869
3855
- if ( nextPoint . type !== 'straight' ) {
3856
- var handle1 = angleToPoint ( nextPoint . handle1 . angle , nextPoint . handle1 . radius ) ;
3857
- str += nextPoint . x + handle1 . x + ', ' + ( nextPoint . y / 3.58 + handle1 . y / 3.58 ) + ' ' ;
3858
- } else {
3859
- str += nextPoint . x + ', ' + nextPoint . y / 3.58 + ' ' ;
3860
- }
3870
+ return str ;
3871
+ } ;
3861
3872
3862
- str += nextPoint . x + ', ' + nextPoint . y / 3.58 + ' ' ;
3863
- } else { }
3864
- // str += `L${x}, ${y/C.CURVE_PERCENT} ` ;
3873
+ var getPath = function getPath ( ) {
3874
+ var str = '' ;
3875
+ for ( var i = 0 ; i < _this . points . length - 1 ; i ++ ) {
3876
+ var point = _this . points [ i ] ,
3877
+ nextPoint = _this . points [ i + 1 ] ;
3865
3878
3866
- // if ( i === 0) { str += `M${x}, ${y/C.CURVE_PERCENT} `; }
3867
- // else { str += `L${x}, ${y/C.CURVE_PERCENT} ` ; }
3879
+ str += getSegment ( point , nextPoint , i ) ;
3868
3880
}
3881
+
3869
3882
_this . path = str ;
3870
3883
} ;
3871
3884
@@ -4132,6 +4145,10 @@ return /******/ (function(modules) { // webpackBootstrap
4132
4145
4133
4146
var _store2 = _interopRequireDefault ( _store ) ;
4134
4147
4148
+ var _angleToPoint = __webpack_require__ ( 140 ) ;
4149
+
4150
+ var _angleToPoint2 = _interopRequireDefault ( _angleToPoint ) ;
4151
+
4135
4152
var _hammerjs = __webpack_require__ ( 102 ) ;
4136
4153
4137
4154
var _hammerjs2 = _interopRequireDefault ( _hammerjs ) ;
@@ -4149,10 +4166,6 @@ return /******/ (function(modules) { // webpackBootstrap
4149
4166
_this . update ( ) ;
4150
4167
} ) ;
4151
4168
4152
- var angleToPoint = function angleToPoint ( angle , radius ) {
4153
- return mojs . h . getRadialPoint ( { angle : angle , radius : radius , center : { x : 0 , y : 0 } } ) ;
4154
- } ;
4155
-
4156
4169
var anglePointToAngle = function anglePointToAngle ( x , y ) {
4157
4170
var radius = Math . sqrt ( x * x + y * y ) ,
4158
4171
angle = Math . atan ( y / x ) * ( 180 / Math . PI ) - 90 ;
@@ -4164,22 +4177,22 @@ return /******/ (function(modules) { // webpackBootstrap
4164
4177
} ;
4165
4178
4166
4179
this . getPointStyle = function ( ) {
4167
- var point = angleToPoint ( _this . angle , _this . radius ) ;
4180
+ var point = ( 0 , _angleToPoint2 . default ) ( _this . angle , _this . radius ) ;
4168
4181
4169
4182
var translate = 'transform: translate(' + point . x + 'px, ' + point . y + 'px) rotate(' + _this . angle + 'deg)' ;
4170
4183
return '' + mojs . h . prefix . css + translate + '; ' + translate ;
4171
4184
} ;
4172
4185
4173
4186
this . getLineStyle = function ( ) {
4174
- var point = angleToPoint ( _this . angle , _this . radius ) ;
4187
+ var point = ( 0 , _angleToPoint2 . default ) ( _this . angle , _this . radius ) ;
4175
4188
4176
4189
var translate = 'transform: rotate(' + _this . angle + 'deg) scaleY(' + _this . radius + ')' ;
4177
4190
return '' + mojs . h . prefix . css + translate + '; ' + translate ;
4178
4191
} ;
4179
4192
4180
4193
this . on ( 'mount' , function ( ) {
4181
4194
var hammertime = ( 0 , _propagatingHammerjs2 . default ) ( new _hammerjs2 . default ( _this . root ) ) . on ( 'pan' , function ( e ) {
4182
- var point = angleToPoint ( _this . angle , _this . radius ) ,
4195
+ var point = ( 0 , _angleToPoint2 . default ) ( _this . angle , _this . radius ) ,
4183
4196
newX = point . x + e . deltaX ,
4184
4197
newY = point . y + e . deltaY ;
4185
4198
@@ -6333,7 +6346,7 @@ return /******/ (function(modules) { // webpackBootstrap
6333
6346
6334
6347
function _interopRequireDefault ( obj ) { return obj && obj . __esModule ? obj : { default : obj } ; }
6335
6348
6336
- var INITIAL_STATE = [ ( 0 , _makePoint2 . default ) ( { x : 0 , y : _constants2 . default . CURVE_SIZE , isLockedX : true } ) , ( 0 , _makePoint2 . default ) ( { x : 50 , y : _constants2 . default . CURVE_SIZE / 2 , type : 'mirrored' } ) , ( 0 , _makePoint2 . default ) ( { x : 100 , y : 0 , isLockedX : true } ) ] ;
6349
+ var INITIAL_STATE = [ ( 0 , _makePoint2 . default ) ( { x : 0 , y : _constants2 . default . CURVE_SIZE , isLockedX : true , type : 'straight' } ) , ( 0 , _makePoint2 . default ) ( { x : 50 , y : _constants2 . default . CURVE_SIZE / 2 , type : 'mirrored' } ) , ( 0 , _makePoint2 . default ) ( { x : 100 , y : 0 , isLockedX : true } ) ] ;
6337
6350
6338
6351
var deslectAll = function deslectAll ( state ) {
6339
6352
var newState = [ ] ;
@@ -10528,8 +10541,8 @@ return /******/ (function(modules) { // webpackBootstrap
10528
10541
var state = _store2 . default . getState ( ) . pointControls . present ;
10529
10542
_this . buttons = {
10530
10543
'straight' : false ,
10531
- 'mirrored' : false ,
10532
10544
'disconnected' : false ,
10545
+ 'mirrored' : false ,
10533
10546
'asymmetric' : false
10534
10547
} ;
10535
10548
_this . buttons [ state . type || 'straight' ] = true ;
@@ -10711,6 +10724,20 @@ return /******/ (function(modules) { // webpackBootstrap
10711
10724
CURVE_PADDING : 10
10712
10725
} ;
10713
10726
10727
+ /***/ } ,
10728
+ /* 140 */
10729
+ /***/ function ( module , exports ) {
10730
+
10731
+ "use strict" ;
10732
+
10733
+ Object . defineProperty ( exports , "__esModule" , {
10734
+ value : true
10735
+ } ) ;
10736
+
10737
+ exports . default = function ( angle , radius ) {
10738
+ return mojs . h . getRadialPoint ( { angle : angle , radius : radius , center : { x : 0 , y : 0 } } ) ;
10739
+ } ;
10740
+
10714
10741
/***/ }
10715
10742
/******/ ] )
10716
10743
} ) ;
0 commit comments