clip mview animations to scroll content presenter bounds
This commit is contained in:
1 parent
4f27091fa0
commit
f9fbebea67
1 file changed
+9
-3
@@ -1,9 +1,7 @@
|
||||
using bts.collections;
|
||||
using bts.shell.pnl;
|
||||
using mbts.ui.controls;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
@@ -20,6 +18,7 @@ namespace mbts.ui.spark {
|
||||
IList<IDisposable> _grid_hooks = new List<IDisposable>();
|
||||
IDictionary<DataGridColumn, IDisposable> _column_hooks = new Dictionary<DataGridColumn, IDisposable>();
|
||||
ScrollViewer _scroll_viewer;
|
||||
ScrollContentPresenter _scroll_presenter_backing;
|
||||
IDictionary<object, IDictionary<object, IEnumerable<CellAnimation>>> _row_animation_map = new Dictionary<object, IDictionary<object, IEnumerable<CellAnimation>>>();
|
||||
IDictionary<TColKey, DIYGrid.ColumnGeometry> _column_layout = new Dictionary<TColKey, DIYGrid.ColumnGeometry>();
|
||||
|
||||
@@ -54,14 +53,20 @@ namespace mbts.ui.spark {
|
||||
}
|
||||
}
|
||||
|
||||
ScrollContentPresenter _scroll_presenter =>
|
||||
_scroll_presenter_backing ?? (_scroll_presenter_backing = _scroll_viewer?.descendants_of_type<ScrollContentPresenter>().FirstOrDefault());
|
||||
|
||||
public void Dispose() {
|
||||
_dispose_hooks();
|
||||
RemoveRowAnimationChangedHandler(_grid, _grid_RowAnimationChanged);
|
||||
}
|
||||
|
||||
protected override void OnRender(DrawingContext drawingContext) {
|
||||
if (_row_animation_map.Count == 0)
|
||||
var sp = _scroll_presenter;
|
||||
if (sp != null && _row_animation_map.Count == 0)
|
||||
return;
|
||||
var sp_bounds = new Rect(sp.TranslatePoint(new Point(0, 0), this), sp.RenderSize);
|
||||
drawingContext.PushClip(new RectangleGeometry(sp_bounds));
|
||||
foreach (var row_kv in _row_animation_map) {
|
||||
if (_rows_presenter.ItemContainerGenerator.ContainerFromItem(row_kv.Key) is FrameworkElement row) {
|
||||
if (!row.IsVisible)
|
||||
@@ -69,6 +74,7 @@ namespace mbts.ui.spark {
|
||||
animate_row(drawingContext, row_kv.Key, row_kv.Value, row);
|
||||
}
|
||||
}
|
||||
drawingContext.Pop();
|
||||
}
|
||||
|
||||
protected void animate_row(DrawingContext drawing_context, object row_vm, IDictionary<object, IEnumerable<CellAnimation>> cell_animations, FrameworkElement row_view) {
|
||||
|
||||
Reference in new issue
Block a user