Implement drag-to-create event functionality in week view

Add interactive drag-to-create event functionality that allows users to click and drag in empty spaces of the week view to create new events. Features include:

- Mouse event handlers for drag interaction (mousedown, mousemove, mouseup)
- Real-time temporary event box display with visual feedback during drag
- Proper coordinate calculation using layer_y() for accurate time positioning
- Minimum 15-minute event duration enforcement
- Integration with event creation modal via callback with pre-filled start/end times
- CSS pointer-events optimizations to prevent child element interference
- Time-to-pixel and pixel-to-time conversion functions for accurate positioning

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Connor Johnstone
2025-08-29 11:00:32 -04:00
parent a8bb2c8164
commit df714a43a2
2 changed files with 158 additions and 3 deletions

View File

@@ -582,11 +582,13 @@ body {
height: 60px;
border-bottom: 1px solid #f0f0f0;
position: relative;
pointer-events: none; /* Don't capture mouse events */
}
.time-slot-half {
height: 30px;
border-bottom: 1px dotted #f5f5f5;
pointer-events: none; /* Don't capture mouse events */
}
.time-slot-half:last-child {
@@ -597,6 +599,7 @@ body {
height: 60px; /* Match the final time label height */
border-bottom: 2px solid #e9ecef; /* Strong border to match final boundary */
background: rgba(0,0,0,0.02); /* Slightly different background to indicate boundary */
pointer-events: none; /* Don't capture mouse events */
}
/* Events Container */
@@ -606,7 +609,7 @@ body {
left: 0;
right: 0;
bottom: 0;
pointer-events: none;
pointer-events: none; /* Container doesn't capture, but children (events) do */
}
/* Week Events */
@@ -644,6 +647,27 @@ body {
border-color: #ff9800;
}
/* Temporary event box during drag creation */
.temp-event-box {
position: absolute;
left: 4px;
right: 4px;
background: rgba(59, 130, 246, 0.3);
border: 2px dashed rgba(59, 130, 246, 0.8);
border-radius: 4px;
color: rgba(59, 130, 246, 0.9);
font-size: 0.75rem;
font-weight: 600;
padding: 4px 6px;
display: flex;
align-items: center;
justify-content: center;
pointer-events: none;
z-index: 6; /* Higher than events */
text-align: center;
user-select: none;
}
.week-event .event-title {
font-weight: 600;
margin-bottom: 2px;