@@ -547,6 +547,28 @@ class DraggableBBox {
547
547
}
548
548
}
549
549
550
+ /**
551
+ * Check if the bounding box is smaller than the visible map area
552
+ * @returns {boolean } True if bbox is smaller than visible area in both dimensions
553
+ */
554
+ isBBoxSmallerThanVisibleArea ( ) {
555
+ if ( ! this . rectangle || ! this . map ) {
556
+ return false ;
557
+ }
558
+
559
+ const visibleBounds = this . map . getBounds ( ) ;
560
+ const bboxBounds = this . rectangle . getBounds ( ) ;
561
+
562
+ // Compare both width and height independently
563
+ const visibleHeight = visibleBounds . getNorth ( ) - visibleBounds . getSouth ( ) ;
564
+ const visibleWidth = visibleBounds . getEast ( ) - visibleBounds . getWest ( ) ;
565
+ const bboxHeight = bboxBounds . getNorth ( ) - bboxBounds . getSouth ( ) ;
566
+ const bboxWidth = bboxBounds . getEast ( ) - bboxBounds . getWest ( ) ;
567
+
568
+ // Return true only if bbox is smaller in both dimensions
569
+ return bboxHeight < visibleHeight && bboxWidth < visibleWidth ;
570
+ }
571
+
550
572
/**
551
573
* Unified handler for drag start events (mouse and touch)
552
574
* @param {L.LeafletMouseEvent|L.LeafletTouchEvent } e - The event
@@ -559,6 +581,12 @@ class DraggableBBox {
559
581
}
560
582
561
583
try {
584
+ // Check if bbox is smaller than visible area
585
+ if ( ! this . isBBoxSmallerThanVisibleArea ( ) ) {
586
+ // Allow event propagation to map if bbox is larger
587
+ return ;
588
+ }
589
+
562
590
// Prevent event propagation to avoid triggering radar marker events
563
591
if ( e . originalEvent ) {
564
592
e . originalEvent . stopPropagation ( ) ;
@@ -589,7 +617,7 @@ class DraggableBBox {
589
617
* @param {L.LeafletMouseEvent|L.LeafletTouchEvent } e - The event
590
618
*/
591
619
onDragMove ( e ) {
592
- if ( ! this . isDragging ) {
620
+ if ( ! this . isDragging || ! this . isBBoxSmallerThanVisibleArea ( ) ) {
593
621
return ;
594
622
}
595
623
@@ -637,7 +665,7 @@ class DraggableBBox {
637
665
* @param {L.LeafletMouseEvent|L.LeafletTouchEvent } e - The event
638
666
*/
639
667
onDragEnd ( e ) {
640
- if ( ! this . isDragging ) {
668
+ if ( ! this . isDragging || ! this . isBBoxSmallerThanVisibleArea ( ) ) {
641
669
return ;
642
670
}
643
671
0 commit comments