Skip to content

NXL-18082357001 Preserve camera panning position in animator#188

Merged
elusiveuphoria merged 5 commits into
developmentfrom
feature/NXL-18082357001-Preserve-Camera-Panning
Jan 26, 2026
Merged

NXL-18082357001 Preserve camera panning position in animator#188
elusiveuphoria merged 5 commits into
developmentfrom
feature/NXL-18082357001-Preserve-Camera-Panning

Conversation

@Panguino

Copy link
Copy Markdown
Owner

Monday.com Item

Monday Item ID: NXL-18082357001

Description

Problem: When users panned the animator view without zooming and then navigated to a different data section, the panning position was not retained. The view would reset to center instead of maintaining the user's pan state.

Root Cause: The AnimatorImageSizer.tsx component had logic that only checked if scale === 1 to determine whether to use stored zoom state or apply manual centering. When this condition was true, it applied manual centering, effectively ignoring the stored positionX and positionY values. This meant pan-only movements (where scale === 1 but positionX !== 0 or positionY !== 0) were being ignored.

Solution: Modified the condition to check if the zoom state is truly at default (no zoom AND no pan) by verifying that scale === 1, positionX === 0, AND positionY === 0. Now the component correctly distinguishes between:

  • Default state (no interaction) → Apply manual centering
  • Zoomed state → Use stored position
  • Panned state (even without zoom) → Use stored position ✅ (NEW)

Technical Details:

  • Modified AnimatorImageSizer.tsx lines 85-102
  • The zoomState type already included positionX, positionY, and scale properties
  • All zustand slices already properly store these values
  • No changes needed to store slices or type definitions

How Has This Been Tested?

Manual Testing Required:

  1. Pan-Only Retention Test:

    • Navigate to Satellite Data section
    • Pan the view (click and drag) without zooming
    • Navigate to Forecast section
    • Return to Satellite Data
    • ✅ Verify pan position is retained
  2. Zoom-Only Retention Test:

    • Navigate to Satellite Data section
    • Zoom in without panning
    • Navigate to another section
    • Return to Satellite Data
    • ✅ Verify zoom level is retained (regression test)
  3. Combined Zoom and Pan Test:

    • Navigate to any data section
    • Both zoom and pan the view
    • Navigate away and return
    • ✅ Verify both states are retained
  4. Default State Test:

    • Navigate to a fresh data section
    • ✅ Verify view is centered by default
  5. Multiple Sections Test:

    • Test with Nexrad, Climate, Satrad, Hazards sections
    • ✅ Verify each section maintains independent zoom/pan state

Screenshots/GIF (if appropriate):

N/A - Behavioral fix, testing required to validate

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

- Modified AnimatorImageSizer logic to check both scale and position
- Now checks if positionX and positionY are at default (0, 0)
- Previously only checked scale === 1, ignoring pan-only movements
- This ensures pan state is retained when navigating between sections
@vercel

vercel Bot commented Jan 22, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
nex-lab-client Ready Ready Preview, Comment Jan 22, 2026 7:29pm

Request Review

- Panning retention now works correctly when navigating between sections
- Initial/fresh loads use manual centering to display centered image
- Default state (0,0,1) now properly detected and centered
- Added console logging for debugging state transitions
- Fixes issue where default state snapped to top-left corner
- Changed isAtDefault check to compare against manual center position
- Previously checked for (0,0) which falsely matched when panning to edges
- Now uses tolerance-based comparison with calculated center position
- Fixes issue where panning to left/top edge would incorrectly recenter
- Changed satradSlice default to null instead of {0,0,1}
- Updated Animator and AnimatorImageSizer to handle null state
- Simplified logic: null = first visit (center), non-null = use stored
- Still need to update other slices (forecast, nexrad, climate, etc.)
@github-actions

Copy link
Copy Markdown
Storybook Results 🎨
Build Results Build Link
Storybook Preview Preview Link
Component Count 53

@elusiveuphoria elusiveuphoria left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@Panguino Looks like it's working 👍 no more left edge nonsense.

@elusiveuphoria elusiveuphoria merged commit db86384 into development Jan 26, 2026
4 checks passed
@elusiveuphoria elusiveuphoria deleted the feature/NXL-18082357001-Preserve-Camera-Panning branch January 26, 2026 21:27
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