@@ -135,7 +135,6 @@ export default class IgcTileComponent extends EventEmitterMixin<
135135 private _position = - 1 ;
136136 private _resizeState = createTileResizeState ( ) ;
137137 private _dragStack = createTileDragStack ( ) ;
138- private _previousPointerPosition : { x : number ; y : number } | null = null ;
139138
140139 private _customAdorners = new Map < string , boolean > (
141140 Object . entries ( {
@@ -400,58 +399,20 @@ export default class IgcTileComponent extends EventEmitterMixin<
400399 return true ;
401400 }
402401
403- private _handleDragOver ( parameters : DragCallbackParameters ) : void {
404- const match = parameters . state . element as IgcTileComponent ;
402+ private _handleDragOver ( { event , state } : DragCallbackParameters ) : void {
403+ const match = state . element as IgcTileComponent ;
405404
406405 if ( this . _dragStack . peek ( ) === match ) {
407- const direction = parameters . state . pointerState . direction ;
408- const { clientX, clientY } = parameters . event ;
409- const { left, top, width, height } = match . getBoundingClientRect ( ) ;
410- const relativeX = ( clientX - left ) / width ;
411- const relativeY = ( clientY - top ) / height ;
412- const LTR = isLTR ( this ) ;
413-
414- let shouldSwap = false ;
415-
416- switch ( direction ) {
417- case 'start' :
418- shouldSwap =
419- this . position > match . position &&
420- ( LTR ? relativeX <= 0.25 : relativeX >= 0.75 ) ;
421- break ;
422-
423- case 'end' :
424- shouldSwap =
425- this . position < match . position &&
426- ( LTR ? relativeX >= 0.75 : relativeX <= 0.25 ) ;
427- break ;
428-
429- case 'top' :
430- shouldSwap = this . position > match . position && relativeY <= 0.25 ;
431- break ;
432-
433- case 'bottom' :
434- shouldSwap = this . position < match . position && relativeY >= 0.75 ;
435- break ;
436- }
437-
438- if ( shouldSwap ) {
406+ if ( this . _shouldSwap ( event , state , match ) ) {
439407 this . _dragStack . pop ( ) ;
440408 this . _dragStack . push ( match ) ;
441-
442- startViewTransition ( ( ) => {
443- swapTiles ( this , match ) ;
444- } ) ;
409+ this . _performSwap ( match ) ;
445410 }
446-
447411 return ;
448412 }
449413
450414 this . _dragStack . push ( match ) ;
451-
452- startViewTransition ( ( ) => {
453- swapTiles ( this , match ) ;
454- } ) ;
415+ this . _performSwap ( match ) ;
455416 }
456417
457418 private _handleDragCancel ( ) {
@@ -471,6 +432,42 @@ export default class IgcTileComponent extends EventEmitterMixin<
471432 this . emitEvent ( 'igcTileDragEnd' , { detail : this } ) ;
472433 }
473434
435+ private _performSwap ( match : IgcTileComponent ) : void {
436+ startViewTransition ( ( ) => swapTiles ( this , match ) ) ;
437+ }
438+
439+ private _shouldSwap (
440+ { clientX, clientY } : PointerEvent ,
441+ state : DragCallbackParameters [ 'state' ] ,
442+ match : IgcTileComponent
443+ ) : boolean {
444+ const LTR = isLTR ( this ) ;
445+ const direction = state . pointerState . direction ;
446+
447+ const { left, top, width, height } = match . getBoundingClientRect ( ) ;
448+ const relativeX = ( clientX - left ) / width ;
449+ const relativeY = ( clientY - top ) / height ;
450+
451+ switch ( direction ) {
452+ case 'start' :
453+ return (
454+ this . position > match . position &&
455+ ( LTR ? relativeX <= 0.25 : relativeX >= 0.75 )
456+ ) ;
457+ case 'end' :
458+ return (
459+ this . position < match . position &&
460+ ( LTR ? relativeX >= 0.75 : relativeX <= 0.25 )
461+ ) ;
462+ case 'top' :
463+ return this . position > match . position && relativeY <= 0.25 ;
464+ case 'bottom' :
465+ return this . position < match . position && relativeY >= 0.75 ;
466+ default :
467+ return false ;
468+ }
469+ }
470+
474471 private _skipDrag ( event : PointerEvent ) : boolean {
475472 if ( this . _maximized || this . fullscreen ) {
476473 return true ;
@@ -562,12 +559,18 @@ export default class IgcTileComponent extends EventEmitterMixin<
562559 this . _fullscreenController . setState ( ! this . fullscreen ) ;
563560 }
564561
565- private _handleMaximize ( ) {
562+ private async _handleMaximize ( ) {
566563 if ( ! this . _emitMaximizedEvent ( ) ) {
567564 return ;
568565 }
569566
570- this . maximized = ! this . maximized ;
567+ this . style . zIndex = '1' ;
568+
569+ await startViewTransition ( ( ) => {
570+ this . maximized = ! this . maximized ;
571+ } ) . transition ?. finished ;
572+
573+ this . style . zIndex = '' ;
571574 }
572575
573576 private _emitFullScreenEvent ( state : boolean ) {
0 commit comments