Skip to content

Commit d96eebd

Browse files
committed
Added float in SetAspectRatio
1 parent 23fac32 commit d96eebd

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

src/ElectronNET.API/API/BrowserWindow.cs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1055,6 +1055,25 @@ public Task<bool> IsFullScreenAsync()
10551055
return taskCompletionSource.Task;
10561056
}
10571057

1058+
/// <summary>
1059+
/// This will make a window maintain an aspect ratio. The extra size allows a developer to have space,
1060+
/// specified in pixels, not included within the aspect ratio calculations. This API already takes into
1061+
/// account the difference between a window’s size and its content size.
1062+
///
1063+
/// Consider a normal window with an HD video player and associated controls.Perhaps there are 15 pixels
1064+
/// of controls on the left edge, 25 pixels of controls on the right edge and 50 pixels of controls below
1065+
/// the player. In order to maintain a 16:9 aspect ratio (standard aspect ratio for HD @1920x1080) within
1066+
/// the player itself we would call this function with arguments of 16/9 and[40, 50]. The second argument
1067+
/// doesn’t care where the extra width and height are within the content view–only that they exist. Just
1068+
/// sum any extra width and height areas you have within the overall content view.
1069+
/// </summary>
1070+
/// <param name="aspectRatio">The aspect ratio to maintain for some portion of the content view.</param>
1071+
/// <param name="extraSize">The extra size not to be included while maintaining the aspect ratio.</param>
1072+
public void SetAspectRatio(double aspectRatio, Size extraSize)
1073+
{
1074+
BridgeConnector.Socket.Emit("browserWindowSetAspectRatio", Id, aspectRatio, JObject.FromObject(extraSize, _jsonSerializer));
1075+
}
1076+
10581077
/// <summary>
10591078
/// This will make a window maintain an aspect ratio. The extra size allows a developer to have space,
10601079
/// specified in pixels, not included within the aspect ratio calculations. This API already takes into

0 commit comments

Comments
 (0)