@@ -80,6 +80,7 @@ export default class Preview extends PreviewCollection {
80
80
private resizeGhost : JQuery ;
81
81
private resizeLeftLastColumnShrunk : ContentTypeCollectionInterface < ColumnPreview > ;
82
82
private resizeRightLastColumnShrunk : ContentTypeCollectionInterface < ColumnPreview > ;
83
+ private columnLineBottomDropPlaceholder : JQuery ;
83
84
84
85
85
86
@@ -173,6 +174,15 @@ export default class Preview extends PreviewCollection {
173
174
this . dropPlaceholder = $ ( element ) ;
174
175
}
175
176
177
+ /**
178
+ * Init the drop placeholder
179
+ *
180
+ * @param {Element } element
181
+ */
182
+ public bindColumnLineBottomDropPlaceholder ( element : Element ) {
183
+ this . columnLineBottomDropPlaceholder = $ ( element ) ;
184
+ }
185
+
176
186
/**
177
187
* Init the drop placeholder
178
188
*
@@ -375,6 +385,8 @@ export default class Preview extends PreviewCollection {
375
385
this . dropPosition = null ;
376
386
this . dropPlaceholder . removeClass ( "left right" ) ;
377
387
this . columnLineDropPlaceholder . removeClass ( "active" ) ;
388
+ this . columnLineBottomDropPlaceholder . removeClass ( "active" ) ;
389
+ this . columnLineBottomDropPlaceholder . hide ( ) ;
378
390
this . columnLineDropPlaceholder . hide ( ) ;
379
391
//@todo combine active and show/hide functionality for columnLineDropPlaceholder
380
392
// this.movePlaceholder.css("left", "").removeClass("active");
@@ -413,6 +425,8 @@ export default class Preview extends PreviewCollection {
413
425
this . dropPosition = null ;
414
426
this . dropPlaceholder . removeClass ( "left right" ) ;
415
427
this . columnLineDropPlaceholder . removeClass ( "active" ) ;
428
+ this . columnLineBottomDropPlaceholder . removeClass ( "active" ) ;
429
+ this . columnLineBottomDropPlaceholder . hide ( ) ;
416
430
this . columnLineDropPlaceholder . hide ( ) ;
417
431
this . resizing ( false ) ;
418
432
this . resizeMouseDown = null ;
@@ -438,14 +452,18 @@ export default class Preview extends PreviewCollection {
438
452
439
453
let index = - 1 ;
440
454
let self = this ;
441
- if ( this . columnLineDropPlaceholder . hasClass ( 'active' ) ) {
455
+ if ( this . columnLineDropPlaceholder . hasClass ( 'active' ) || this . columnLineBottomDropPlaceholder . hasClass ( "active" ) ) {
442
456
443
457
for ( var child of this . contentType . parentContentType . children ( ) ) {
444
458
index ++ ;
445
459
if ( child . id == self . contentType . id ) {
446
460
break ;
447
461
}
448
462
}
463
+ if ( this . columnLineBottomDropPlaceholder . hasClass ( "active" ) ) {
464
+ //show the bottom drop placeholder
465
+ index ++ ;
466
+ }
449
467
createColumnLine (
450
468
this . contentType . parentContentType ,
451
469
this . resizeUtils . getSmallestColumnWidth ( ) ,
@@ -680,11 +698,37 @@ export default class Preview extends PreviewCollection {
680
698
*/
681
699
private isNewLinePlaceDropPlaceholderVisible ( event : JQueryEventObject , linePosition : LinePositionCache ) : boolean {
682
700
683
- return this . dropOverElement &&
701
+ const siblings = this . contentType . parentContentType . children ( ) ;
702
+ const id = this . contentType . id ;
703
+ let index = 0 ;
704
+ siblings . forEach ( columnLine => {
705
+ if ( columnLine . id == id ) {
706
+ return false ;
707
+ }
708
+ index ++ ;
709
+ } ) ;
710
+ //show column line drop placeholder only for top column line in a group
711
+
712
+ return index === 0 && this . dropOverElement &&
684
713
event . pageY > linePosition . top &&
685
714
event . pageY < linePosition . top + this . lineDropperHeight
686
715
}
687
716
717
+
718
+ /**
719
+ *
720
+ * @param event
721
+ * @param linePosition
722
+ * @private
723
+ */
724
+ private isNewLineBottomPlaceDropPlaceholderVisible ( event : JQueryEventObject , linePosition : LinePositionCache ) : boolean {
725
+
726
+ return this . dropOverElement &&
727
+ ( event . pageY < linePosition . top + this . element . outerHeight ( ) &&
728
+ event . pageY > linePosition . top + this . element . outerHeight ( ) - this . lineDropperHeight )
729
+
730
+ }
731
+
688
732
/**
689
733
*
690
734
* @param event
@@ -693,9 +737,9 @@ export default class Preview extends PreviewCollection {
693
737
*/
694
738
private isNewColumnDropPlaceholderVisible ( event : JQueryEventObject , linePosition : LinePositionCache ) : boolean {
695
739
696
- return this . dropOverElement &&
697
- event . pageY > linePosition . top + 50 &&
698
- event . pageY < linePosition . top + linePosition . outerHeight
740
+ return this . dropOverElement &&
741
+ event . pageY > linePosition . top + this . lineDropperHeight &&
742
+ event . pageY < linePosition . top + linePosition . outerHeight - this . lineDropperHeight ;
699
743
}
700
744
/**
701
745
* Handle mouse move events on when dropping elements
@@ -711,15 +755,27 @@ export default class Preview extends PreviewCollection {
711
755
this . dropPosition = null ;
712
756
this . dropPlaceholder . removeClass ( "left right" ) ;
713
757
this . columnLineDropPlaceholder . addClass ( "active" ) ;
758
+ this . columnLineDropPlaceholder . show ( ) ;
714
759
return this . handleLineDropMouseMove ( event , line , linePosition ) ;
715
- } else if ( this . dropOverElement ) {
760
+ } else if ( this . isNewLineBottomPlaceDropPlaceholderVisible ( event , linePosition ) ) {
761
+ this . dropPosition = null ;
762
+ this . dropPlaceholder . removeClass ( "left right" ) ;
763
+ this . columnLineBottomDropPlaceholder . addClass ( "active" ) ;
764
+ this . columnLineBottomDropPlaceholder . show ( ) ;
765
+ return this . handleLineDropMouseMove ( event , line , linePosition ) ;
766
+ }
767
+ else if ( this . dropOverElement ) {
716
768
this . columnLineDropPlaceholder . hide ( ) ;
769
+ this . columnLineBottomDropPlaceholder . hide ( ) ;
770
+ this . columnLineBottomDropPlaceholder . removeClass ( "active" ) ;
717
771
this . columnLineDropPlaceholder . removeClass ( "active" ) ;
718
772
719
773
}
720
774
if ( this . isNewColumnDropPlaceholderVisible ( event , linePosition ) ) {
721
775
this . columnLineDropPlaceholder . hide ( ) ;
722
776
this . columnLineDropPlaceholder . removeClass ( "active" ) ;
777
+ this . columnLineBottomDropPlaceholder . hide ( ) ;
778
+ this . columnLineBottomDropPlaceholder . removeClass ( "active" ) ;
723
779
return this . handleColumnDropMouseMove ( event , line , linePosition ) ;
724
780
}
725
781
}
@@ -739,8 +795,6 @@ export default class Preview extends PreviewCollection {
739
795
if ( elementChildrenParent . data ( "ui-sortable" ) ) {
740
796
elementChildrenParent . sortable ( "option" , "disabled" , true ) ;
741
797
}
742
-
743
- this . columnLineDropPlaceholder . show ( ) ;
744
798
}
745
799
746
800
/**
0 commit comments