diff --git a/src/managers/DragDropManager.ts b/src/managers/DragDropManager.ts index 793e9f0..b0d82ae 100644 --- a/src/managers/DragDropManager.ts +++ b/src/managers/DragDropManager.ts @@ -102,7 +102,7 @@ export class DragDropManager { this.scrollContainer = document.querySelector('swp-scrollable-content') as HTMLElement; const calendarContainer = document.querySelector('swp-calendar-container'); - + if (calendarContainer) { calendarContainer.addEventListener('mouseleave', () => { if (this.draggedElement && this.isDragStarted) { @@ -183,16 +183,16 @@ export class DragDropManager { // Found an event - check if in resize zone first if (eventElement) { // Check if click is in bottom resize zone - const rect = eventElement.getBoundingClientRect(); - const mouseY = event.clientY; - const distanceFromBottom = rect.bottom - mouseY; - const resizeZoneHeight = 15; // Match ResizeHandleManager - - // If in resize zone, don't handle this - let ResizeHandleManager take over - if (distanceFromBottom >= 0 && distanceFromBottom <= resizeZoneHeight) { - return; // Exit early - this is a resize operation + if (eventElement.tagName === 'SWP-EVENT') { + const rect = eventElement.getBoundingClientRect(); + const mouseY = event.clientY; + const distanceFromBottom = rect.bottom - mouseY; + const resizeZoneHeight = 15; // Match ResizeHandleManager + // If in resize zone, don't handle this - let ResizeHandleManager take over + if (distanceFromBottom >= 0 && distanceFromBottom <= resizeZoneHeight) { + return; // Exit early - this is a resize operation + } } - // Normal drag - prepare for potential dragging this.draggedElement = eventElement; this.lastColumn = ColumnDetectionUtils.getColumnBounds(this.lastMousePosition) @@ -671,7 +671,7 @@ export class DragDropManager { // Check if mouse is still within the current hovered event const isStillInside = mouseX >= rect.left && mouseX <= rect.right && - mouseY >= rect.top && mouseY <= rect.bottom; + mouseY >= rect.top && mouseY <= rect.bottom; // If mouse left the event if (!isStillInside) { diff --git a/src/managers/ResizeHandleManager.ts b/src/managers/ResizeHandleManager.ts index 9fd66b6..6f12d75 100644 --- a/src/managers/ResizeHandleManager.ts +++ b/src/managers/ResizeHandleManager.ts @@ -208,7 +208,7 @@ export class ResizeHandleManager { const snapDistancePx = (this.snapIntervalMinutes / 60) * this.hourHeightPx; const currentHeight = this.resizingElement.offsetHeight; const snappedHeight = Math.round(currentHeight / snapDistancePx) * snapDistancePx; - const finalHeight = Math.max(30, snappedHeight); + const finalHeight = Math.max(30, snappedHeight) - 3; //a little gap, so it doesn't cover the horizontal time lines const swpEvent = this.resizingElement as any; if (swpEvent.updateHeight) {