Apply some of the hints from the reddit thread
- make sure the icons are centered
- make sure the spacing and padding of the main buttons are the same
- make the color slightly lighter
- align the title ind controls in the top bar
Use horizontal and vertical layouts to reduce the amount of nesting.
The resolution slider is a bit wider now, but that one needs a bit of extra work anyway :)
When converting from object literal to object literal, we would check
recursively if the individual fields can be converted and then generate
code to convert each field.
For a conversion frmo object literal to a struct, we would a per-field
can_convert check as well, but there would not be any code (Expression)
generated for the conversion, instead it would be a straight cast. That
was fine so far in our tests and example code, because the fields never
required a conversion. With commit
071ab9fda1 the percentage number literals
used in the printer demo however would now require a conversion
(multiplication by 0.01) before the assignment to the float level field.
This patch adds the missing conversion by matching the Object -> Struct
conversion case, generating an intermediate Object type based on the
struct's properties, call maybe_convert recursively and *then* cast the
result to a struct.
The logical pixels are now just called "px" and the less frequently
used physical pixels have the "phx" suffix.
The existing markup was adapted using the syntax updater and the
following patch:
+ if node.kind() == SyntaxKind::NumberLiteral {
+ if node.text().ends_with("lx") {
+ return write!(
+ file,
+ "{}px",
+ node.text().as_str().split_at(node.text().as_str().len() - 2).0
+ );
+ }
+ if node.text().ends_with("px") {
+ return write!(
+ file,
+ "{}phx",
+ node.text().as_str().split_at(node.text().as_str().len() - 2).0
+ );
+ }
+ }
Fixes#49
We really shouldn't require specifying a color for every Text {} element just in order
to see *some* text.
For Rectangle OTOH transparent is a good default (and thus for Color), hence
this change just to Text.
Right now the constructor bit is also a bit repetitive, this could
perhaps be folded into BuiltinItem to generate the ffi, default impl and
forward to an init function if it exists.
The printer demo looks slightly less boring on white background with brighter colors.
In exchange, the controls can become more dull and hopefully easier to see.
Use slightly aggressive colors for the buttons of the printer demo,
shrink the ink cartridge bars a little and replace the red for the 2000
with a more subtle silver.
Based on privately received feedback ;-)
Instead, pass a reference to the root item when mapping the window,
at which point we can downcast to the new Window item. If we have one,
then we'll read its width/height (for initial values) and install
bindings to keep them up-to-date.