Commit graph

400 commits

Author SHA1 Message Date
Janus C. H. Knudsen
78ad5d3bc0 Animates drag cancellation
Improves user experience by animating the dragged element back to its original position when the drag operation is cancelled due to the mouse leaving the grid container.
2025-10-13 22:41:20 +02:00
Janus C. H. Knudsen
1d04f0ce0a Improves drag and drop conversion behavior
Resets scroll state and stops edge scrolling when a drag event converts between all-day and timed events, preventing unexpected scrolling behavior during conversion.
2025-10-13 22:17:17 +02:00
Janus C. H. Knudsen
3fd42f1f9b Improves drag scroll compensation accuracy
Refactors drag scroll compensation to use a direct scroll delta instead of accumulating the scroll.

This improves accuracy and responsiveness during drag operations when the scrollable content is being scrolled. It now updates the target position immediately as the user scrolls.
2025-10-13 21:22:33 +02:00
Janus C. H. Knudsen
b0894629df wip 2025-10-13 21:02:09 +02:00
Janus C. H. Knudsen
9a7a90c124 Improves drag-and-drop scroll compensation.
Enhances drag-and-drop functionality by accurately compensating for scroll during drag operations.
This ensures the dragged element remains correctly positioned relative to the mouse,
even when the user scrolls the content during the drag.

It achieves this by:
- Tracking whether scrolling has occurred during a drag operation.
- Factoring scroll delta into target position calculation.
- Updating targetY/currentY instead of directly manipulating the clone's style.
2025-10-13 20:24:19 +02:00
Janus C. H. Knudsen
dbbd19de13 wip 2025-10-13 18:03:08 +02:00
Janus C. H. Knudsen
d259620371 Refactors edge scroll start detection
Improves edge scroll detection by listening for actual scroll events instead of relying on mouse position.

This change ensures that the 'edgescroll:started' event is only emitted when scrolling has actually begun, preventing false positives and improving the accuracy of scroll compensation. It also removes the unnecessary scroll listener from the DragDropManager, consolidating scroll handling in the EdgeScrollManager.
2025-10-13 17:49:19 +02:00
Janus C. H. Knudsen
faf8b50593 Improves drag and drop with edge scrolling
Enhances the drag and drop experience by integrating edge scrolling,
allowing users to scroll the calendar view while dragging events.

Fixes issues with event positioning during scrolling by compensating
for scroll changes during drag operations. Also, adds mock events
to data.
2025-10-13 17:20:17 +02:00
Janus C. H. Knudsen
a0344c6143 Improves drag event handling and scrolling
Refactors drag and drop event handling for smoother updates.

Tracks the current mouse position during drag operations to improve the accuracy of position updates.

Adjusts edge scrolling behavior.
2025-10-12 23:17:22 +02:00
Janus C. H. Knudsen
e620c919aa Improves drag and drop functionality
Refactors drag and drop to use the original element as the source and introduces edge scrolling.

This change aims to enhance the user experience during drag and drop operations by ensuring the correct element is used as the source, fixing issues, and by automatically scrolling the view when the dragged element reaches the edge of the scrollable area.
2025-10-12 22:00:02 +02:00
Janus C. H. Knudsen
8df1f6c4f1 Implements edge scrolling functionality
Adds edge scrolling to automatically scroll the calendar
when dragging an event near the edges of the view.

This improves the drag-and-drop experience by allowing users
to move events beyond the visible area.

Removes auto-scroll logic from the event renderer, centralizing
the scrolling behavior within the new edge scroll manager.
2025-10-12 09:21:32 +02:00
Janus C. H. Knudsen
40b19a092c Removes auto-scroll functionality.
Removes the auto-scroll feature from the drag and drop manager.

This simplifies the drag and drop interactions by removing the need to automatically scroll the content area during drag operations. The scroll container, related properties, and auto-scroll logic have been removed.

Also, the mouse enter logic was moved to handleEventMouseEnter function.
2025-10-11 09:54:20 +02:00
Janus C. H. Knudsen
42e28f46bc Refactors drag and drop manager for efficiency.
Streamlines drag and drop logic by removing unnecessary state variables
and simplifying column change handling, enhancing performance
and code maintainability.
2025-10-11 09:19:33 +02:00
Janus C. H. Knudsen
0764437642 Moves drag:move emission to animation loop
Ensures drag:move events are emitted during the animation loop
for smoother and more consistent updates during drag operations.
Removes redundant emission from the main drag handling logic.
2025-10-11 01:38:15 +02:00
Janus C. H. Knudsen
9b073a15b7 Refactors all-day event conversion to timed events
Streamlines the conversion of all-day events to timed events during drag and drop operations. This change improves the event rendering process by ensuring proper handling of element replacement and position updates.

Removes redundant code and simplifies the logic for updating the dragged clone.
2025-10-11 01:30:41 +02:00
Janus C. H. Knudsen
0a3d274164 Enables all-day event to timed event conversion
Implements drag-and-drop conversion from all-day events to timed events in day columns. This change introduces a new event type (`drag:mouseenter-column`) and delegates rendering logic to the `DateEventRenderer` to maintain architectural consistency.
2025-10-10 19:37:10 +02:00
Janus C. H. Knudsen
78ca23c07a Enables all-day event conversion on column hover
Allows users to convert all-day events to timed events by dragging them over a day column.

This implementation adds logic to the DragDropManager to detect when an all-day event is dragged over a column.
It then emits a new event, 'drag:mouseenter-column', carrying the event data and target column information.

The event rendering service handles this event.
2025-10-10 16:41:48 +02:00
Janus C. H. Knudsen
7a79297854 Improves calendar header spacing.
Adds padding to the calendar header for better visual appearance.
2025-10-10 00:06:31 +02:00
Janus C. H. Knudsen
8ca49037e9 Improves date header localization
Adds locale support to the date header renderer and date service.

This change ensures that the day names are displayed correctly based on the user's configured locale.

The date header now uses the configured locale to display the day name in the correct language.
The day name is now displayed in uppercase.

Additionally, styles the date header to highlight today's date.
2025-10-09 23:08:33 +02:00
Janus C. H. Knudsen
6f79954342 Improves event drag and drop highlighting
Enhances the visual feedback during and after event drag and drop operations in the calendar.

- Preserves the full opacity of the dragged event clone during the drag operation for better visibility.
- Applies a highlight class to the event after it's dropped to visually indicate the new location.
- Adds specific styling for the highlighted state based on event type.
2025-10-09 22:31:49 +02:00
Janus C. H. Knudsen
5d406201b8 Refactors drag and drop logic
Improves drag and drop initialization and handling by extracting methods for clarity.
This enhances code readability and maintainability.
2025-10-08 23:29:56 +02:00
Janus C. H. Knudsen
b6f2aba398 Merge branch 'wip-colors' 2025-10-08 23:07:12 +02:00
Janus C. H. Knudsen
03f9fa48d2 Adds shadow to stacked events
Improves the visual appearance of stacked events
by adding a subtle shadow effect, enhancing depth and
distinction between overlapping elements.
2025-10-08 22:57:02 +02:00
Janus C. H. Knudsen
ecb1729c28 Enhances event drag and resize functionality
Improves event dragging by tracking the source column and using the updated event data for re-rendering affected columns.

Also, enhances event resizing by updating the event data and re-rendering the column to recalculate stacking/grouping.

Uses snap interval as minimum duration when resizing.
2025-10-08 22:18:06 +02:00
Janus C. H. Knudsen
e83753a7d2 Improves event drag and drop
Enhances the event drag and drop functionality by setting the initial position of the dragged event to prevent it from jumping to the top of the column.
Also adjust event transition for a smoother user experience.
Removes unused resize logic.
2025-10-08 21:50:41 +02:00
Janus C. H. Knudsen
1e5b3166b2 Improves event resizing with smooth animation
Replaces the previous rough event resizing implementation with a smooth, animated approach.

Uses pointer events for accurate tracking and adds a visual resize handle
for better user interaction.
Also refactors drag and drop to exclude resize handle.
2025-10-08 21:43:02 +02:00
Janus C. H. Knudsen
ce0a9b19eb Improves drag and resize behavior
Prevents drag initiation when clicking on the resize handle of an event.
Reduces event height to prevent overlap with time gridlines.
2025-10-08 19:35:29 +02:00
Janus C. H. Knudsen
7a62ef7040 Snaps event resize to grid interval
Ensures that when resizing an event, the end time snaps
to the defined grid interval, providing a more consistent
user experience.
2025-10-08 19:05:09 +02:00
Janus C. H. Knudsen
75d03fe577 Improves drag and drop position calculation
Refines drag and drop functionality by calculating position relative to the column during drag and snapping to the grid on mouse up, resulting in more precise placement.

Addresses an issue where the dragged element's position was not correctly calculated relative to the target column.
2025-10-08 19:01:35 +02:00
Janus C. H. Knudsen
a8b9767524 Implements smooth drag animation
Implements a smooth drag animation for a more fluid user experience.

Instead of directly snapping to the mouse position, it interpolates
the position over time using `requestAnimationFrame`. This provides
a visually smoother movement during drag operations.
2025-10-08 18:30:03 +02:00
Janus C. H. Knudsen
3145752591 Improves event hover highlighting
Uses CSS classes for event hover highlighting,
instead of directly manipulating the background color.
This allows for more flexible and maintainable styling.

Re-enables resize handle manager.
Removes console logs.
2025-10-08 18:15:00 +02:00
Janus C. H. Knudsen
8b8a1e3127 wip, resize, debugging 2025-10-08 00:58:38 +02:00
Janus C. H. Knudsen
e2cf4d1e04 Improves click handling on calendar elements
Removes `pointer-events: none` from various calendar elements.
This ensures that the elements are correctly interactive,
allowing the user to click on them as intended.
2025-10-07 17:36:03 +02:00
Janus C. H. Knudsen
3982e2f25f Improves resize handle appearance
Enhances the visual design of the resize handle for calendar events, making it more prominent and user-friendly.

- Updates the handle's styling with a darker background, increased size, and refined shadow.
- Replaces grip dots with grip lines for a cleaner look.
2025-10-07 17:21:23 +02:00
Janus C. H. Knudsen
70dce9fd59 Improves event resize handle interaction
Enhances the resize handle indicator for calendar events by using cached event elements for efficiency.

This eliminates the need to constantly query the DOM, and only refreshes the cache on relevant event changes.

Additionally updates the resize indicator style for improved visual clarity and user experience.
2025-10-07 17:16:00 +02:00
Janus C. H. Knudsen
a9819a8bf1 Enables event resizing via drag handles
Adds a resize handle manager to handle mouse hover
effects on calendar events and display a resize indicator.

This allows users to visually identify and initiate
event resizing by hovering near the bottom edge of an event.
2025-10-06 23:38:01 +02:00
Janus C. H. Knudsen
7d7a8d9208 wip 2025-10-06 22:29:31 +02:00
Janus C. H. Knudsen
9981a5a5af Trying to adjust top for clear time lines 2025-10-06 22:06:00 +02:00
Janus C. H. Knudsen
e838719d46 Cleanup 2025-10-06 21:55:52 +02:00
Janus C. H. Knudsen
69495ce00f cleanup 2025-10-06 21:39:57 +02:00
Janus C. H. Knudsen
faa59f6a3c Improves event layout and stacking logic
Refactors the event layout and stacking logic based on review feedback.

This includes:
- Merging conflicting event groups to prevent inconsistencies.
- Implementing minimal stack level assignment using a min-heap.
- Consolidating styling and using DateService for drag operations.
- Adding reflow after drag and drop.
- Improving the column event filtering to include events overlapping midnight.
- Ensuring explicit sorting of events for grid layout.
2025-10-06 21:16:29 +02:00
Janus C. H. Knudsen
b590467f60 Improves event grid layout logic
Refines the event grid layout algorithm to more accurately
identify conflicting events for stacking within the grid.

Now uses an expanding search to find chains of conflicting events,
ensuring that all events that should be grouped together are
correctly identified.
2025-10-06 18:46:07 +02:00
Janus C. H. Knudsen
06356df2a3 Implements event layout coordinator
Introduces a coordinator to manage event layout calculations,
separating this logic from rendering.
It calculates stack levels and allocates event columns for
improved visual organization of calendar events.
2025-10-06 17:53:25 +02:00
Janus C. H. Knudsen
6b8c5d4673 Stacking and Sharecolumn WIP 2025-10-06 17:05:18 +02:00
Janus C. H. Knudsen
c788a1695e Extracts event layout calculations
Moves complex layout determination logic (grid grouping, stack levels, positioning) from `EventRenderer` to a new `EventLayoutCoordinator` class.

Delegates layout responsibilities to the coordinator, significantly simplifying the `EventRenderer`'s `renderColumnEvents` method. Refines `EventStackManager` by removing deprecated layout methods, consolidating its role to event grouping and core stack level management.

Improves modularity and separation of concerns within the rendering pipeline.
2025-10-06 00:24:13 +02:00
Janus C. H. Knudsen
2f58ceccd4 Implements advanced event stacking and grid layout
Introduces a 3-phase algorithm in `EventStackManager` for dynamic event positioning. Groups events by start time proximity to determine optimal layout.

Optimizes horizontal space by using side-by-side grid columns for simultaneous events and allowing non-overlapping events to share stack levels. Supports nested stacking for late-arriving events within grid columns.

Includes comprehensive documentation (`STACKING_CONCEPT.md`) and a visual demonstration (`stacking-visualization.html`) to explain the new layout logic. Updates event rendering to utilize the new manager and adds extensive test coverage.
2025-10-05 23:54:50 +02:00
Janus C. H. Knudsen
57bf122675 Moves event positioning to renderer
Relocates event CSS positioning logic from the `SwpEventElement` to the `DateEventRenderer`. This improves separation of concerns, making the renderer responsible for event layout.
2025-10-05 21:53:25 +02:00
Janus C. H. Knudsen
5fae433afb Allows dynamic drag clone replacement
Introduces a polymorphic `createClone` method on base event elements to customize clone generation.
Adds a `replaceClone` delegate to drag event payloads, enabling subscribers to dynamically swap the active dragged clone.
This supports scenarios like converting a standard event clone to an all-day event clone when dragging to the all-day header.
2025-10-04 23:10:09 +02:00
Janus C. H. Knudsen
125cd678a3 Refactors drag header interaction logic
Improves efficiency and reliability of drag-and-drop operations involving calendar headers.

Transitions from continuous polling within `handleMouseMove` to using native `mouseenter` and `mouseleave` events with delegation on `swp-calendar-header` elements. This change ensures more precise and performant detection of header interactions during a drag.

Also enhances the initial event detection logic to correctly identify `SWP-ALLDAY-EVENT` elements when starting a drag.
2025-10-04 21:12:52 +02:00
Janus C. H. Knudsen
420036d939 wwip 2025-10-04 16:20:09 +02:00