@@ -87,6 +87,9 @@ const SvgTools = (props: Iprops) => {
87
87
const [ currentMode , setCurrentMode ] = useState < string > (
88
88
props ?. drauu ?. mode || 'stylus'
89
89
)
90
+ const [ currentColor , setCurrentColor ] = useState < string > (
91
+ props ?. drauu ?. brush . color || '#000'
92
+ )
90
93
const [ currentDash , setCurrentDash ] = useState < string | undefined > (
91
94
props ?. drauu ?. brush ?. dasharray
92
95
)
@@ -110,6 +113,7 @@ const SvgTools = (props: Iprops) => {
110
113
}
111
114
function colorChange ( color : string ) {
112
115
drauu ! . brush . color = color
116
+ setCurrentColor ( color )
113
117
}
114
118
function save ( ) {
115
119
drauu ! . el ! . setAttribute ( 'xmlns' , 'http://www.w3.org/2000/svg' )
@@ -151,8 +155,8 @@ const SvgTools = (props: Iprops) => {
151
155
< Col >
152
156
< ColorPicker
153
157
size = "small"
154
- onChangeComplete = { ( color ) => colorChange ( color . toHexString ( ) ) }
155
- value = { drauu ?. brush . color ? drauu ?. brush . color : '#000' }
158
+ onChange = { ( color ) => colorChange ( color . toHexString ( ) ) }
159
+ value = { currentColor }
156
160
presets = { [
157
161
{
158
162
label : '快速选择' ,
0 commit comments