Skip to content

Commit

Permalink
WPF - Add ExperimentalExtensions.UsePopupMouseTransform to allow for …
Browse files Browse the repository at this point in the history
…custom implementation

Issue #2820
  • Loading branch information
amaitland committed Mar 24, 2024
1 parent 9115762 commit f5bcd01
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions CefSharp.Wpf/Experimental/ExperimentalExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,34 @@

namespace CefSharp.Wpf.Experimental
{
/// <summary>
/// Experimental Extensions
/// </summary>
public static class ExperimentalExtensions
{
/// <summary>
/// Html dropdown goes off screen when near bottom of page by default
/// Calling this method to use the <see cref="MousePositionTransform"/> implementation
/// to reopsition Popups and mouse.
///
/// Issue https://github.com/cefsharp/CefSharp/issues/2820
/// </summary>
/// <param name="chromiumWebBrowser">browser</param>
public static void UsePopupMouseTransform(this ChromiumWebBrowser chromiumWebBrowser)
{
chromiumWebBrowser.MousePositionTransform = new MousePositionTransform();
}

/// <summary>
/// Use a custom <see cref="IMousePositionTransform"/> implemntation
/// </summary>
/// <param name="chromiumWebBrowser">browser</param>
/// <param name="mousePositionTransform">custom implementation of <see cref="IMousePositionTransform"/>
/// or defaults to <see cref="NoOpMousePositionTransform"/> if null.
/// </param>
public static void UsePopupMouseTransform(this ChromiumWebBrowser chromiumWebBrowser, IMousePositionTransform mousePositionTransform)
{
chromiumWebBrowser.MousePositionTransform = mousePositionTransform ?? new NoOpMousePositionTransform();
}
}
}

0 comments on commit f5bcd01

Please sign in to comment.