@@ -12,7 +12,7 @@ import { getThemedColor } from "project-editor/features/style/theme";
12
12
13
13
import { ProjectContext } from "project-editor/project/context" ;
14
14
import { settingsController } from "home/settings" ;
15
- import { action , observable , makeObservable } from "mobx" ;
15
+ import { action , observable , makeObservable , runInAction } from "mobx" ;
16
16
import { closest } from "eez-studio-shared/dom" ;
17
17
import tinycolor from "tinycolor2" ;
18
18
@@ -35,6 +35,20 @@ export const ThemedColorInput = observer(
35
35
dropDownLeft = 0 ;
36
36
dropDownTop = 0 ;
37
37
38
+ colorHSV : any ;
39
+
40
+ constructor ( props : any ) {
41
+ super ( props ) ;
42
+
43
+ makeObservable ( this , {
44
+ dropDownOpen : observable ,
45
+ dropDownLeft : observable ,
46
+ dropDownTop : observable ,
47
+ setDropDownOpen : action ,
48
+ colorHSV : observable
49
+ } ) ;
50
+ }
51
+
38
52
onDragOver = ( event : React . DragEvent ) => {
39
53
event . preventDefault ( ) ;
40
54
event . stopPropagation ( ) ;
@@ -71,17 +85,6 @@ export const ThemedColorInput = observer(
71
85
this . props . onChange ( color ) ;
72
86
} ;
73
87
74
- constructor ( props : any ) {
75
- super ( props ) ;
76
-
77
- makeObservable ( this , {
78
- dropDownOpen : observable ,
79
- dropDownLeft : observable ,
80
- dropDownTop : observable ,
81
- setDropDownOpen : action
82
- } ) ;
83
- }
84
-
85
88
setDropDownOpen ( open : boolean ) {
86
89
if ( this . dropDownOpen === false ) {
87
90
document . removeEventListener (
@@ -186,9 +189,19 @@ export const ThemedColorInput = observer(
186
189
} }
187
190
>
188
191
< Chrome
189
- color = { color }
192
+ color = {
193
+ this . dropDownOpen && this . colorHSV
194
+ ? this . colorHSV
195
+ : color
196
+ }
190
197
showAlpha = { false }
191
- onChange = { color => this . onChangeColor ( color . hex , false ) }
198
+ onChange = { color => {
199
+ runInAction ( ( ) => {
200
+ this . colorHSV = color . hsv ;
201
+ } ) ;
202
+
203
+ this . onChangeColor ( color . hex , false ) ;
204
+ } }
192
205
/>
193
206
</ div > ,
194
207
document . body
0 commit comments