fixed a bug of CoverFlow
This commit is contained in:
1 parent
d1b6934d2d
commit
43cb35355a
1 file changed
+7
-40
@@ -99,36 +99,11 @@ namespace HandyControl.Controls
|
||||
/// </summary>
|
||||
private int _lastShowIndex;
|
||||
|
||||
/// <summary>
|
||||
/// 在获取新的模板后是否需要更新项
|
||||
/// </summary>
|
||||
private bool _updateItems;
|
||||
|
||||
private bool _isLoaded;
|
||||
|
||||
/// <summary>
|
||||
/// 跳转编号
|
||||
/// </summary>
|
||||
private int _jumpToIndex = -1;
|
||||
|
||||
public CoverFlow()
|
||||
{
|
||||
Loaded += (s, e) =>
|
||||
{
|
||||
if (_isLoaded) return;
|
||||
_isLoaded = true;
|
||||
if (_updateItems)
|
||||
{
|
||||
UpdateShowRange();
|
||||
_updateItems = false;
|
||||
}
|
||||
if (_jumpToIndex > 0)
|
||||
{
|
||||
PageIndex = _jumpToIndex;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 页码
|
||||
/// </summary>
|
||||
@@ -167,12 +142,13 @@ namespace HandyControl.Controls
|
||||
_camera = GetTemplateChild(ElementCamera) as ProjectionCamera;
|
||||
_visualParent = GetTemplateChild(ElementVisualParent) as ModelVisual3D;
|
||||
|
||||
if (_isLoaded)
|
||||
{
|
||||
UpdateShowRange();
|
||||
_camera.Position = new Point3D(CoverFlowItem.Interval * PageIndex, _camera.Position.Y,
|
||||
_camera.Position.Z);
|
||||
if (_jumpToIndex > 0)
|
||||
{
|
||||
PageIndex = _jumpToIndex;
|
||||
_jumpToIndex = -1;
|
||||
}
|
||||
_camera.Position = new Point3D(CoverFlowItem.Interval * PageIndex, _camera.Position.Y, _camera.Position.Z);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -185,28 +161,19 @@ namespace HandyControl.Controls
|
||||
{
|
||||
_uriList.Add(_uriList.Count, uri);
|
||||
}
|
||||
_updateItems = true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 添加一项资源
|
||||
/// </summary>
|
||||
/// <param name="uriString"></param>
|
||||
public void Add(string uriString)
|
||||
{
|
||||
_uriList.Add(_uriList.Count, new Uri(uriString));
|
||||
_updateItems = true;
|
||||
}
|
||||
public void Add(string uriString) => _uriList.Add(_uriList.Count, new Uri(uriString));
|
||||
|
||||
/// <summary>
|
||||
/// 添加一项资源
|
||||
/// </summary>
|
||||
/// <param name="uri"></param>
|
||||
public void Add(Uri uri)
|
||||
{
|
||||
_uriList.Add(_uriList.Count, uri);
|
||||
_updateItems = true;
|
||||
}
|
||||
public void Add(Uri uri) => _uriList.Add(_uriList.Count, uri);
|
||||
|
||||
/// <summary>
|
||||
/// 跳转
|
||||
|
||||
Reference in new issue
Block a user