Skip to content

feat(inventory-list): add smooth highlighting to items in the inventory list#181

Open
zndxcvbn wants to merge 7 commits into
mainfrom
feat-smooth-anim-selection
Open

feat(inventory-list): add smooth highlighting to items in the inventory list#181
zndxcvbn wants to merge 7 commits into
mainfrom
feat-smooth-anim-selection

Conversation

@zndxcvbn

@zndxcvbn zndxcvbn commented Apr 25, 2026

Copy link
Copy Markdown
Collaborator

This PR adds a smooth highlight animation when hovering over inventory items.

Tasks:

  • Add setting for enable/disable smooth highlighting

Summary by CodeRabbit

Release Notes

  • New Features
    • Implemented smooth selection animations for list items, featuring fade-in and motion effects
    • Enhanced visual feedback when navigating menu lists with animated transitions
    • Improved keyboard navigation support across menus for better user interaction

@coderabbitai

coderabbitai Bot commented Apr 25, 2026

Copy link
Copy Markdown
Contributor

Warning

Rate limit exceeded

@zndxcvbn has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 41 minutes and 41 seconds before requesting another review.

To keep reviews running without waiting, you can enable usage-based add-on for your organization. This allows additional reviews beyond the hourly cap. Account admins can enable it under billing.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 08e89f5c-b8fa-4f82-9653-6d9a2aa34d6e

📥 Commits

Reviewing files that changed from the base of the PR and between 069d253 and 0d6e4c7.

📒 Files selected for processing (7)
  • data/interface/skyui/config.txt
  • source/actionscript/Common/skyui/components/list/ScrollingList.as
  • source/actionscript/Common/skyui/components/list/TabularList.as
  • source/actionscript/Common/skyui/components/list/TabularListEntry.as
  • source/actionscript/CraftingMenu/CraftingListEntry.as
  • source/actionscript/ItemMenus/InventoryListEntry.as
  • source/swfsources.cmake
📝 Walkthrough

Walkthrough

This pull request introduces selection animation control to SkyUI's list components. ScrollingList gains animation-disable flags and animation baseline tracking. TabularListEntry implements selection animation with fade-in and jump-decay effects via onEnterFrame callbacks. Subclass initialization methods are updated to pass index context to the parent class.

Changes

Cohort / File(s) Summary
ScrollingList Animation Control
source/actionscript/Common/skyui/components/list/ScrollingList.as
Adds public variables bDisableAnim and lastSelectionAnimY to track animation state. List rebuilding and scroll events are wrapped with animation disable toggles.
TabularListEntry Selection Animation
source/actionscript/Common/skyui/components/list/TabularListEntry.as
Implements three new methods: initialize() override (adjusts hitArea), updateSelectionAnimation() (handles fade-in/jump-decay animation via onEnterFrame), and resetSelectionAnim() (clears animation state). Selection changes now route through animation logic instead of simple visibility toggles.
Subclass Initialization Updates
source/actionscript/CraftingMenu/CraftingListEntry.as, source/actionscript/ItemMenus/InventoryListEntry.as
Forward a_index parameter to parent class initialize() method instead of calling with no arguments.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant ScrollingList
    participant TabularListEntry
    participant AnimationSystem as Animation System<br/>(onEnterFrame)

    User->>ScrollingList: Select list item
    Note over ScrollingList: Check bDisableAnim flag
    
    alt bDisableAnim is true
        ScrollingList->>TabularListEntry: updateSelectionAnimation(true)
        TabularListEntry->>TabularListEntry: Immediately set indicator visible<br/>Record Y to lastSelectionAnimY
    else bDisableAnim is false
        ScrollingList->>TabularListEntry: updateSelectionAnimation(true)
        TabularListEntry->>TabularListEntry: Make indicator visible
        
        alt No prior animation Y baseline
            TabularListEntry->>AnimationSystem: Register onEnterFrame (fade-in)
            AnimationSystem->>TabularListEntry: Animate opacity increase
        else Prior Y baseline exists
            TabularListEntry->>AnimationSystem: Register onEnterFrame (jump-decay)
            AnimationSystem->>TabularListEntry: Animate Y jump and opacity<br/>based on lastSelectionAnimY
        end
    end
    
    User->>ScrollingList: Deselect or move selection
    ScrollingList->>TabularListEntry: updateSelectionAnimation(false)
    TabularListEntry->>TabularListEntry: resetSelectionAnim()<br/>Clear animation state
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: adding smooth highlighting animation to inventory list items, which matches the core functionality added across ScrollingList, TabularListEntry, and related files.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
Review rate limit: 0/1 reviews remaining, refill in 41 minutes and 41 seconds.

Comment @coderabbitai help to get the list of available commands and usage tips.

@zndxcvbn zndxcvbn changed the title feat(list-entry): add smooth highlighting to items in the inventory list feat(inventory-list): add smooth highlighting to items in the inventory list Apr 25, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick comments (4)
source/actionscript/Common/skyui/components/list/TabularListEntry.as (2)

127-130: Heads-up: diffY == 0 short-circuit leaves any in-flight onEnterFrame running.

When the same entry is re-selected at the same _y (e.g., redundant setEntry from a layout re-evaluation), an in-progress jump-decay or fade-in continues to completion. That's almost certainly the intended behavior (don't restart an animation when nothing moved), but worth confirming — if you ever want re-selection to snap-finish a decay, you'd need an explicit resetSelectionAnim(true) here.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@source/actionscript/Common/skyui/components/list/TabularListEntry.as` around
lines 127 - 130, The early return in TabularListEntry (inside the
setEntry/selection handling where it checks diffY == 0) leaves any in-flight
onEnterFrame animation running; to ensure re-selection can snap-finish
animations when desired, call resetSelectionAnim(true) before returning (or
document why you intentionally want to keep animations running). Specifically,
update the block that computes prevY/ diffY in TabularListEntry to invoke
resetSelectionAnim(true) when diffY == 0 if you want to immediately finish the
current jump-decay/fade-in, otherwise add a comment explaining why the current
behavior is correct so maintainers know this was intentional.

101-101: Tighten a_list parameter typing.

a_list: Object is permissive; the body reads bDisableAnim and lastSelectionAnimY, which are defined only on ScrollingList. Typing it as skyui.components.list.ScrollingList (or as BasicList if you'd prefer to relocate those fields up the hierarchy) would catch accidental misuse at compile time and document the coupling that already exists in practice.

♻️ Proposed type tightening
-    public function updateSelectionAnimation(isSelected: Boolean, a_list: Object)
+    public function updateSelectionAnimation(isSelected: Boolean, a_list: skyui.components.list.ScrollingList)
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@source/actionscript/Common/skyui/components/list/TabularListEntry.as` at line
101, The method updateSelectionAnimation currently accepts a_list: Object but
reads properties (bDisableAnim, lastSelectionAnimY) that exist on ScrollingList;
change the parameter type on updateSelectionAnimation to
skyui.components.list.ScrollingList (or to BasicList if you prefer to promote
bDisableAnim/lastSelectionAnimY up the class hierarchy) and update any
imports/usages accordingly so the compiler enforces the tighter type and
existing references inside updateSelectionAnimation remain valid.
source/actionscript/Common/skyui/components/list/ScrollingList.as (2)

330-335: Consider exception safety (or document the assumption).

If updateScrollPosition throws, bDisableAnim would be left stuck at true and all subsequent selections would skip animation. AS2 doesn't have try/finally as ergonomically as AS3, but given Flash usually swallows exceptions silently, the practical risk is low. Worth noting in case animation ever appears "stuck off" in the field.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@source/actionscript/Common/skyui/components/list/ScrollingList.as` around
lines 330 - 335, The onScroll handler currently sets bDisableAnim = true before
calling updateScrollPosition and resets it after, which can leave bDisableAnim
true if updateScrollPosition throws; modify onScroll to ensure bDisableAnim is
always reset (use a try/catch/finally-style pattern available in this
environment or explicitly catch errors around updateScrollPosition and restore
bDisableAnim in the catch and after normal execution), referencing the onScroll
function, the updateScrollPosition call, and the bDisableAnim field, or
alternatively add a clear comment on the assumption that updateScrollPosition
cannot throw and why that is safe.

40-49: Animation guard bypassed when scrollbar is undefined.

onScroll (lines 332–334) wraps updateScrollPosition with bDisableAnim = true/false, but the else branch here calls updateScrollPosition directly without the same guard. When scrollbar is undefined (the onLoad guard shows that's possible), programmatic scrolls via this setter — including those triggered indirectly by moveSelectionUp/Down and onMouseWheel — will run UpdateList with bDisableAnim = false, so the selected entry's _y change re-enters the jump-decay path on every scroll instead of being treated as a layout reset.

♻️ Proposed fix to keep the no-scrollbar path consistent
         if (this.scrollbar != undefined)
             this.scrollbar.position = a_newPosition;
-        else
-            this.updateScrollPosition(a_newPosition);
+        else {
+            this.bDisableAnim = true;
+            this.updateScrollPosition(a_newPosition);
+            this.bDisableAnim = false;
+        }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@source/actionscript/Common/skyui/components/list/ScrollingList.as` around
lines 40 - 49, The setter scrollPosition currently calls updateScrollPosition
directly when scrollbar is undefined, bypassing the animation-disable guard used
by onScroll; change the else branch in the scrollPosition setter to call
updateScrollPosition in the same guarded way as onScroll (i.e., pass the
bDisableAnim flag or invoke the same wrapper) so programmatic scrolls (from
moveSelectionUp/Down, onMouseWheel, etc.) call updateScrollPosition with
bDisableAnim=true and preserve the no-animation/layout-reset semantics used by
onScroll and onLoad.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@source/actionscript/Common/skyui/components/list/ScrollingList.as`:
- Around line 330-335: The onScroll handler currently sets bDisableAnim = true
before calling updateScrollPosition and resets it after, which can leave
bDisableAnim true if updateScrollPosition throws; modify onScroll to ensure
bDisableAnim is always reset (use a try/catch/finally-style pattern available in
this environment or explicitly catch errors around updateScrollPosition and
restore bDisableAnim in the catch and after normal execution), referencing the
onScroll function, the updateScrollPosition call, and the bDisableAnim field, or
alternatively add a clear comment on the assumption that updateScrollPosition
cannot throw and why that is safe.
- Around line 40-49: The setter scrollPosition currently calls
updateScrollPosition directly when scrollbar is undefined, bypassing the
animation-disable guard used by onScroll; change the else branch in the
scrollPosition setter to call updateScrollPosition in the same guarded way as
onScroll (i.e., pass the bDisableAnim flag or invoke the same wrapper) so
programmatic scrolls (from moveSelectionUp/Down, onMouseWheel, etc.) call
updateScrollPosition with bDisableAnim=true and preserve the
no-animation/layout-reset semantics used by onScroll and onLoad.

In `@source/actionscript/Common/skyui/components/list/TabularListEntry.as`:
- Around line 127-130: The early return in TabularListEntry (inside the
setEntry/selection handling where it checks diffY == 0) leaves any in-flight
onEnterFrame animation running; to ensure re-selection can snap-finish
animations when desired, call resetSelectionAnim(true) before returning (or
document why you intentionally want to keep animations running). Specifically,
update the block that computes prevY/ diffY in TabularListEntry to invoke
resetSelectionAnim(true) when diffY == 0 if you want to immediately finish the
current jump-decay/fade-in, otherwise add a comment explaining why the current
behavior is correct so maintainers know this was intentional.
- Line 101: The method updateSelectionAnimation currently accepts a_list: Object
but reads properties (bDisableAnim, lastSelectionAnimY) that exist on
ScrollingList; change the parameter type on updateSelectionAnimation to
skyui.components.list.ScrollingList (or to BasicList if you prefer to promote
bDisableAnim/lastSelectionAnimY up the class hierarchy) and update any
imports/usages accordingly so the compiler enforces the tighter type and
existing references inside updateSelectionAnimation remain valid.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 61be3f79-7248-48c2-8140-eca0ab0efcdb

📥 Commits

Reviewing files that changed from the base of the PR and between 1523d12 and 069d253.

📒 Files selected for processing (4)
  • source/actionscript/Common/skyui/components/list/ScrollingList.as
  • source/actionscript/Common/skyui/components/list/TabularListEntry.as
  • source/actionscript/CraftingMenu/CraftingListEntry.as
  • source/actionscript/ItemMenus/InventoryListEntry.as

@zndxcvbn zndxcvbn added deferred Will be considered at a later date labels May 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

deferred Will be considered at a later date

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant