Skip to content

Commit 17cd024

Browse files
committed
1 parent 269f521 commit 17cd024

File tree

1 file changed

+21
-3
lines changed

1 file changed

+21
-3
lines changed

packages/project-editor/lvgl/widgets/Colorwheel.tsx

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import type { LVGLCode } from "project-editor/lvgl/to-lvgl-code";
1717

1818
export class LVGLColorwheelWidget extends LVGLWidget {
1919
mode: keyof typeof COLORWHEEL_MODES;
20+
knobRecolor: boolean;
2021
fixedMode: boolean;
2122

2223
static classInfo = makeDerivedClassInfo(LVGLWidget.classInfo, {
@@ -43,6 +44,12 @@ export class LVGLColorwheelWidget extends LVGLWidget {
4344
type: PropertyType.Boolean,
4445
checkboxStyleSwitch: true,
4546
propertyGridGroup: specificGroup
47+
},
48+
{
49+
name: "knobRecolor",
50+
type: PropertyType.Boolean,
51+
checkboxStyleSwitch: true,
52+
propertyGridGroup: specificGroup
4653
}
4754
],
4855

@@ -53,7 +60,14 @@ export class LVGLColorwheelWidget extends LVGLWidget {
5360
height: 150,
5461
clickableFlag: true,
5562
mode: "HUE",
56-
fixedMode: false
63+
fixedMode: false,
64+
knobRecolor: false
65+
},
66+
67+
beforeLoadHook: (object: LVGLColorwheelWidget, jsObject: any) => {
68+
if (jsObject.knobRecolor == undefined) {
69+
jsObject.knobRecolor = false;
70+
}
5771
},
5872

5973
icon: (
@@ -94,7 +108,8 @@ export class LVGLColorwheelWidget extends LVGLWidget {
94108

95109
makeObservable(this, {
96110
mode: observable,
97-
fixedMode: observable
111+
fixedMode: observable,
112+
knobRecolor: observable
98113
});
99114
}
100115

@@ -104,7 +119,10 @@ export class LVGLColorwheelWidget extends LVGLWidget {
104119
return;
105120
}
106121

107-
code.createObject("lv_colorwheel_create", code.constant("false"));
122+
code.createObject(
123+
"lv_colorwheel_create",
124+
code.constant(this.knobRecolor ? "true" : "false")
125+
);
108126

109127
if (this.mode != "HUE") {
110128
code.callObjectFunction(

0 commit comments

Comments
 (0)