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>
|
/// </summary>
|
||||||
private int _lastShowIndex;
|
private int _lastShowIndex;
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 在获取新的模板后是否需要更新项
|
|
||||||
/// </summary>
|
|
||||||
private bool _updateItems;
|
|
||||||
|
|
||||||
private bool _isLoaded;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 跳转编号
|
/// 跳转编号
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private int _jumpToIndex = -1;
|
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>
|
||||||
/// 页码
|
/// 页码
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -167,12 +142,13 @@ namespace HandyControl.Controls
|
|||||||
_camera = GetTemplateChild(ElementCamera) as ProjectionCamera;
|
_camera = GetTemplateChild(ElementCamera) as ProjectionCamera;
|
||||||
_visualParent = GetTemplateChild(ElementVisualParent) as ModelVisual3D;
|
_visualParent = GetTemplateChild(ElementVisualParent) as ModelVisual3D;
|
||||||
|
|
||||||
if (_isLoaded)
|
|
||||||
{
|
|
||||||
UpdateShowRange();
|
UpdateShowRange();
|
||||||
_camera.Position = new Point3D(CoverFlowItem.Interval * PageIndex, _camera.Position.Y,
|
if (_jumpToIndex > 0)
|
||||||
_camera.Position.Z);
|
{
|
||||||
|
PageIndex = _jumpToIndex;
|
||||||
|
_jumpToIndex = -1;
|
||||||
}
|
}
|
||||||
|
_camera.Position = new Point3D(CoverFlowItem.Interval * PageIndex, _camera.Position.Y, _camera.Position.Z);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -185,28 +161,19 @@ namespace HandyControl.Controls
|
|||||||
{
|
{
|
||||||
_uriList.Add(_uriList.Count, uri);
|
_uriList.Add(_uriList.Count, uri);
|
||||||
}
|
}
|
||||||
_updateItems = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 添加一项资源
|
/// 添加一项资源
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="uriString"></param>
|
/// <param name="uriString"></param>
|
||||||
public void Add(string uriString)
|
public void Add(string uriString) => _uriList.Add(_uriList.Count, new Uri(uriString));
|
||||||
{
|
|
||||||
_uriList.Add(_uriList.Count, new Uri(uriString));
|
|
||||||
_updateItems = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 添加一项资源
|
/// 添加一项资源
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="uri"></param>
|
/// <param name="uri"></param>
|
||||||
public void Add(Uri uri)
|
public void Add(Uri uri) => _uriList.Add(_uriList.Count, uri);
|
||||||
{
|
|
||||||
_uriList.Add(_uriList.Count, uri);
|
|
||||||
_updateItems = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 跳转
|
/// 跳转
|
||||||
|
|||||||
Reference in new issue
Block a user