Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lindexi_gd
Uno
提交
7e139e85
U
Uno
项目概览
lindexi_gd
/
Uno
大约 1 年 前同步成功
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
U
Uno
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
7e139e85
编写于
8月 07, 2023
作者:
M
Martin Zikmund
1
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix: Set initial Window size earlier on WASM
上级
0a675423
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
20 addition
and
22 deletion
+20
-22
src/Uno.UI/UI/Xaml/Application.wasm.cs
src/Uno.UI/UI/Xaml/Application.wasm.cs
+1
-1
src/Uno.UI/UI/Xaml/Window.wasm.cs
src/Uno.UI/UI/Xaml/Window.wasm.cs
+2
-11
src/Uno.UI/UI/Xaml/WindowManagerInterop.wasm.cs
src/Uno.UI/UI/Xaml/WindowManagerInterop.wasm.cs
+12
-5
src/Uno.UI/ts/WindowManager.ts
src/Uno.UI/ts/WindowManager.ts
+5
-5
未找到文件。
src/Uno.UI/UI/Xaml/Application.wasm.cs
浏览文件 @
7e139e85
...
...
@@ -110,7 +110,7 @@ namespace Windows.UI.Xaml
// Force init
Window
.
Current
.
ToString
();
var
arguments
=
WindowManagerInterop
.
FindLaunchArguments
();
var
arguments
=
WindowManagerInterop
.
BeforeLaunch
();
if
(
this
.
Log
().
IsEnabled
(
Uno
.
Foundation
.
Logging
.
LogLevel
.
Debug
))
{
...
...
src/Uno.UI/UI/Xaml/Window.wasm.cs
浏览文件 @
7e139e85
...
...
@@ -96,17 +96,7 @@ namespace Windows.UI.Xaml
[
JSExport
]
[
Preserve
]
public
static
void
Resize
(
double
width
,
double
height
)
{
var
window
=
Current
?.
_rootVisual
;
if
(
window
==
null
)
{
typeof
(
Window
).
Log
().
Error
(
$"Resize ignore, no current window defined"
);
return
;
// nothing to measure
}
Current
.
OnNativeSizeChanged
(
new
Size
(
width
,
height
));
}
public
static
void
Resize
(
double
width
,
double
height
)
=>
Current
.
OnNativeSizeChanged
(
new
Size
(
width
,
height
));
private
void
OnNativeSizeChanged
(
Size
size
)
{
...
...
@@ -164,6 +154,7 @@ namespace Windows.UI.Xaml
}
WindowManagerInterop
.
SetRootElement
(
_rootVisual
.
HtmlId
);
DispatchInvalidateMeasure
();
if
(
FeatureConfiguration
.
FrameworkElement
.
WasmUseManagedLoadedUnloaded
)
{
...
...
src/Uno.UI/UI/Xaml/WindowManagerInterop.wasm.cs
浏览文件 @
7e139e85
...
...
@@ -28,9 +28,16 @@ namespace Uno.UI.Xaml
internal
static
Task
InitAsync
(
bool
isLoadEventsEnabled
)
=>
NativeMethods
.
InitAsync
(
isLoadEventsEnabled
);
internal
static
string
FindLaunchArguments
()
=>
NativeMethods
.
FindLaunchArguments
();
/// <summary>
/// This method has two purposes:
/// - Initializes the window size before launch
/// - Returns the app arguments
/// The reason for having two concerns in one method
/// is to avoid unnecessary roundtrip between JS and C#.
/// </summary>
/// <returns>App launch arguments.</returns>
internal
static
string
BeforeLaunch
()
=>
NativeMethods
.
BeforeLaunch
();
internal
static
double
GetBootTime
()
=>
NativeMethods
.
GetBootTime
();
...
...
@@ -1095,8 +1102,8 @@ namespace Uno.UI.Xaml
[
JSImport
(
"globalThis.Uno.UI.WindowManager.current.destroyViewNativeFast"
)]
internal
static
partial
void
DestroyView
(
IntPtr
htmlId
);
[
JSImport
(
"globalThis.Uno.UI.WindowManager.
findLaunchArguments
"
)]
internal
static
partial
string
FindLaunchArguments
();
[
JSImport
(
"globalThis.Uno.UI.WindowManager.
beforeLaunch
"
)]
internal
static
partial
string
BeforeLaunch
();
[
JSImport
(
"globalThis.Uno.UI.WindowManager.getBootTime"
)]
internal
static
partial
double
GetBootTime
();
...
...
src/Uno.UI/ts/WindowManager.ts
浏览文件 @
7e139e85
...
...
@@ -194,7 +194,9 @@ namespace Uno.UI {
* Reads the window's search parameters
*
*/
static
findLaunchArguments
():
string
{
static
beforeLaunch
():
string
{
WindowManager
.
resize
();
if
(
typeof
URLSearchParams
===
"
function
"
)
{
return
new
URLSearchParams
(
window
.
location
.
search
).
toString
();
}
...
...
@@ -1056,8 +1058,6 @@ namespace Uno.UI {
this
.
dispatchEvent
(
this
.
rootElement
,
"
loaded
"
);
}
this
.
setAsArranged
(
newRootElement
);
// patch because root is not measured/arranged
this
.
resize
();
}
/**
...
...
@@ -1656,7 +1656,7 @@ namespace Uno.UI {
document
.
body
.
addEventListener
(
"
focusin
"
,
this
.
onfocusin
);
document
.
body
.
appendChild
(
this
.
containerElement
);
window
.
addEventListener
(
"
resize
"
,
x
=>
this
.
resize
());
window
.
addEventListener
(
"
resize
"
,
x
=>
WindowManager
.
resize
());
window
.
addEventListener
(
"
contextmenu
"
,
x
=>
{
if
(
!
(
x
.
target
instanceof
HTMLInputElement
)
||
x
.
target
.
classList
.
contains
(
"
context-menu-disabled
"
))
{
...
...
@@ -1679,7 +1679,7 @@ namespace Uno.UI {
}
}
private
resize
()
{
private
static
resize
()
{
WindowManager
.
resizeMethod
(
document
.
documentElement
.
clientWidth
,
document
.
documentElement
.
clientHeight
);
}
...
...
lindexi_gd
@lindexi_gd
mentioned in commit
a883ba85
·
8月 09, 2023
mentioned in commit
a883ba85
mentioned in commit a883ba85359c952f69c334be724796fa889da286
开关提交列表
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录