From 2be3fbbd0926b8f0fb4691ec12a0c8f073277c7b Mon Sep 17 00:00:00 2001 From: WuYongJie <549727955@qq.com> Date: Sun, 29 Nov 2026 02:01:25 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A4=8D=E7=94=A8=E5=B1=95=E5=BC=80=E8=BE=93?= =?UTF-8?q?=E5=85=A5=E5=8C=BA=E7=9A=84=E8=8D=89=E7=A8=BF=E9=AB=98=E5=BA=A6?= =?UTF-8?q?=E6=B5=8B=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../crates/ui-egui/src/jiansun/agent_panel.rs | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/apps/detail-photocraft/crates/ui-egui/src/jiansun/agent_panel.rs b/apps/detail-photocraft/crates/ui-egui/src/jiansun/agent_panel.rs index e1ed2f00..63859f42 100644 --- a/apps/detail-photocraft/crates/ui-egui/src/jiansun/agent_panel.rs +++ b/apps/detail-photocraft/crates/ui-egui/src/jiansun/agent_panel.rs @@ -2598,9 +2598,21 @@ impl Workspace { } fn composer_surface_height(&self, app: &PhotocraftApp, ui: &Ui, width: f32, progress: f32) -> f32 { - let attachment = if self.composer_text_send_allowed_for(app) { 0.0 } else { self.composer_attachments_extra_height() }; let references = reference_shelf_height(self.composer_reference_list(app).len(), (width - 28.0).max(1.0)); - let text_height = composer_galley(ui, &self.composer, (width - 32.0).max(1.0)).size().y.max(24.0); + if progress == 0.0 { + return 56.0 + references; + } + let attachment = if self.composer_text_send_allowed_for(app) { 0.0 } else { self.composer_attachments_extra_height() }; + let wrap_width = (width - 32.0).max(1.0); + let layout_key = (wrap_width, ui.pixels_per_point(), Tokens::get(ui.ctx()).kind); + let height_id = ui.scope_id().with("composer-draft-height"); + type DraftHeight = ((f32, f32, crate::theme::ThemeKind), String, f32); + let cached = ui.data_mut(|data| data.remove_temp::>(height_id)).flatten(); + let (key, draft, text_height) = cached + .filter(|(key, draft, _)| *key == layout_key && draft == &self.composer) + .unwrap_or_else(|| (layout_key, self.composer.clone(), + composer_galley(ui, &self.composer, wrap_width).size().y.max(24.0))); + ui.data_mut(|data| data.insert_temp(height_id, Some((key, draft, text_height)))); let expanded = (text_height + 74.0 + attachment).max(168.0) .min((ui.ctx().content_rect().height() * 0.5 - references).max(168.0)); 56.0 + references + (expanded - 56.0) * progress