feat: add draggable mobile refresh button with improved UX

- Repositioned mobile refresh button to bottom-right (80px from bottom)
- Implemented full drag-to-reposition functionality
  * Touch and mouse support with 200ms/10px threshold
  * RequestAnimationFrame for smooth dragging
  * Position saved to extensionSettings.mobileRefreshPosition
  * Viewport constraints with 10px padding
- Fixed sticky tap highlight issue
  * Added -webkit-tap-highlight-color: transparent
  * Added blur() on click to remove focus
  * Set user-select: none and touch-action: none
- Show/hide based on panel state
  * Only visible when panel is expanded (rpg-mobile-open)
  * Listens to rpg-panel-toggled events
  * Auto-hides when panel closes
- Prevent accidental refresh after drag
  * just-dragged flag prevents click for 100ms
  * Click handler checks flag before executing
- Changed from absolute to fixed positioning for viewport-wide dragging
- Added mobileRefreshPosition to default settings (bottom: 80px, right: 20px)
- z-index: 99 (below FAB toggle at 100)
This commit is contained in:
Lucas 'Paperboy' Rose-Winters
2025-10-21 21:39:56 +11:00
parent dd392e50d1
commit e345715090
6 changed files with 279 additions and 11 deletions
+22 -9
View File
@@ -2708,13 +2708,13 @@ body:has(.rpg-panel.rpg-position-left) #sheld {
}
/* ============================================
REFRESH ICON BUTTON (Mobile - Floating)
REFRESH ICON BUTTON (Mobile - Floating & Draggable)
============================================ */
.rpg-refresh-icon-btn {
display: none; /* Hidden by default, shown on mobile */
position: absolute;
top: 10px;
right: 10px;
display: none; /* Hidden by default, shown on mobile when panel open */
position: fixed; /* Fixed for dragging anywhere on viewport */
bottom: 80px; /* Above FAB toggle, below screen edge */
right: 20px;
width: 44px; /* Touch-friendly size */
height: 44px;
padding: 0;
@@ -2723,12 +2723,19 @@ body:has(.rpg-panel.rpg-position-left) #sheld {
border-radius: 50%;
color: var(--rpg-text);
font-size: 1rem;
cursor: pointer;
transition: transform 0.2s ease, box-shadow 0.2s ease;
cursor: grab;
transition: transform 0.3s ease, box-shadow 0.3s ease, opacity 0.3s ease;
align-items: center;
justify-content: center;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
z-index: 100; /* Float above content */
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
z-index: 99; /* Below mobile FAB (100) but above content */
/* Fix sticky tap highlight */
-webkit-tap-highlight-color: transparent;
-webkit-touch-callout: none;
user-select: none;
-webkit-user-select: none;
touch-action: none;
}
/* Remove focus outline (prevents black state) */
@@ -2736,6 +2743,12 @@ body:has(.rpg-panel.rpg-position-left) #sheld {
outline: none;
}
/* Disable transitions while actively dragging */
.rpg-refresh-icon-btn.dragging {
transition: none;
cursor: grabbing;
}
.rpg-refresh-icon-btn:hover {
transform: scale(1.1);
box-shadow: 0 4px 12px var(--rpg-highlight);