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.
This commit is contained in:
parent
7a62ef7040
commit
ce0a9b19eb
2 changed files with 12 additions and 12 deletions
|
|
@ -183,16 +183,16 @@ export class DragDropManager {
|
||||||
// Found an event - check if in resize zone first
|
// Found an event - check if in resize zone first
|
||||||
if (eventElement) {
|
if (eventElement) {
|
||||||
// Check if click is in bottom resize zone
|
// Check if click is in bottom resize zone
|
||||||
|
if (eventElement.tagName === 'SWP-EVENT') {
|
||||||
const rect = eventElement.getBoundingClientRect();
|
const rect = eventElement.getBoundingClientRect();
|
||||||
const mouseY = event.clientY;
|
const mouseY = event.clientY;
|
||||||
const distanceFromBottom = rect.bottom - mouseY;
|
const distanceFromBottom = rect.bottom - mouseY;
|
||||||
const resizeZoneHeight = 15; // Match ResizeHandleManager
|
const resizeZoneHeight = 15; // Match ResizeHandleManager
|
||||||
|
|
||||||
// If in resize zone, don't handle this - let ResizeHandleManager take over
|
// If in resize zone, don't handle this - let ResizeHandleManager take over
|
||||||
if (distanceFromBottom >= 0 && distanceFromBottom <= resizeZoneHeight) {
|
if (distanceFromBottom >= 0 && distanceFromBottom <= resizeZoneHeight) {
|
||||||
return; // Exit early - this is a resize operation
|
return; // Exit early - this is a resize operation
|
||||||
}
|
}
|
||||||
|
}
|
||||||
// Normal drag - prepare for potential dragging
|
// Normal drag - prepare for potential dragging
|
||||||
this.draggedElement = eventElement;
|
this.draggedElement = eventElement;
|
||||||
this.lastColumn = ColumnDetectionUtils.getColumnBounds(this.lastMousePosition)
|
this.lastColumn = ColumnDetectionUtils.getColumnBounds(this.lastMousePosition)
|
||||||
|
|
|
||||||
|
|
@ -208,7 +208,7 @@ export class ResizeHandleManager {
|
||||||
const snapDistancePx = (this.snapIntervalMinutes / 60) * this.hourHeightPx;
|
const snapDistancePx = (this.snapIntervalMinutes / 60) * this.hourHeightPx;
|
||||||
const currentHeight = this.resizingElement.offsetHeight;
|
const currentHeight = this.resizingElement.offsetHeight;
|
||||||
const snappedHeight = Math.round(currentHeight / snapDistancePx) * snapDistancePx;
|
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;
|
const swpEvent = this.resizingElement as any;
|
||||||
if (swpEvent.updateHeight) {
|
if (swpEvent.updateHeight) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue