mirror of
https://github.com/slint-ui/slint.git
synced 2025-11-01 12:24:16 +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 {
|
||||
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();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue