Skip to content

Commit

Permalink
Sync
Browse files Browse the repository at this point in the history
  • Loading branch information
setchi committed Jan 21, 2020
1 parent 3b1987b commit 124322d
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 14 deletions.
6 changes: 3 additions & 3 deletions Samples~/Sources/07_ScrollRect/ScrollView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public float PaddingTop
set
{
paddingHead = value;
Refresh();
Relayout();
}
}

Expand All @@ -36,7 +36,7 @@ public float PaddingBottom
set
{
paddingTail = value;
Refresh();
Relayout();
}
}

Expand All @@ -46,7 +46,7 @@ public float Spacing
set
{
spacing = value;
Refresh();
Relayout();
}
}

Expand Down
8 changes: 4 additions & 4 deletions Samples~/Sources/08_GridView/GridView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public float PaddingTop
set
{
paddingHead = value;
Refresh();
Relayout();
}
}

Expand All @@ -34,7 +34,7 @@ public float PaddingBottom
set
{
paddingTail = value;
Refresh();
Relayout();
}
}

Expand All @@ -44,7 +44,7 @@ public float SpacingY
set
{
spacing = value;
Refresh();
Relayout();
}
}

Expand All @@ -54,7 +54,7 @@ public float SpacingX
set
{
startAxisSpacing = value;
Refresh();
Relayout();
}
}

Expand Down
7 changes: 6 additions & 1 deletion Sources/Runtime/Core/FancyScrollView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,12 @@ protected virtual void UpdateContents(IList<TItemData> itemsSource)
}

/// <summary>
/// セルの表示内容を更新します.
/// セルのレイアウトを強制的に更新します.
/// </summary>
protected virtual void Relayout() => UpdatePosition(currentPosition, false);

/// <summary>
/// セルのレイアウトと表示内容を強制的に更新します.
/// </summary>
protected virtual void Refresh() => UpdatePosition(currentPosition, true);

Expand Down
8 changes: 8 additions & 0 deletions Sources/Runtime/ScrollRect/FancyScrollRect.cs
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,14 @@ protected override void Refresh()
base.Refresh();
}

/// <inheritdoc/>
protected override void Relayout()
{
AdjustCellIntervalAndScrollOffset();
RefreshScroller();
base.Relayout();
}

/// <summary>
/// <see cref="Scroller"/> の各種状態を更新します.
/// </summary>
Expand Down
7 changes: 1 addition & 6 deletions Sources/Runtime/Scroller/Scroller.cs
Original file line number Diff line number Diff line change
Expand Up @@ -288,13 +288,8 @@ public void JumpTo(int index)
throw new ArgumentOutOfRangeException(nameof(index));
}

autoScrollState.Reset();

velocity = 0f;
dragging = false;

UpdateSelection(index);
UpdatePosition(index);
Position = index;
}

/// <summary>
Expand Down

0 comments on commit 124322d

Please sign in to comment.