Skip to content

Brain icon collapses out of layout when not thinking, and FontSize pulse shifts adjacent content #46

Description

@JoshuaRowePhantom

Describe the bug

Two related layout problems with the brain icon (🧠) in the agent chat status line:

  1. Collapses when not thinking. The TextBlock uses IsVisible="{Binding StatusLine.IsThinking}". In Avalonia, IsVisible=false removes the element from the layout pass entirely — the status line and adjacent content shift when thinking starts/stops.

  2. FontSize pulse shifts adjacent content. The CSS-style pulse animation in AgentChatStatusLineStyles.axaml animates FontSize from 12 to 16. Because the TextBlock participates in layout with its natural size, growing the font pushes the model/provider text to the right on every pulse tick.

Expected behaviour

  • The brain icon always occupies a fixed, reserved slot in the status line. It is invisible when not thinking, but the space it occupies never changes.
  • The icon itself changes size during the pulse (giving the visual "heartbeat" effect), but this size change must not affect the layout of any other element.

Affected files

  • Phantom.Workspaces.Agent.Gui/Controls/AgentChatEditorControl.axaml — brain TextBlock declaration (line 40–43); replace IsVisible binding with Opacity (or IsHitTestVisible + Opacity) so the space is always reserved
  • Phantom.Workspaces.Gui.Styles/Styles/AgentChatStatusLineStyles.axaml — pulse animation on FontSize; use a RenderTransform scale instead of FontSize so the size change is purely visual and does not affect layout

Suggested fix

In AgentChatEditorControl.axaml: swap IsVisible for an opacity binding so the element is always laid out:

<TextBlock Classes="agent-chat-status-line-brain"
           FontFamily="Segoe UI Emoji"
           Text="🧠"
           Opacity="{Binding StatusLine.IsThinking, Converter={StaticResource BoolToOpacityConverter}}" />

In AgentChatStatusLineStyles.axaml: change the pulse to animate ScaleTransform (applied via RenderTransformOrigin="0.5,0.5") rather than FontSize, so the glyph scales around its centre without touching the layout box:

<Style Selector="TextBlock.agent-chat-status-line-brain">
    <Setter Property="FontSize" Value="{DynamicResource AgentChat.StatusLine.FontSize}" />
    <Setter Property="RenderTransformOrigin" Value="0.5,0.5" />
    <Setter Property="RenderTransform">
        <ScaleTransform ScaleX="1" ScaleY="1" />
    </Setter>
    <Style.Animations>
        <Animation IterationCount="INFINITE" Duration="0:0:1"
                   PlaybackDirection="Alternate" Easing="SineEaseInOut">
            <KeyFrame Cue="0%">
                <Setter Property="ScaleTransform.ScaleX" Value="1" />
                <Setter Property="ScaleTransform.ScaleY" Value="1" />
            </KeyFrame>
            <KeyFrame Cue="100%">
                <Setter Property="ScaleTransform.ScaleX" Value="1.35" />
                <Setter Property="ScaleTransform.ScaleY" Value="1.35" />
            </KeyFrame>
        </Animation>
    </Style.Animations>
</Style>

The fixed layout slot means the status line height and the positions of all other items stay stable regardless of whether the agent is thinking.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingverifiedIssue has been verified

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions