mirror of
https://github.com/slint-ui/slint.git
synced 2025-11-03 05:12:55 +00:00
live-preview: added angle label tp brush widget
This commit is contained in:
parent
b1200a1833
commit
daae2bb4c4
1 changed files with 22 additions and 15 deletions
|
|
@ -175,26 +175,33 @@ export component BrushWidget inherits GridLayout {
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
clip: true;
|
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 {
|
HorizontalLayout {
|
||||||
enabled <=> root.enabled;
|
spacing: EditorSpaceSettings.default-spacing;
|
||||||
|
Text {
|
||||||
|
text: "Angle:";
|
||||||
|
vertical-alignment: center;
|
||||||
|
}
|
||||||
|
|
||||||
input-type: decimal;
|
angle := ResettingLineEdit {
|
||||||
|
enabled <=> root.enabled;
|
||||||
|
|
||||||
edited(text) => {
|
input-type: decimal;
|
||||||
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 {
|
edited(text) => {
|
||||||
root.current-angle = text.is-empty ? 0.0 : text.to-float();
|
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);
|
||||||
root.update-brush();
|
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();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue