mirror of
https://github.com/slint-ui/slint.git
synced 2025-08-31 15:47:26 +00:00
Use Property<LogicalLength> instead of Property<Coord>
This removes the special code for the generated property getters and ensures type safety in the run-time library for property value setting. In the Rust generated code we continue to do arithmetic on the scalar values, that means we immediately extract the scalar, do arithmetic and rely on the compiler to only allow compatible units. Danger zone alert: In the interpreter Value::Number can now be converted to LogicalLength as-is.
This commit is contained in:
parent
d505ac4809
commit
c16253d29f
33 changed files with 496 additions and 380 deletions
|
@ -205,6 +205,7 @@ fn gen_corelib(
|
|||
"Coord",
|
||||
"LogicalRect",
|
||||
"LogicalPoint",
|
||||
"LogicalLength",
|
||||
]
|
||||
.iter()
|
||||
.chain(public_exported_types.iter())
|
||||
|
@ -470,6 +471,7 @@ namespace slint {
|
|||
struct Rect;
|
||||
using LogicalRect = Rect;
|
||||
using LogicalPoint = Point2D<float>;
|
||||
using LogicalLength = float;
|
||||
}
|
||||
}",
|
||||
)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue