feat(inventory-list): implement marquee multi-selection#189
Conversation
📝 WalkthroughWalkthroughAdds marquee-based multi-selection to the inventory: new MarqueeSelectionController, integration in InventoryMenu, per-entry marquee selection state in TabularListEntry, SWF export and build updates, and a config flag to enable the feature. Changes
Sequence Diagram(s)sequenceDiagram
actor User
participant InventoryMenu
participant MarqueeSelectionController
participant TabularListEntry
User->>InventoryMenu: mouse down (Ctrl)+drag
InventoryMenu->>MarqueeSelectionController: onMouseDown(details)
activate MarqueeSelectionController
MarqueeSelectionController->>MarqueeSelectionController: create marquee, capture baseline
User->>InventoryMenu: mouse move
InventoryMenu->>MarqueeSelectionController: onMouseMove(details)
MarqueeSelectionController->>InventoryMenu: compute intersections
MarqueeSelectionController->>TabularListEntry: setMultiSelected(true/false) per intersected entry
TabularListEntry->>TabularListEntry: set isMarqueeSelected and update indicator
User->>InventoryMenu: mouse up
InventoryMenu->>MarqueeSelectionController: onMouseUp()
MarqueeSelectionController->>MarqueeSelectionController: hide marquee, finalize selection
deactivate MarqueeSelectionController
User->>InventoryMenu: request Drop
InventoryMenu->>MarqueeSelectionController: startBatchDrop()
activate MarqueeSelectionController
MarqueeSelectionController->>InventoryMenu: queue indices, disable input
MarqueeSelectionController->>InventoryMenu: per-frame -> doSetSelectedIndex & ItemDrop (for each queued index)
MarqueeSelectionController->>MarqueeSelectionController: restore input, clear selection
deactivate MarqueeSelectionController
Estimated code review effort🎯 4 (Complex) | ⏱️ ~50 minutes Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
Tip 💬 Introducing Slack Agent: The best way for teams to turn conversations into code.Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.
Built for teams:
One agent for your entire SDLC. Right inside Slack. 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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@source/actionscript/ItemMenus/InventoryMenu.as`:
- Around line 59-61: The code directly dereferences
a_config.ItemList.selection.marquee.enabled which can throw if any node is
missing; in InventoryMenu (where _enableMarquee is set) guard each level
(a_config, a_config.ItemList, a_config.ItemList.selection,
a_config.ItemList.selection.marquee) before reading .enabled and otherwise set
this._enableMarquee = false; update the assignment near the existing block to
check existence (or use a safe-navigation-style helper) and only assign the
enabled value when defined, defaulting to false when nodes are absent.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 6d9bda57-ca7e-4542-aed9-0f6223217a7a
📒 Files selected for processing (3)
data/interface/skyui/config.txtsource/actionscript/Common/skyui/components/list/TabularListEntry.assource/actionscript/ItemMenus/InventoryMenu.as
| if (a_config.ItemList.selection.marquee.enabled != undefined) { | ||
| this._enableMarquee = a_config.ItemList.selection.marquee.enabled; | ||
| } |
There was a problem hiding this comment.
Guard nested marquee config access.
Line 59 dereferences deep properties directly; if a user runs with an older config shape, this can break menu initialization. Default to false when nodes are missing.
Suggested fix
- if (a_config.ItemList.selection.marquee.enabled != undefined) {
- this._enableMarquee = a_config.ItemList.selection.marquee.enabled;
- }
+ var marqueeCfg = (a_config.ItemList != undefined && a_config.ItemList.selection != undefined)
+ ? a_config.ItemList.selection.marquee
+ : undefined;
+ this._enableMarquee = (marqueeCfg != undefined && marqueeCfg.enabled == true);📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| if (a_config.ItemList.selection.marquee.enabled != undefined) { | |
| this._enableMarquee = a_config.ItemList.selection.marquee.enabled; | |
| } | |
| var marqueeCfg = (a_config.ItemList != undefined && a_config.ItemList.selection != undefined) | |
| ? a_config.ItemList.selection.marquee | |
| : undefined; | |
| this._enableMarquee = (marqueeCfg != undefined && marqueeCfg.enabled == true); |
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@source/actionscript/ItemMenus/InventoryMenu.as` around lines 59 - 61, The
code directly dereferences a_config.ItemList.selection.marquee.enabled which can
throw if any node is missing; in InventoryMenu (where _enableMarquee is set)
guard each level (a_config, a_config.ItemList, a_config.ItemList.selection,
a_config.ItemList.selection.marquee) before reading .enabled and otherwise set
this._enableMarquee = false; update the assignment near the existing block to
check existence (or use a safe-navigation-style helper) and only assign the
enabled value when defined, defaulting to false when nodes are absent.
There was a problem hiding this comment.
Actionable comments posted: 1
♻️ Duplicate comments (1)
source/actionscript/ItemMenus/InventoryMenu.as (1)
53-55:⚠️ Potential issue | 🟠 Major | ⚡ Quick winGuard the nested marquee config lookup.
This still dereferences
a_config.ItemList.selection.marquee.enabledeagerly, so older or partial config shapes can break menu setup before_marqueeController.enabledis assigned.Suggested fix
- if (a_config.ItemList.selection.marquee.enabled != undefined) { - this._marqueeController.enabled = a_config.ItemList.selection.marquee.enabled; - } + var marqueeCfg = (a_config.ItemList != undefined && a_config.ItemList.selection != undefined) + ? a_config.ItemList.selection.marquee + : undefined; + this._marqueeController.enabled = (marqueeCfg != undefined && marqueeCfg.enabled == true);🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@source/actionscript/ItemMenus/InventoryMenu.as` around lines 53 - 55, The code directly dereferences a_config.ItemList.selection.marquee.enabled which can throw if ItemList, selection, or marquee are missing; update the InventoryMenu.as initialization to first verify each intermediate exists (e.g., check a_config.ItemList && a_config.ItemList.selection && a_config.ItemList.selection.marquee) before reading .enabled, then assign to this._marqueeController.enabled only when that value is defined; reference the a_config.ItemList.selection.marquee.enabled lookup and the this._marqueeController.enabled assignment when making the change.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In
`@source/actionscript/Common/skyui/components/list/MarqueeSelectionController.as`:
- Around line 119-124: The queued drop path is being used even for a single
marquee-selected entry, causing full-stack drops; change the branch in
MarqueeSelectionController where it checks this._dropQueue.length to
special-case length == 1: if length > 1 keep the current batch flow (sort
_dropQueue, set list.disableInput, this._isProcessingQueue = true and set
this._menu.onEnterFrame = mx.utils.Delegate.create(this,
this.processDropQueue)), but if length == 1 bypass the queued/batch logic and
call the normal InventoryMenu.DropItem flow for that single entry so quantity
handling is preserved (do not set disableInput/_isProcessingQueue or
onEnterFrame for the single-item case).
---
Duplicate comments:
In `@source/actionscript/ItemMenus/InventoryMenu.as`:
- Around line 53-55: The code directly dereferences
a_config.ItemList.selection.marquee.enabled which can throw if ItemList,
selection, or marquee are missing; update the InventoryMenu.as initialization to
first verify each intermediate exists (e.g., check a_config.ItemList &&
a_config.ItemList.selection && a_config.ItemList.selection.marquee) before
reading .enabled, then assign to this._marqueeController.enabled only when that
value is defined; reference the a_config.ItemList.selection.marquee.enabled
lookup and the this._marqueeController.enabled assignment when making the
change.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: fcd1d5e8-5e22-4ab0-9dac-a570ba981c0d
📒 Files selected for processing (4)
source/actionscript/Common/skyui/components/list/MarqueeSelectionController.assource/actionscript/ItemMenus/InventoryMenu.assource/swf/inventorymenu.xmlsource/swfsources.cmake
Description
This PR introduces a Windows-style marquee selection system for inventory management, allowing users to select, deselect, and perform batch actions on multiple items simultaneously. A setting to enable/disable this function is provided.
This feature is enabled by default. If the setting isn't present in the configuration, it's disabled.
Currently only
InventoryMenuis supported.Key Features
Tasks
ContainerMenu.Summary by CodeRabbit
New Features
Bug Fixes