Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: respect possibleAnchors order #11

Closed
rijk opened this issue Nov 2, 2019 · 4 comments
Closed

Feature request: respect possibleAnchors order #11

rijk opened this issue Nov 2, 2019 · 4 comments
Labels
enhancement New feature or request

Comments

@rijk
Copy link
Contributor

rijk commented Nov 2, 2019

Given the following config:

possibleAnchors: [
  anchor.RIGHT_CENTER,
  anchor.BOTTOM_CENTER,
  anchor.LEFT_CENTER,
  anchor.BOTTOM_LEFT,
  anchor.BOTTOM_RIGHT,
  anchor.TOP_CENTER,
]

I would expect this menu to be placed BOTTOM_CENTER:

image

And this one to be LEFT_CENTER:

image

Right now, it seems to pick somewhat randomly from the available options. Could this behaviour be changed so it picks the first available option?

@everweij
Copy link
Owner

everweij commented Nov 3, 2019

Hi Rijk,
Again, good question!
It's true that defining possibleAnchors has no effect on the anchor priority.
There is, however, some logic / rationale to which determines the anchor priority dynamically. This function looks at anchor (the 'preferred' anchor), preferX, preferY and possibleAnchors, and outputs a list of anchors sorted by priority. It than tries to find the first one that 'fits'.

This prioritising is currently implicit, which I think will work for many use-cases (together with preferX/Y). However, there may be use-cases where you want to prioritise the anchors explicitly.

How would you define such behavior? Right now, possibleAnchors just sets the available anchors. I don't think that this prop should do 2 things. Maybe an extra prop: anchorPriority? Or maybe a flag respectAnchorPriority that 'respects' / overrides the priority based on possibleAnchors? 😅

What do you think?

@rijk
Copy link
Contributor Author

rijk commented Nov 3, 2019

If you ask me, this is not important enough to add another property for. I thought it could 'just work' like this, and that would be pretty nice. In this case I wanted BOTTOM_LEFT/BOTTOM_RIGHT to be used only as a last resort. It seems preferX/preferY cannot really help here.

But yeah, it is not super important, and if there's other considerations here I understand.

@everweij
Copy link
Owner

everweij commented Nov 3, 2019

I do think your wish is legitimate, but as a consequence it add more complexity. Will keep this open for now and see if others are running into the same issue as well...

@everweij everweij added the enhancement New feature or request label Dec 3, 2019
@rijk
Copy link
Contributor Author

rijk commented Nov 26, 2020

I'll close this as it's not that important.

@rijk rijk closed this as completed Nov 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants