[frontend/components] Use double for attachment view position calculation
This commit is contained in:
parent
1701654f89
commit
5ef8e3581c
1 changed files with 4 additions and 6 deletions
|
@ -58,8 +58,8 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
private ElementReference Scroller { get; set; }
|
private ElementReference Scroller { get; set; }
|
||||||
private int ScrollWidth { get; set; }
|
private double ScrollWidth { get; set; }
|
||||||
private int ScrollLeft { get; set; }
|
private double ScrollLeft { get; set; }
|
||||||
|
|
||||||
protected override void OnParametersSet()
|
protected override void OnParametersSet()
|
||||||
{
|
{
|
||||||
|
@ -68,12 +68,10 @@
|
||||||
|
|
||||||
private async Task Scroll()
|
private async Task Scroll()
|
||||||
{
|
{
|
||||||
// This should probably be moved to floating point.
|
ScrollLeft = await Module.InvokeAsync<double>("getScrollLeft", Scroller);
|
||||||
// So the state transition happens sooner, i.e. at 2.5 vs 3?
|
|
||||||
ScrollLeft = await Module.InvokeAsync<int>("getScrollLeft", Scroller);
|
|
||||||
var fraction = ScrollWidth / _refs.Count;
|
var fraction = ScrollWidth / _refs.Count;
|
||||||
var section = ScrollLeft / fraction;
|
var section = ScrollLeft / fraction;
|
||||||
Focused = section;
|
Focused = Convert.ToInt32(section); //ToInt32 rounds
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task Next()
|
private async Task Next()
|
||||||
|
|
Loading…
Add table
Reference in a new issue