- Fixed resize-header-window handler to properly center window without width increase - Fixed movement clamping logic to prevent progressive restriction - Added proper DPI handling to prevent pixelation - Added comprehensive debug logging for troubleshooting - Improved position tracking in animation system Addresses: - Unexpected width increase during long-press - Progressive restriction of downward movement - UI pixelation issues
4.1 KiB
Window Resize and Movement Issue Fix Test
Issues Fixed
1. Resizing Problem
Issue: When long-pressing on the application window, the width increases unexpectedly without user interaction to modify window dimensions.
Root Cause: The resize-header-window
handler was using incorrect calculation for centering the window after resize, which caused cumulative positioning errors.
Fix Applied:
- Improved the centering calculation to use the actual center point of the window
- Added bounds checking to prevent window from going off-screen
- Added safeguards to prevent resizing during animations or when already at target size
- Added debug logging to track resize operations
2. Movement Constraint Problem
Issue: With each click, the downward movement range of the window becomes progressively more restricted. The window's ability to move toward the bottom of the screen decreases with each interaction.
Root Cause: The movement clamping logic was applying restrictive bounds checking that accumulated over multiple moves, progressively limiting the available movement area.
Fix Applied:
- Replaced the restrictive
Math.max/Math.min
clamping with conditional clamping that only applies when actually needed - Improved the
moveStep
function to properly calculate bounds and only clamp when necessary - Fixed position tracking in the animation system to prevent drift
- Added debug logging to track movement behavior
3. Pixelation Issue
Issue: UI elements appear pixelated or blurry.
Fix Applied:
- Added proper DPI handling options in window creation
- Added
useContentSize: true
to ensure proper content sizing - Added
disableAutoHideCursor: true
to prevent cursor-related rendering issues - Added
experimentalFeatures: false
for stable rendering
Testing Instructions
Test 1: Resize Behavior
- Start the application
- Switch between different header states (API key input, main header, permission setup)
- Verify that the window resizes smoothly and maintains proper centering
- Check that window width doesn't increase unexpectedly during normal operations
- Try long-pressing on the window and verify no unexpected width changes occur
Test 2: Movement Behavior
- Start the application with main header visible
- Use keyboard shortcuts to move the window in all directions (up, down, left, right)
- Move the window multiple times in the same direction
- Verify that the movement range doesn't become progressively restricted
- Test moving to different screen edges and verify consistent behavior
- Try dragging the window and verify smooth movement without restrictions
Test 3: Pixelation
- Start the application
- Check that all UI elements are crisp and clear
- Try moving the window between different displays (if available)
- Verify that text and icons remain sharp
Debug Information
The following debug logs have been added to help track issues:
[WindowManager] Resize request: WIDTHxHEIGHT
- Tracks resize requests[WindowManager] Current bounds: WIDTHxHEIGHT at (X, Y)
- Shows current window bounds[WindowManager] Already at target size, skipping resize
- Prevents unnecessary operations[MovementManager] Moving DIRECTION from (X, Y)
- Tracks movement requests[MovementManager] Clamped Y to top/bottom edge
- Shows when clamping occurs[MovementManager] Final position: (X, Y), Work area: ...
- Shows final calculated position
Expected Behavior After Fix
- Window resizing should be smooth and maintain proper centering
- Window width should not increase unexpectedly during any operations
- Movement should be consistent with full range available at all times
- No progressive restriction of movement area should occur
- UI elements should appear crisp and clear without pixelation
- Debug logs should show proper bounds calculation and movement behavior
Files Modified
src/electron/windowManager.js
- Fixed resize-header-window handler and added debug loggingsrc/electron/smoothMovementManager.js
- Fixed moveStep function and animation position tracking
Branch
fix-window-resize-movement-issue
This fix addresses all three issues mentioned in the original GitHub issue #65.