Daltron / NotificationBanner

The easiest way to display highly customizable in app notification banners in iOS
MIT License
4.78k stars 662 forks source link

iPad narrow context landscape mode renders full width #289

Closed SalsaShark closed 4 years ago

SalsaShark commented 4 years ago

On iPad when using a narrow context (side by side or popover) when in portrait, the banner renders correctly. When in landscape, it appears to always render full-width.

Edit: You can't necessarily see it in that screenshot, but if the landscape view is wider, it is clearly rendering all the contents, just for the full width.

Screenshot 2020-02-25 12 07 19 Screenshot 2020-02-25 12 07 09

SalsaShark commented 4 years ago

Found it. bannerWidth was using window.width, which in landscape view was actually the full width of the device in portrait, so effectively the height in landscape. Using window.frame.size.width seems to correct this.

    internal func updateBannerPositionFrames() {
        guard let window = appWindow else { return }
        bannerPositionFrame = BannerPositionFrame(bannerPosition: bannerPosition,
                                                  bannerWidth: window.frame.size.width,
                                                  bannerHeight: bannerHeight,
                                                  maxY: maximumYPosition(),
                                                  finishYOffset: finishBannerYOffset(),
                                                  edgeInsets: bannerEdgeInsets)
    }
stale[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] commented 4 years ago

This issue has been automatically closed due to inactivity.