* remove margin deflation in BringDescendantIntoView and update related test to test cases with margin and no margin
* create transform relative to presenter, instead of child.
* update tests
* fix tests
* Add a failing test for #15712.
* Validate StartU at the start of a measure pass.
If any container U size has changed since the last layout pass then `StartU` must be considered unstable as the average container height will have changed.
* Correctly position focused element.
If the focused element has been moved outside the visible viewport due to a realized container size change, then we need to ensure it's positioned correctly.
* We can skip check if StartU is already unstable.
* Don't invalidate virt. panels more than necessary.
* Add another virt panel test.
And revert the expected results for another test to the way they were at the beginning of this PR.
* Tweak container size estimation.
Use the desired size of _measured_ containers instead of the bounds: a layout pass may not had completed on the containers yet, so the bounds may not be up-to-date. Was easier to move the estimation methods out of `RealizedStackElements` and into `VirtualizingStackPanel` itself in order to do this, and arguably makes more sense.
* Add more tests for ScrollIntoView.
* Improve ScrollIntoView.
Take into account the element we're scrolling to when calculating the anchor element for realization.
This fixes a case when elements have different widths and the BringIntoView wants to scroll horizontally due to custom TargetRect
Co-authored-by: Max Katz <maxkatz6@outlook.com>
* Add failing unit test for scenario 1 in #11878.
* Set TabOnceActiveElement on realized container.
Fixes scenario 1 in #11878.
* Use TabOnceActiveElement to decide focused element.
Fixes scenario #3 in #11878.
* Added failing unit tests for #11666.
* Handle items replaced with its own logic.
Don't rely on a remove/insert - it creates more work than needed.
* Fix some off-by-N errors in RealizedStackElements.
Fixes#11666
* Don't alter state in properties.
The `IValueEntry.HasValue` and `ValueFrame.IsActive` properties could alter state, which meant that when inspecting objects with these properties in a debugger, the state got altered by observing it. Make them methods.
* Deleted unused file.
* Add failing test for #12381.
* Use the index from the event in EvaluateIsActive.
Break the rules in this case.
Fixes#12381
---------
Co-authored-by: Max Katz <maxkatz6@outlook.com>
- animation/layout/render cycle is now managed from a central location
- animations are now throttled if animation/layout/render pass takes longer than a frame which previously caused a soft-freeze with input not being processed
- the public API is trimmed to make sure that we can make other planned changes during the 11.x support cycle
"Changelog":
- IClock is hidden and is planned to be replaced later
- Animator classes are hidden and are planned to be refactored later
- IAnimation members are hidden, it's supposed to be a marker interface for Style.Animations collection now, to start animations manually use Animation.RunAsync
- Sealed several classes in Avalonia.Animation namespace
- Spring class is removed from the public API (it wasn't possible to use it directly in a meaningful way anyway)
- Sealed brushes, transforms, effects and drawings
- Removed separate dispatcher priorities for Layout and Composition, everything now happens from a central place with Render priority (same as WPF)
- - some private "hook" priorities are added for now, those will be removed later
- IRenderLoop is hidden and removed from locator
- IRenderer is hidden (the plan is to remove that concept later)
- - Renderer.Start/Stop exposed as StartRendering/StopRendering on the toplevel (will be on a CompositionTarget/PresentationSource-like type later)
- - Renderer.Diagnistics exposed as RendererDiagnostics (same)
- - Renderer is no longer created by the platform code and is created by TopLevel itself
- - From the user-code hit-testing should be done by VisualExtensions.GetVisual(s)At, which has the same features
- - For unit tests a separate IHitTester interface is added which can be changed for a particular toplevel
- ILayoutManager is hidden
- - LayoutManager.ExecuteLayoutPass() exposed as TopLevel.UpdateLayout()
- Custom animators now have a separate base class that only deals with interpolation
Minor improvements:
- Compositor has a mode that doesn't use DispatcherTimers, useful for unit tests
- Introduced ScopedTestBase that auto-resets the locator when test is finished
- Check `CanFocus` in `FocusManager.SetFocusedElement`
- Check for `IsEffectivelyVisible` in `CanFocus`
- Clear focus when control made invisible
- Update tests that relied on unfocusable controls being focused
`ItemsControl` now works more like WPF, in that there are separate `Items` and `ItemsSource` properties. For backwards compatibility `Items` can still be set, though the setter is deprecated. `Items` needed to be changed from `IEnumerable` to `IList` though.