GithubHelp home page GithubHelp logo

Comments (1)

willshowell avatar willshowell commented on May 22, 2024

Glad to hear it's helping! Here's a demo of the issue (for my own reference later)

https://stackblitz.com/edit/sat-popover-issues-uwmunm?file=app%2Fapp.component.html

The cdk's positioning strategies have some planned upgrades, but who knows when they'll be available. Until then, I think this is something that can be fixed if we more intelligently configure fallback positions.

// Generate a position strategy with iterative fallback solutions
// 1 2 3
// ↖︎ => 4 5 6
// 7 8 9
return this._overlay.position()
// Original Y position (1)
.connectedTo(this._elementRef,
{originX: originX, originY: originY},
{overlayX: overlayX, overlayY: overlayY}
)
.withDirection(this._getDirection())
// (2)
.withFallbackPosition(
{originX: 'center', originY: originY},
{overlayX: 'center', overlayY: overlayY}
)
// (3)
.withFallbackPosition(
{originX: reverseHorizontal(originX), originY: originY},
{overlayX: reverseHorizontal(overlayX), overlayY: overlayY},
)
// Center Y position (4)
.withFallbackPosition(
{originX: originX, originY: 'center'},
{overlayX: overlayX, overlayY: 'center'}
)
// (5)
.withFallbackPosition(
{originX: 'center', originY: 'center'},
{overlayX: 'center', overlayY: 'center'}
)
// (6)
.withFallbackPosition(
{originX: reverseHorizontal(originX), originY: 'center'},
{overlayX: reverseHorizontal(overlayX), overlayY: 'center'},
)
// Reverse Y position (7)
.withFallbackPosition(
{originX: originX, originY: reverseVertical(originY)},
{overlayX: overlayX, overlayY: reverseVertical(overlayY)}
)
// (8)
.withFallbackPosition(
{originX: 'center', originY: reverseVertical(originY)},
{overlayX: 'center', overlayY: reverseVertical(overlayY)}
)
// (9)
.withFallbackPosition(
{originX: reverseHorizontal(originX), originY: reverseVertical(originY)},
{overlayX: reverseHorizontal(overlayX), overlayY: reverseVertical(overlayY)}
);

It works alright if you set the x and y positions somewhere other than center, but it doesn't do much if both x and y are 'center'.

from popover.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.