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.
This commit is contained in:
parent
8b8a1e3127
commit
3145752591
4 changed files with 37 additions and 22 deletions
|
|
@ -73,10 +73,9 @@ export class ManagerFactory {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await managers.calendarManager.initialize?.();
|
await managers.calendarManager.initialize?.();
|
||||||
// ResizeHandleManager temporarily disabled for testing
|
if (managers.resizeHandleManager && managers.resizeHandleManager.initialize) {
|
||||||
// if (managers.resizeHandleManager && managers.resizeHandleManager.initialize) {
|
managers.resizeHandleManager.initialize();
|
||||||
// managers.resizeHandleManager.initialize();
|
}
|
||||||
// }
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
throw error;
|
throw error;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -119,13 +119,12 @@ export class DragDropManager {
|
||||||
if (eventElement && !this.isDragStarted && mouseEvent.buttons === 0) {
|
if (eventElement && !this.isDragStarted && mouseEvent.buttons === 0) {
|
||||||
// Clear any previous hover first
|
// Clear any previous hover first
|
||||||
if (this.currentHoveredEvent && this.currentHoveredEvent !== eventElement) {
|
if (this.currentHoveredEvent && this.currentHoveredEvent !== eventElement) {
|
||||||
this.currentHoveredEvent.style.backgroundColor = '';
|
this.currentHoveredEvent.classList.remove('hover');
|
||||||
}
|
}
|
||||||
|
|
||||||
this.isHoverTrackingActive = true;
|
this.isHoverTrackingActive = true;
|
||||||
this.currentHoveredEvent = eventElement;
|
this.currentHoveredEvent = eventElement;
|
||||||
eventElement.style.backgroundColor = 'red';
|
eventElement.classList.add('hover');
|
||||||
console.log('🎨 Mouse entered event:', eventElement.dataset.eventId, 'buttons:', mouseEvent.buttons, 'isDragStarted:', this.isDragStarted);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, true); // Use capture phase
|
}, true); // Use capture phase
|
||||||
|
|
@ -208,15 +207,6 @@ export class DragDropManager {
|
||||||
this.currentMouseY = event.clientY;
|
this.currentMouseY = event.clientY;
|
||||||
this.lastMousePosition = { x: event.clientX, y: event.clientY };
|
this.lastMousePosition = { x: event.clientX, y: event.clientY };
|
||||||
|
|
||||||
// Log which element we're over during drag
|
|
||||||
if (this.isDragStarted) {
|
|
||||||
const elementAtPoint = document.elementFromPoint(event.clientX, event.clientY);
|
|
||||||
const eventElement = elementAtPoint?.closest('swp-event');
|
|
||||||
if (eventElement) {
|
|
||||||
console.log('🖱️ Dragging over event:', (eventElement as HTMLElement).dataset.eventId);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check for event hover (coordinate-based) - only when mouse button is up
|
// Check for event hover (coordinate-based) - only when mouse button is up
|
||||||
if (this.isHoverTrackingActive && event.buttons === 0) {
|
if (this.isHoverTrackingActive && event.buttons === 0) {
|
||||||
this.checkEventHover(event);
|
this.checkEventHover(event);
|
||||||
|
|
@ -238,10 +228,8 @@ export class DragDropManager {
|
||||||
// Set high z-index on event-group if exists, otherwise on event itself
|
// Set high z-index on event-group if exists, otherwise on event itself
|
||||||
const eventGroup = this.draggedElement.closest<HTMLElement>('swp-event-group');
|
const eventGroup = this.draggedElement.closest<HTMLElement>('swp-event-group');
|
||||||
if (eventGroup) {
|
if (eventGroup) {
|
||||||
console.log('🔝 Setting z-index 9999 on event-group', eventGroup);
|
|
||||||
eventGroup.style.zIndex = '9999';
|
eventGroup.style.zIndex = '9999';
|
||||||
} else {
|
} else {
|
||||||
console.log('🔝 Setting z-index 9999 on event', this.draggedElement.dataset.eventId);
|
|
||||||
this.draggedElement.style.zIndex = '9999';
|
this.draggedElement.style.zIndex = '9999';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -615,7 +603,6 @@ export class DragDropManager {
|
||||||
if (!isStillInside) {
|
if (!isStillInside) {
|
||||||
// Only disable tracking and clear if mouse is NOT pressed (allow resize to work)
|
// Only disable tracking and clear if mouse is NOT pressed (allow resize to work)
|
||||||
if (event.buttons === 0) {
|
if (event.buttons === 0) {
|
||||||
console.log('🚪 Mouse left event:', this.currentHoveredEvent.dataset.eventId, 'clearing hover');
|
|
||||||
this.isHoverTrackingActive = false;
|
this.isHoverTrackingActive = false;
|
||||||
this.clearEventHover();
|
this.clearEventHover();
|
||||||
}
|
}
|
||||||
|
|
@ -624,9 +611,8 @@ export class DragDropManager {
|
||||||
|
|
||||||
private clearEventHover(): void {
|
private clearEventHover(): void {
|
||||||
if (this.currentHoveredEvent) {
|
if (this.currentHoveredEvent) {
|
||||||
this.currentHoveredEvent.style.backgroundColor = '';
|
this.currentHoveredEvent.classList.remove('hover');
|
||||||
this.currentHoveredEvent = null;
|
this.currentHoveredEvent = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -44,14 +44,19 @@
|
||||||
/* Event colors - Updated with month-view-expanded.html color scheme */
|
/* Event colors - Updated with month-view-expanded.html color scheme */
|
||||||
--color-event-meeting: #e8f5e8;
|
--color-event-meeting: #e8f5e8;
|
||||||
--color-event-meeting-border: #4caf50;
|
--color-event-meeting-border: #4caf50;
|
||||||
|
--color-event-meeting-hl: #c8e6c9;
|
||||||
--color-event-meal: #fff8e1;
|
--color-event-meal: #fff8e1;
|
||||||
--color-event-meal-border: #ff9800;
|
--color-event-meal-border: #ff9800;
|
||||||
|
--color-event-meal-hl: #ffe0b2;
|
||||||
--color-event-work: #fff8e1;
|
--color-event-work: #fff8e1;
|
||||||
--color-event-work-border: #ff9800;
|
--color-event-work-border: #ff9800;
|
||||||
|
--color-event-work-hl: #ffe0b2;
|
||||||
--color-event-milestone: #ffebee;
|
--color-event-milestone: #ffebee;
|
||||||
--color-event-milestone-border: #f44336;
|
--color-event-milestone-border: #f44336;
|
||||||
|
--color-event-milestone-hl: #ffcdd2;
|
||||||
--color-event-personal: #f3e5f5;
|
--color-event-personal: #f3e5f5;
|
||||||
--color-event-personal-border: #9c27b0;
|
--color-event-personal-border: #9c27b0;
|
||||||
|
--color-event-personal-hl: #e1bee7;
|
||||||
|
|
||||||
/* UI colors */
|
/* UI colors */
|
||||||
--color-background: #ffffff;
|
--color-background: #ffffff;
|
||||||
|
|
|
||||||
|
|
@ -60,7 +60,32 @@ swp-day-columns swp-event {
|
||||||
right: 2px;
|
right: 2px;
|
||||||
width: auto;
|
width: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Hover state - highlight colors */
|
||||||
|
&.hover[data-type="meeting"] {
|
||||||
|
background: var(--color-event-meeting-hl);
|
||||||
|
}
|
||||||
|
|
||||||
|
&.hover[data-type="meal"] {
|
||||||
|
background: var(--color-event-meal-hl);
|
||||||
|
}
|
||||||
|
|
||||||
|
&.hover[data-type="work"] {
|
||||||
|
background: var(--color-event-work-hl);
|
||||||
|
}
|
||||||
|
|
||||||
|
&.hover[data-type="milestone"] {
|
||||||
|
background: var(--color-event-milestone-hl);
|
||||||
|
}
|
||||||
|
|
||||||
|
&.hover[data-type="personal"] {
|
||||||
|
background: var(--color-event-personal-hl);
|
||||||
|
}
|
||||||
|
|
||||||
|
&.hover[data-type="deadline"] {
|
||||||
|
background: var(--color-event-milestone-hl);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
swp-day-columns swp-event:hover {
|
swp-day-columns swp-event:hover {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue