Add rotation support to ability widgets and improve error reporting#50
Add rotation support to ability widgets and improve error reporting#50SunkenInTime merged 2 commits intomainfrom
Conversation
SunkenInTime
commented
Mar 17, 2026
- Updated ResizableSquareAbility and related widgets to include rotation as a parameter, allowing for dynamic rotation of ability visuals.
- Enhanced error handling in PlacedImageProvider by integrating AppErrorReporter to log deletion errors for better debugging.
- Refactored widget structures in CenterSquareWidget and CustomSquareWidget to apply rotation transformations consistently.
- Cleaned up test cases for PlacedAbility to ensure proper initialization of position and rotation values.
- Updated ResizableSquareAbility and related widgets to include rotation as a parameter, allowing for dynamic rotation of ability visuals. - Enhanced error handling in PlacedImageProvider by integrating AppErrorReporter to log deletion errors for better debugging. - Refactored widget structures in CenterSquareWidget and CustomSquareWidget to apply rotation transformations consistently. - Cleaned up test cases for PlacedAbility to ensure proper initialization of position and rotation values.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Greptile SummaryThis PR adds counter-rotation support to ability icon widgets ( Key changes:
Issues found:
Confidence Score: 4/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant OV as PageTransitionOverlay
participant CA as CenterSquareAbility
participant SA as SquareAbility / ResizableSquareAbility
participant CSW as CenterSquareWidget
participant CUSW as CustomSquareWidget
participant RSW as ResizableSquareWidget
participant TR as Transform.rotate(angle: -rotation)
participant AW as AbilityWidget
OV->>CA: createWidget(rotation: rotation ?? w.rotation)
CA->>CSW: CenterSquareWidget(rotation: rotation)
CSW->>TR: angle = -(rotation ?? 0)
TR->>AW: render (icon stays upright)
OV->>SA: createWidget(rotation: rotation ?? w.rotation)
SA->>CUSW: CustomSquareWidget(rotation: rotation)
CUSW->>TR: angle = -(rotation ?? 0)
TR->>AW: render (icon stays upright)
OV->>SA: createWidget(rotation: rotation ?? w.rotation)
SA->>RSW: ResizableSquareWidget(rotation: rotation)
RSW->>TR: angle = -(rotation ?? 0)
TR->>AW: render (icon stays upright)
Last reviewed commit: 6f7ad53 |
There was a problem hiding this comment.
Pull request overview
Adds rotation-aware rendering for square-based ability widgets by counter-rotating the embedded AbilityWidget icon, and improves diagnostics when image cleanup fails.
Changes:
- Counter-rotate ability icons inside
CustomSquareWidget,CenterSquareWidget, andResizableSquareWidgetto keep icons upright when the parent widget is rotated. - Plumb rotation overrides through
PlacedWidgetPreview(notably forCenterSquareAbility) andResizableSquareAbility→ResizableSquareWidget. - Add widget tests covering icon counter-rotation behavior; minor test cleanups elsewhere.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| test/square_icon_counter_rotation_test.dart | New widget tests verifying square ability icon counter-rotation. |
| test/resizable_square_ability_test.dart | Minor cleanup: use const for initial positions. |
| test/placed_agent_node_serialization_test.dart | Remove unused import; format test description. |
| lib/widgets/page_transition_overlay.dart | Allow preview rotation override to flow into Square/CenterSquare ability widget creation. |
| lib/widgets/draggable_widgets/ability/resizable_square_widget.dart | Add optional rotation and counter-rotate the AbilityWidget icon. |
| lib/widgets/draggable_widgets/ability/custom_square_widget.dart | Counter-rotate the AbilityWidget icon using the widget’s rotation. |
| lib/widgets/draggable_widgets/ability/center_square_widget.dart | Counter-rotate the AbilityWidget icon using the widget’s rotation. |
| lib/providers/image_provider.dart | Report failures when deleting unused images via AppErrorReporter. |
| lib/const/abilities.dart | Pass rotation through ResizableSquareAbility.createWidget into ResizableSquareWidget. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
| await entity.delete(); | ||
| } catch (e) {} | ||
| } catch (e) { | ||
| AppErrorReporter.reportError( | ||
| 'Failed to delete unused image: $e', | ||
| error: e, | ||
| stackTrace: StackTrace.current, | ||
| ); |
There was a problem hiding this comment.
Lost exception stack trace with
StackTrace.current
catch (e) does not capture the original exception's stack trace, so StackTrace.current only records the call site inside the catch handler — not where entity.delete() actually threw. The real exception stack frames are permanently lost, making the logged trace far less useful for debugging.
The fix is to use the two-argument catch form:
| await entity.delete(); | |
| } catch (e) {} | |
| } catch (e) { | |
| AppErrorReporter.reportError( | |
| 'Failed to delete unused image: $e', | |
| error: e, | |
| stackTrace: StackTrace.current, | |
| ); | |
| } catch (e, stackTrace) { | |
| AppErrorReporter.reportError( | |
| 'Failed to delete unused image', | |
| error: e, | |
| stackTrace: stackTrace, | |
| ); |
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>