CaliCastle / PopMenu

A fully customizable popup style menu for iOS 😎
https://popmenu.cali.so
MIT License
1.62k stars 185 forks source link

Prevent menu from appearing offscreen #13

Closed woko666 closed 6 years ago

woko666 commented 6 years ago

Checklist

Motivation and Context

Currently the PopMenu can overflow offscreen - in calculateContentWidth() with a long text and on smaller screens (e.g. iPhone SE) the contentFitWidth can easily be larger than screen width. The menu can also overflow offscreen even when its width is not larger than screen width due to overflow checks missing in calculateContentOrigin()

Description

The end result is that the popup menu can't overflow, max width is 90% of screen width, and there is always a 5% space between the edge of the screen and the menu. This is kinda arbitrary due to the existing "90% of screen" constraint already present, the constants can be changed (e.g. 100% width, 0% on the sides...), made configurable or whatever.

CaliCastle commented 6 years ago

This is awesome, thanks for your contribution! I'll look into it later today

CaliCastle commented 6 years ago

Great job! Again, thank you for the contribution!!!