Skip to content

Commit a52a1f8

Browse files
committed
chore: remove JumpTo method of ImageSelector
1 parent ffd27d8 commit a52a1f8

File tree

2 files changed

+8
-17
lines changed

2 files changed

+8
-17
lines changed

src/Shared/HandyControlDemo_Shared/UserControl/Controls/CoverFlowDemoCtl.xaml.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ public CoverFlowDemoCtl()
2121
new Uri(@"pack://application:,,,/Resources/Img/Album/9.jpg"),
2222
new Uri(@"pack://application:,,,/Resources/Img/Album/10.jpg")
2323
});
24-
CoverFlowMain.JumpTo(2);
24+
25+
CoverFlowMain.PageIndex = 2;
2526
}
2627
}
2728
}

src/Shared/HandyControl_Shared/Controls/Cover/CoverFlow/CoverFlow.cs

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -103,18 +103,13 @@ private static void OnPageIndexChanged(DependencyObject d, DependencyPropertyCha
103103
/// </summary>
104104
private int _lastShowIndex;
105105

106-
/// <summary>
107-
/// 跳转编号
108-
/// </summary>
109-
private int _jumpToIndex = -1;
110-
111106
/// <summary>
112107
/// 页码
113108
/// </summary>
114109
public int PageIndex
115110
{
116111
get => (int) GetValue(PageIndexProperty);
117-
internal set => SetValue(PageIndexProperty, value);
112+
set => SetValue(PageIndexProperty, value);
118113
}
119114

120115
/// <summary>
@@ -147,11 +142,6 @@ public override void OnApplyTemplate()
147142
_visualParent = GetTemplateChild(ElementVisualParent) as ModelVisual3D;
148143

149144
UpdateShowRange();
150-
if (_jumpToIndex > 0)
151-
{
152-
PageIndex = _jumpToIndex;
153-
_jumpToIndex = -1;
154-
}
155145

156146
_point3DAnimation = new Point3DAnimation(new Point3D(CoverFlowItem.Interval * PageIndex, _camera.Position.Y, _camera.Position.Z), new Duration(TimeSpan.FromMilliseconds(200)));
157147
_camera.BeginAnimation(ProjectionCamera.PositionProperty, _point3DAnimation);
@@ -181,11 +171,6 @@ public void AddRange(IEnumerable<object> contentList)
181171
/// <param name="uri"></param>
182172
public void Add(Uri uri) => _contentDic.Add(_contentDic.Count, uri);
183173

184-
/// <summary>
185-
/// 跳转
186-
/// </summary>
187-
public void JumpTo(int index) => _jumpToIndex = index;
188-
189174
protected override void OnMouseWheel(MouseWheelEventArgs e)
190175
{
191176
base.OnMouseWheel(e);
@@ -237,6 +222,11 @@ private void Viewport3D_MouseLeftButtonDown(object sender, MouseButtonEventArgs
237222
/// <param name="newIndex"></param>
238223
private void UpdateIndex(int newIndex)
239224
{
225+
if (!IsLoaded)
226+
{
227+
return;
228+
}
229+
240230
UpdateShowRange();
241231
_itemShowDic.Do(item =>
242232
{

0 commit comments

Comments
 (0)