-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Closed
Description
该问题是否已经被报告过了? Is there an existing issue for this?
- 我已经搜索了 Issues,没有发现类似问题
I have searched the existing issuesTo pick up a draggable item, press the space bar. While dragging, use the arrow keys to move the item. Press space again to drop the item in its new position, or press escape to cancel.
该问题是否能够在默认主题(daylight/midnight)下重现? Can the issue be reproduced with the default theme (daylight/midnight)?
- 我能够在默认主题下重现该问题
I was able to reproduce the issue with the default themeTo pick up a draggable item, press the space bar. While dragging, use the arrow keys to move the item. Press space again to drop the item in its new position, or press escape to cancel.
该问题是否可能是由于扩展功能导致? Could the issue be due to extensions?
- 我已经排除了扩展导致问题的可能性
I've ruled out the possibility that the extension is causing the problem.To pick up a draggable item, press the space bar. While dragging, use the arrow keys to move the item. Press space again to drop the item in its new position, or press escape to cancel.
描述问题 Describe the problem
如下两行代码一直使用screen的width和height, 没有将windowState的width和height读入使用.
Lines 189 to 190 in f83a07f
defaultWidth = screen.getPrimaryDisplay().size.width; | |
defaultHeight = screen.getPrimaryDisplay().workAreaSize.height; |
将代码改为下面的形式, 能够在下次打开程序时套用上次的windowState的width和height.
defaultWidth = oldWindowState ? oldWindowState.width : screen.getPrimaryDisplay().size.width;
defaultHeight = oldWindowState ? oldWindowState.height: screen.getPrimaryDisplay().workAreaSize.height;
期待的结果 Expected result
请在后续版本修正此问题, 谢谢.
截屏或者录屏演示 Screenshot or screen recording presentation
No response
版本环境 Version environment
- Version: 2.8.0
- Operating System: Windows 10
- Browser (if used):
日志文件 Log file
更多信息 More information
No response
Metadata
Metadata
Assignees
Labels
Type
Projects
Relationships
Development
Select code repository
Activity
88250 commentedon Mar 23, 2023
我这里重现不了问题,后面的代码会进行覆盖:
88250 commentedon Mar 23, 2023
另外,对于修改方案的实现:
oldWindowState
这个变量应该一直会存在的,上面已经初始化过了{}
,但是这样不能保证里面有width
和height
两个字段。88250 commentedon Mar 23, 2023
这是增加两句调试日志的输出:
所以我觉得问题可能不是出在读取上。
你那里可以试下退出以后打开 windowState.json 看下是否已经持久化。
我先关闭了,如果还有问题请继续跟帖,谢谢 🙏
paiooocn commentedon Mar 24, 2023
我输出了windowState, 和你说的一样, windowState加载了oldWindowState的数据.
发现在下面的代码里, 条件为真时使用了defaultWidth, defaultHeight
siyuan/app/electron/main.js
Lines 207 to 212 in f83a07f
我输出了workArea和windowState的width, height
返回的
workArea.height==windowState.height
,此条件生效
if (windowState.width >= workArea.width || windowState.height >= workArea.height)
,导致windowState.width, windowState.height被赋值defaultWidth, defaultHeight.
你可以将窗口高度拉到最大试试看能否重现. 我调小高度到1000后, 窗口大小正常了.
条件改为
>
后, 可以修正这个问题.[-]window 10下调整窗口大小后, 重新打开时还是1920x1040大小[/-][+]重启后窗口大小恢复默认问题[/+]88250 commentedon Mar 24, 2023
确实是这个问题,感谢指正,下个版本修复。
🐛 重启后窗口大小恢复默认问题 Fix #7755
🐛 重启后窗口大小恢复默认问题 Fix #7755