Skip to content

Instantly share code, notes, and snippets.

@tieppt
Created March 15, 2020 13:31
Show Gist options
  • Save tieppt/48c40199ebaf1ea573738b7d4cddc7fc to your computer and use it in GitHub Desktop.
Save tieppt/48c40199ebaf1ea573738b7d4cddc7fc to your computer and use it in GitHub Desktop.
import {ConnectionPositionPair} from '@angular/cdk/overlay';
export const POSITION_MAP: { [key: string]: ConnectionPositionPair } = {
top: new ConnectionPositionPair(
{ originX: 'center', originY: 'top' },
{ overlayX: 'center', overlayY: 'bottom' }
),
topCenter: new ConnectionPositionPair(
{ originX: 'center', originY: 'top' },
{ overlayX: 'center', overlayY: 'bottom' }
),
topLeft: new ConnectionPositionPair(
{ originX: 'start', originY: 'top' },
{ overlayX: 'start', overlayY: 'bottom' }
),
topRight: new ConnectionPositionPair(
{ originX: 'end', originY: 'top' },
{ overlayX: 'end', overlayY: 'bottom' }
),
right: new ConnectionPositionPair(
{ originX: 'end', originY: 'center' },
{ overlayX: 'start', overlayY: 'center' }
),
rightTop: new ConnectionPositionPair(
{ originX: 'end', originY: 'top' },
{ overlayX: 'start', overlayY: 'top' }
),
rightBottom: new ConnectionPositionPair(
{ originX: 'end', originY: 'bottom' },
{ overlayX: 'start', overlayY: 'bottom' }
),
bottom: new ConnectionPositionPair(
{ originX: 'center', originY: 'bottom' },
{ overlayX: 'center', overlayY: 'top' }
),
bottomCenter: new ConnectionPositionPair(
{ originX: 'center', originY: 'bottom' },
{ overlayX: 'center', overlayY: 'top' }
),
bottomLeft: new ConnectionPositionPair(
{ originX: 'start', originY: 'bottom' },
{ overlayX: 'start', overlayY: 'top' }
),
bottomRight: new ConnectionPositionPair(
{ originX: 'end', originY: 'bottom' },
{ overlayX: 'end', overlayY: 'top' }
),
left: new ConnectionPositionPair(
{ originX: 'start', originY: 'center' },
{ overlayX: 'end', overlayY: 'center' }
),
leftTop: new ConnectionPositionPair(
{ originX: 'start', originY: 'top' },
{ overlayX: 'end', overlayY: 'top' }
),
leftBottom: new ConnectionPositionPair(
{ originX: 'start', originY: 'bottom' },
{ overlayX: 'end', overlayY: 'bottom' }
)
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment