I used a `#[cfg(..)]` instead of a feature flag because then it is enabled
for both the compiler and the lib at the same time, and since it is only a debug stuff
it does not need to be enabled within the project. So one must enable it with
`RUSTFLAGS='--cfg sixtyfps_debug_property'`
Similar to the parent commit, the model tracks changes to the rows and
marks an internal property dirty. Since we have a base class this is a
little less intrusive.
cc #98
This is done by exposing the ModelNotify to the caller via the new
ModelTracker trait, which has a function that allows "hooking" into the
dirty tracking of the size.
By extension, this also works in JavaScript.
cc #98
Two problems:
- We were not marking the property as dirty, so dependent property would not
update themselves
- In the generated rust/c++ code, we would not call set_animated_value
For regularly animated values, the loop count was always applied. For animations
triggered through bindings, the iteration count wasn't reset when the
animation restarted and therefore it looked like the loop count was only
applied once.
Fixes#250
A Property tracker can now be constructed with a callback that's invoked
when a property accessed during evaluate is changed.
The callback is guarded to be called only once until the tracker has
been evaluated. This is implemented by passing the information about
whether the property/tracker was already dirty before through the
mark_dirty() vtable call.
By default PropertyTracker::evaluate() registers the currently
evaluating binding/tracker as a dependency. This should help with
repeaters and other scenarios where in the run-time we use property
trackers but want to track the overall "dirtyness" in the window with
regards to whether a redraw is needed or not.
The new evaluate_as_dependency_root() function allows skipping this
mechanism and is used for the two trackers in the window.
We're going to need support for InterpolatedValue, which at the moment
has trait requirements that are a bit too tight.
It's sufficient if it takes references to values and doesn't require Copy or Clone.
The latter can go into the bounds where it's actually used.
Last commit broke for structures containing models, because models are not PartialEq.
So we need to implement PartialEq for ModelHandle. Which means a struct needs to
be created