live-preview: added angle label tp brush widget

This commit is contained in:
szecket 2025-03-13 16:43:43 -04:00 committed by Tobias Hunger
parent b1200a1833
commit daae2bb4c4

View file

@ -175,26 +175,33 @@ export component BrushWidget inherits GridLayout {
Rectangle {
clip: true;
height: root.current-brush-kind == BrushKind.linear ? angle.height : 0px;
height: root.current-brush-kind == BrushKind.linear ? self.preferred-height : 0px;
angle := ResettingLineEdit {
enabled <=> root.enabled;
HorizontalLayout {
spacing: EditorSpaceSettings.default-spacing;
Text {
text: "Angle:";
vertical-alignment: center;
}
input-type: decimal;
angle := ResettingLineEdit {
enabled <=> root.enabled;
edited(text) => {
self.can-compile = text.is-float() && root.test-brush-binding(root.current-brush-kind, text.is-empty ? 0.0 : text.to-float(), root.current-color, root.current-gradient-stops);
if self.can-compile {
root.current-angle = text.is-empty ? 0.0 : text.to-float();
root.update-brush();
input-type: decimal;
edited(text) => {
self.can-compile = text.is-float() && root.test-brush-binding(root.current-brush-kind, text.is-empty ? 0.0 : text.to-float(), root.current-color, root.current-gradient-stops);
if self.can-compile {
root.current-angle = text.is-empty ? 0.0 : text.to-float();
root.update-brush();
}
}
accepted(text) => {
root.set-brush-binding(root.current-brush-kind, root.current-angle, root.current-color, root.current-gradient-stops);
update-brush();
}
}
accepted(text) => {
root.set-brush-binding(root.current-brush-kind, root.current-angle, root.current-color, root.current-gradient-stops);
update-brush();
}
}
}