Skip to content

Commit dd55908

Browse files
committed
Improve animation effects during startup
1 parent 846679a commit dd55908

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

Tiefsee/WebWindow.cs

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -145,8 +145,6 @@ public static async Task<WebWindow> Create(string url, string[] args, WebWindow
145145
// 呼叫先前已經建立的 window 來顯示
146146
temp2._parentWindow = parentWindow;
147147
temp2._args = args;
148-
//temp2._wv2.Width = 1600;
149-
//temp2._wv2.Height = 900;
150148
temp2._wv2.NavigationCompleted += (sender, e) => { // 網頁載入完成時
151149
TriggerCreate(temp2, args);
152150
};
@@ -305,6 +303,8 @@ public async Task Init() {
305303

306304
if (_isShow == false) { return; }
307305

306+
307+
308308
var w = panel.Width;
309309
var h = panel.Height;
310310
// 在網頁內使用 border 繪製視窗外框時,在縮放過比例的螢幕可能會導致 broder 被裁切
@@ -314,6 +314,11 @@ public async Task Init() {
314314
w += 1;
315315
h += 1;
316316
}
317+
// win11 的圓角效果,邊框會往內吃掉 1px,所以要主動把 webview2 往外內 1px,避免右邊的捲動條被遮住
318+
if (_windowRoundedCorners && this.WindowState == FormWindowState.Normal) {
319+
w -= 1;
320+
h -= 1;
321+
}
317322
if (_wv2.Width != w || _wv2.Height != h) {
318323
_wv2.Width = w;
319324
_wv2.Height = h;
@@ -457,10 +462,6 @@ public async void ShowWindowAtCenter(int width, int height) {
457462

458463
if (_isShow) { return; }
459464

460-
// 先隱藏視窗再顯示,避免視窗顯示時的閃爍
461-
this.Show();
462-
this.Hide();
463-
464465
await ShowWindow(() => { });
465466

466467
// 取得螢幕縮放比例
@@ -530,7 +531,7 @@ private async Task ShowWindow(Action func) {
530531

531532
// --------
532533

533-
await Task.Delay(50);
534+
// await Task.Delay(50);
534535

535536
_isShow = true;
536537
this.Show();

Www/scss/BaseWindow.scss

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,8 @@ body {
9797
}
9898
// win11 圓角
9999
.window.windowRoundedCorners {
100+
right: 0.5px;
101+
bottom: 0.5px;
100102
box-shadow: none;
101103
border: none;
102104
border-radius: 0px;

0 commit comments

Comments
 (0)