Skip to content

Commit

Permalink
fix(butil): resolve issues of Scroll method of Element in Butil #6551 (
Browse files Browse the repository at this point in the history
  • Loading branch information
mhrastegari authored Jan 11, 2024
1 parent b889332 commit 4879608
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ internal static async ValueTask ElementRequestPointerLock(this IJSRuntime js, El
=> await js.InvokeVoidAsync("BitButil.element.requestPointerLock", element);

internal static async ValueTask ElementScroll(this IJSRuntime js, ElementReference element, ScrollToOptions? options, double? x, double? y)
=> await js.InvokeVoidAsync("BitButil.element.scroll", element, options, x, y);
=> await js.InvokeVoidAsync("BitButil.element.scroll", element, options?.ToJsObject(), x, y);

internal static async ValueTask ElementScrollBy(this IJSRuntime js, ElementReference element, ScrollToOptions? options, double? x, double? y)
=> await js.InvokeVoidAsync("BitButil.element.scrollBy", element, options?.ToJsObject(), x, y);
Expand Down
5 changes: 0 additions & 5 deletions src/Butil/Bit.Butil/Publics/Element.cs
Original file line number Diff line number Diff line change
Expand Up @@ -103,11 +103,6 @@ public async Task Scroll(ElementReference element, ScrollToOptions? options)
/// </summary>
public async Task Scroll(ElementReference element, double? x, double? y)
=> await js.ElementScroll(element, null, x, y);
/// <summary>
/// Scrolls to a particular set of coordinates inside a given element.
/// </summary>
public async Task Scroll(ElementReference element, ScrollToOptions? options, double? x, double? y)
=> await js.ElementScroll(element, options, x, y);

/// <summary>
/// Scrolls an element by the given amount.
Expand Down
6 changes: 4 additions & 2 deletions src/Butil/Bit.Butil/Publics/ElementReferenceExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,10 @@ public static async ValueTask RequestFullScreen(this ElementReference element, F
public static async ValueTask RequestPointerLock(this ElementReference element)
=> await GetJSRuntime(element).ElementRequestPointerLock(element);

public static async ValueTask Scroll(this ElementReference element, ScrollToOptions? options, double? x, double? y)
=> await GetJSRuntime(element).ElementScroll(element, options, x, y);
public static async ValueTask Scroll(this ElementReference element, ScrollToOptions? options)
=> await GetJSRuntime(element).ElementScroll(element, options, null, null);
public static async ValueTask Scroll(this ElementReference element, double? x, double? y)
=> await GetJSRuntime(element).ElementScroll(element, null, x, y);

public static async ValueTask ScrollBy(this ElementReference element, ScrollToOptions? options)
=> await GetJSRuntime(element).ElementScrollBy(element, options, null, null);
Expand Down

0 comments on commit 4879608

Please sign in to comment.