@@ -3,13 +3,14 @@ import PropTypes from 'prop-types';
33import  React  from  'react' ; 
44import  bindAll  from  'lodash.bindall' ; 
55import  { changeStrokeColor }  from  '../reducers/stroke-color' ; 
6+ import  { changeStrokeWidth }  from  '../reducers/stroke-width' ; 
67import  { openStrokeColor ,  closeStrokeColor }  from  '../reducers/modals' ; 
78import  Modes  from  '../lib/modes' ; 
89import  Formats  from  '../lib/format' ; 
910import  { isBitmap }  from  '../lib/format' ; 
1011
1112import  StrokeColorIndicatorComponent  from  '../components/stroke-color-indicator.jsx' ; 
12- import  { applyStrokeColorToSelection }  from  '../helper/style-path' ; 
13+ import  { applyStrokeColorToSelection ,   applyStrokeWidthToSelection }  from  '../helper/style-path' ; 
1314
1415class  StrokeColorIndicator  extends  React . Component  { 
1516    constructor  ( props )  { 
@@ -31,10 +32,17 @@ class StrokeColorIndicator extends React.Component {
3132        } 
3233    } 
3334    handleChangeStrokeColor  ( newColor )  { 
35+         if  ( this . props . strokeColor  ===  null  &&  newColor  !==  null )  { 
36+             this . _hasChanged  =  applyStrokeWidthToSelection ( 1 ,  this . props . textEditTarget )  ||  this . _hasChanged ; 
37+             this . props . onChangeStrokeWidth ( 1 ) ; 
38+         }  else  if  ( this . props . strokeColor  !==  null  &&  newColor  ===  null )  { 
39+             this . _hasChanged  =  applyStrokeWidthToSelection ( 0 ,  this . props . textEditTarget )  ||  this . _hasChanged ; 
40+             this . props . onChangeStrokeWidth ( 0 ) ; 
41+         } 
3442        // Apply color and update redux, but do not update svg until picker closes. 
35-         const   isDifferent  = 
36-             applyStrokeColorToSelection ( newColor ,  isBitmap ( this . props . format ) ,  this . props . textEditTarget ) ; 
37-         this . _hasChanged   =   this . _hasChanged   ||   isDifferent ; 
43+         this . _hasChanged  = 
44+             applyStrokeColorToSelection ( newColor ,  isBitmap ( this . props . format ) ,  this . props . textEditTarget )   || 
45+              this . _hasChanged ; 
3846        this . props . onChangeStrokeColor ( newColor ) ; 
3947    } 
4048    handleCloseStrokeColor  ( )  { 
@@ -68,6 +76,9 @@ const mapDispatchToProps = dispatch => ({
6876    onChangeStrokeColor : strokeColor  =>  { 
6977        dispatch ( changeStrokeColor ( strokeColor ) ) ; 
7078    } , 
79+     onChangeStrokeWidth : strokeWidth  =>  { 
80+         dispatch ( changeStrokeWidth ( strokeWidth ) ) ; 
81+     } , 
7182    onOpenStrokeColor : ( )  =>  { 
7283        dispatch ( openStrokeColor ( ) ) ; 
7384    } , 
@@ -77,10 +88,10 @@ const mapDispatchToProps = dispatch => ({
7788} ) ; 
7889
7990StrokeColorIndicator . propTypes  =  { 
80-     disabled : PropTypes . bool . isRequired , 
8191    format : PropTypes . oneOf ( Object . keys ( Formats ) ) , 
8292    isEyeDropping : PropTypes . bool . isRequired , 
8393    onChangeStrokeColor : PropTypes . func . isRequired , 
94+     onChangeStrokeWidth : PropTypes . func . isRequired , 
8495    onCloseStrokeColor : PropTypes . func . isRequired , 
8596    onUpdateImage : PropTypes . func . isRequired , 
8697    strokeColor : PropTypes . string , 
0 commit comments