Skip to content

Commit

Permalink
Settings page for the printer demo
Browse files Browse the repository at this point in the history
Fix the text maximum size so it can be put in a layout
  • Loading branch information
ogoffart committed Aug 11, 2020
1 parent d43b5fb commit b5c9bf5
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 12 deletions.
39 changes: 29 additions & 10 deletions examples/printerdemo/ui/printerdemo.60
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

import { SpinBox, Button } from "sixtyfps_widgets.60";
import { SpinBox, Button, CheckBox, Slider } from "sixtyfps_widgets.60";

Label := Text {
color: black;
Expand Down Expand Up @@ -87,12 +87,31 @@ PrintPage := Page {


SettingsPage := Page {

Text {
x: parent.width / 12;
y: parent.width / 8;
color: black;
text: "Settings";
GridLayout {
height: parent.height - 20lx;
width: parent.width - 20lx;
x: 10lx;
y: 10lx;
spacing: 10lx;
Row { Rectangle {} }
Row {
CheckBox {
text: "Black and White";
}
}
Row {
Label { text: "Scan DPI"; }
Slider { }
}
Row {
CheckBox { text: "Eco Mode"; }
}
Row {
CheckBox { text: "TURBO"; }
}
Row { Rectangle {} }
Row { Rectangle {} }
Row { Rectangle {} }
}
}

Expand Down Expand Up @@ -163,8 +182,8 @@ MainWindow := Rectangle {
width: root.width;
border_radius: 0lx;
img.x: root.height / 8;
img.width: root.width / 25;
img.height: root.height / 18.75;
img.width: root.height / 10;
img.height: root.height / 10;
text.y: 0px;
text.x: root.height / 4;
//text.horizontal_alignment: align_left;
Expand All @@ -181,7 +200,7 @@ MainWindow := Rectangle {
invisible when root.active_page > 0 && root.active_page != idx + 1 : {
color: white;
// FIXME: should probaby hide the entire item under with z-ordering
img.y: 10000000lx;
img.y: 1000000000lx;
text.color: #0000;
}
]
Expand Down
2 changes: 1 addition & 1 deletion sixtyfps_runtime/corelib/item_tree.rs
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ pub fn item_offset<Base>(
item_tree: &[ItemTreeNode<Base>],
index: usize,
) -> crate::graphics::Point {
let index = dbg!(index as u32);
let index = index as u32;
// FIXME: This algorithm is shit
for (parent, node) in item_tree.iter().enumerate() {
match node {
Expand Down
2 changes: 1 addition & 1 deletion sixtyfps_runtime/corelib/items.rs
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ impl Item for Text {
let height = font.font_height();
LayoutInfo {
min_width: width,
max_width: width,
max_width: f32::MAX,
min_height: height,
max_height: height,
}
Expand Down

0 comments on commit b5c9bf5

Please sign in to comment.