Skip to content

feat: drag and fling characters to reposition them#9

Open
akdenizemirhan wants to merge 2 commits intoryanstephen:mainfrom
akdenizemirhan:feat/drag-and-fling-characters
Open

feat: drag and fling characters to reposition them#9
akdenizemirhan wants to merge 2 commits intoryanstephen:mainfrom
akdenizemirhan:feat/drag-and-fling-characters

Conversation

@akdenizemirhan
Copy link
Copy Markdown

Summary

  • Characters sometimes walk in front of UI elements you need to click
  • This adds drag-and-drop support to move them out of the way
  • Fling gesture with ice-sliding physics for fun interaction

What's new

  • Click + drag moves the character (5px threshold prevents accidental drags)
  • Short click still opens chat popover (unchanged behavior)
  • Fling the character and it slides with friction, bouncing off screen edges
  • Character resumes walking from new position after 2 seconds

Technical details

  • CharacterContentView: Added mouseDown/mouseDragged/mouseUp with drag state tracking and velocity sampling
  • WalkerCharacter: Added isBeingDragged flag that pauses the walk animation loop during drag, ice-slide physics in update(), and syncPositionFromWindow() to correctly update walk state after repositioning

Test plan

  • Short click opens chat popover
  • Drag moves character smoothly in real-time
  • Fling creates ice-slide effect with deceleration
  • Character bounces off screen edges when flung
  • Character stays at new position (no teleporting back)
  • Walking resumes from new position after 2 seconds

🤖 Generated with Claude Code

akdenizemirhan and others added 2 commits March 25, 2026 23:33
Streaming text from Claude's responses was not being saved to the
session history. When the popover closed and reopened, only user
messages appeared - assistant responses were lost.

The root cause: Claude CLI returns streaming text via "assistant" type
messages, but the "result" type message has an empty "result" field.
The history was only populated from the "result" field, so responses
were never saved.

Fix: accumulate streaming text during the assistant response and save
it to history when the turn completes.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Characters sometimes block UI elements underneath. This adds the ability
to grab and drag them out of the way.

- Click and drag to move a character (5px threshold prevents accidental drags)
- Short click still opens the chat popover as before
- Fling a character and it slides on ice with friction, bouncing off screen edges
- Character resumes walking from the new position after 2 seconds

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@ryanstephen
Copy link
Copy Markdown
Owner

This is fun, but a little glitchy in practice. Will consider if we can polish positioning and drag behavior, thanks.

itsnothuy added a commit to itsnothuy/lil-agents that referenced this pull request Apr 15, 2026
- Add drag-to-reposition with fling physics (PR ryanstephen#9 reimplemented cleanly)
  - 5px threshold, exponential velocity smoothing, dock-bound bounce
  - Feature flag: WalkerCharacter.dragEnabled
- Fix character motion freeze (UserDefaults optional chain bug)
- Fix walkEndPixel not recomputed after separation clamp
- Fix Sparkle gentle reminders (userDriverDelegate)
- Fix makeKeyWindow warning (KeyableWindow)
- Fix CGWindowListCreateImage deprecation isolation
- Fix 3 compiler warnings (CodexSession, OpenClawSession, TerminalView)
- Add documentation: animation docs, bug post-mortems, feature review
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