Skip to content

feat: 主界面在长度溢出时的自动缩放能力#1642

Draft
kaokao221 wants to merge 2 commits intoClassIsland:masterfrom
kaokao221:auto-scale
Draft

feat: 主界面在长度溢出时的自动缩放能力#1642
kaokao221 wants to merge 2 commits intoClassIsland:masterfrom
kaokao221:auto-scale

Conversation

@kaokao221
Copy link
Copy Markdown
Contributor

@kaokao221 kaokao221 commented Feb 10, 2026

这个 Pull Request 做了什么?

feat: 在主界面长度过长时不再向右溢出,而是缩放到屏幕内,并通过缓冲解决闪烁问题。

相关 Issue

Fixes #279

P.S.还好我看了一眼,怎么还有上古 issue 跟我想到一块去了

检查清单

  • 我已经在本地测试过这个 PR,确保欲实现的功能或修复的问题能正常工作。

目前仍然存在手动调整缩放比例的缩放过程的主界面漂移问题且未解决,谨慎合并。

@kaokao221 kaokao221 mentioned this pull request Feb 10, 2026
5 tasks
@kaokao221 kaokao221 marked this pull request as ready for review February 11, 2026 15:08
@kaokao221 kaokao221 requested review from a team and HelloWRC as code owners February 11, 2026 15:08
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9975f52057

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment on lines +823 to +826
{
if (value == _autoScalingBufferFrameCount) return;
_autoScalingBufferFrameCount = value;
OnPropertyChanged();
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Clamp auto-scaling buffer frame count

AutoScalingBufferFrameCount currently accepts 0 or negative values, which can come from Settings.json, management-delivered defaults, or automation overlays (these paths bypass the NumberBox minimum). In AniScalingDecorator.MeasureOverride, such values empty the queue and then _scaleBuffer.Average() throws on an empty sequence, causing layout-time failures/crashes when the main window renders; this setter should enforce a minimum of 1 (or the measure path should guard against empty buffers).

Useful? React with 👍 / 👎.


var averageScale = _scaleBuffer.Average();
// 发生溢出时优先使用瞬时值(Min-Hold),确保立刻响应
var targetScale = Math.Min(instantScale, averageScale);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Bypass buffered average when auto scaling is disabled

Turning IsAutoScalingEnabled off does not immediately stop scaling because instantScale is forced to 1.0 but targetScale is still computed as Math.Min(instantScale, averageScale), so stale buffered values below 1 keep the UI shrunk after the user disables the feature. This is visible when content was previously compressed and users toggle auto scaling off expecting an immediate return to normal size.

Useful? React with 👍 / 👎.

var startTime = DateTime.Now;

DispatcherTimer.Run(() =>
{
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里应该优先考虑使用 Avalonia 的 Transition 或 Animation 来实现动画

Comment thread ClassIsland/MainWindow.axaml Outdated
<Style Selector=":edit-mode StackPanel#StackPanelRootContainer">
<Setter Property="VerticalAlignment" Value="Center" />
</Style>
<Style Selector=":dock-left StackPanel#StackPanelRootContainer">
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

停靠已由主界面行进行处理,除非有必要的理由,不宜在主界面顶级进行处理

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个问题好像是不做处理的话原来的居中设置似乎会失效,我再去看看

@kaokao221 kaokao221 changed the title feat: 主界面在长度溢出时的自动缩放能力 feat: 主界面在长度溢出时的自动缩放能力和通过 URI 启动指定的插件页面和安装指定插件的能力 Feb 28, 2026
@HelloWRC
Copy link
Copy Markdown
Member

请将这两个功能拆分到两个 PR 中

@kaokao221 kaokao221 changed the title feat: 主界面在长度溢出时的自动缩放能力和通过 URI 启动指定的插件页面和安装指定插件的能力 feat: 主界面在长度溢出时的自动缩放能力,通过 URI 启动指定的插件页面和安装指定插件的能力 和 删除主界面组件/行确认功能 Feb 28, 2026
@HelloWRC
Copy link
Copy Markdown
Member

@codex review

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ec756c7d85

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +275 to +276
_lastScale = SettingsService.Settings.Scale;
SetLayoutScale(SettingsService.Settings.Scale);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Initialize animated scale before first position update

UpdateWindowPos now uses GetCurrentAnimatedScale() (which returns AnimatedScale) for offset math, but the constructor only sets _lastScale and SetLayoutScale(...) here. On startup with a persisted scale other than 1.0, AnimatedScale is still its default value, so initial window/effect positioning is computed with the wrong scale until the user changes the scale setting again.

Useful? React with 👍 / 👎.

Comment on lines +294 to +296
downloadComplete = true;
dialog.Header = "插件已安装";
statusText.Text = $"插件 {resolvedPluginInfo?.Manifest.Name ?? pluginId} 安装完成,重启应用以加载插件。";
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Validate install success before showing restart state

This completion block unconditionally marks the plugin as installed once DownloadTasks no longer contains pluginId, but RequestDownloadPlugin removes that entry in finally even when download/checksum fails (it stores the exception on the task in catch). In failure scenarios (e.g., network error or checksum mismatch), users will still see “安装完成” and be prompted to restart even though no plugin was installed.

Useful? React with 👍 / 👎.

@kaokao221
Copy link
Copy Markdown
Contributor Author

请将这两个功能拆分到两个 PR 中

啊抱歉才看到,那有点麻烦了,有几处更改是同一个文件的,我一开始忘了分 branch 了

@kaokao221 kaokao221 changed the title feat: 主界面在长度溢出时的自动缩放能力,通过 URI 启动指定的插件页面和安装指定插件的能力 和 删除主界面组件/行确认功能 feat: 主界面在长度溢出时的自动缩放能力 Mar 13, 2026
@kaokao221
Copy link
Copy Markdown
Contributor Author

请将这两个功能拆分到两个 PR 中

Finished: #1701 #1702

@kaokao221 kaokao221 marked this pull request as draft April 11, 2026 06:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

自适应主界面缩放大小

2 participants