Enables all-day event to timed event conversion
Introduces the ability to convert all-day events to timed events by dragging them out of the header. Leverages a factory method to create timed events from all-day elements, ensuring proper data conversion and styling. Improves user experience by allowing more flexible event scheduling.
This commit is contained in:
parent
e9298934c6
commit
163314353b
3 changed files with 72 additions and 39 deletions
|
|
@ -123,25 +123,12 @@ export class DragDropManager {
|
|||
// Listen for header mouseleave events (for all-day to timed conversion when leaving header)
|
||||
this.eventBus.on('header:mouseleave', (event) => {
|
||||
// Check if we're dragging an all-day event
|
||||
if ((event as any).buttons === 1 && this.draggedEventId && this.isAllDayEventBeingDragged()) {
|
||||
// Get current mouse position to determine target column and Y
|
||||
const currentColumn = this.detectColumn(this.lastMousePosition.x, this.lastMousePosition.y);
|
||||
|
||||
if (currentColumn) {
|
||||
// Calculate Y position relative to the column
|
||||
const columnElement = this.getCachedColumnElement(currentColumn);
|
||||
if (columnElement) {
|
||||
const columnRect = columnElement.getBoundingClientRect();
|
||||
const targetY = this.lastMousePosition.y - columnRect.top - this.mouseOffset.y;
|
||||
|
||||
// Emit event to convert to timed
|
||||
this.eventBus.emit('drag:convert-to-timed', {
|
||||
eventId: this.draggedEventId,
|
||||
targetColumn: currentColumn,
|
||||
targetY: Math.max(0, targetY)
|
||||
});
|
||||
}
|
||||
}
|
||||
if (this.draggedEventId && this.isAllDayEventBeingDragged()) {
|
||||
// Convert all-day event to timed event using SwpEventElement factory
|
||||
this.eventBus.emit('drag:convert-allday-to-timed', {
|
||||
eventId: this.draggedEventId,
|
||||
originalElement: this.originalElement
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue