feat: add smooth animation to mobile FAB drag behavior
Improved the mobile floating action button (FAB) drag experience with smooth, performant animations: - Use requestAnimationFrame to throttle position updates during drag - Add will-change CSS property to optimize rendering performance - Add dragging class to disable transitions during active drag - Change cursor to grab/grabbing for better visual feedback - Remove janky direct CSS updates in favor of RAF-based updates Technical improvements: - Position updates now synced to display refresh rate (~60fps) - Prevents layout thrashing from excessive DOM manipulation - Smooth transition animations when drag ends Result: Dragging the FAB button now feels fluid and responsive on mobile devices instead of laggy and jumpy.
This commit is contained in:
@@ -2942,12 +2942,19 @@ body:has(.rpg-panel.rpg-position-left) #sheld {
|
||||
border: 2px solid var(--SmartThemeBorderColor);
|
||||
color: var(--rpg-text, #ecf0f1);
|
||||
font-size: 1.25rem;
|
||||
cursor: pointer;
|
||||
cursor: grab;
|
||||
z-index: 10002;
|
||||
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
|
||||
transition: opacity 0.3s ease, transform 0.2s ease;
|
||||
transition: opacity 0.3s ease, transform 0.2s ease, top 0.3s ease, left 0.3s ease, right 0.3s ease, bottom 0.3s ease;
|
||||
user-select: none; /* Prevent text selection while dragging */
|
||||
-webkit-user-select: none;
|
||||
will-change: top, left; /* Optimize for position changes */
|
||||
}
|
||||
|
||||
/* Disable transitions while actively dragging */
|
||||
.rpg-mobile-toggle.dragging {
|
||||
transition: none;
|
||||
cursor: grabbing;
|
||||
}
|
||||
|
||||
.rpg-mobile-toggle:hover {
|
||||
|
||||
Reference in New Issue
Block a user