Charts: Apply iOS-related fixes only to iOS devices (#2717)

Improves the fixes from #2677, #2511, #2706 and #2710 to only apply to
iOS devices.
Avoids/Fixes regressions with other platforms such as
https://community.openhab.org/t/chart-scrollbar/157828.

Known issues:
- Charts display in popups on iPads are rendered to large.

Signed-off-by: Florian Hotze <florianh_dev@icloud.com>
pull/2719/head
Florian Hotze 2024-08-15 20:11:42 +02:00 committed by GitHub
parent 6f01001b05
commit 17c2119efb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 15 additions and 9 deletions

View File

@ -13,13 +13,18 @@
overflow hidden overflow hidden
top calc(var(--f7-safe-area-top) + var(--f7-navbar-height)) top calc(var(--f7-safe-area-top) + var(--f7-navbar-height))
width 100% width 100%
height calc(100dvh - var(--f7-safe-area-top) - var(--f7-navbar-height)) !important --oh-chart-page-height calc(100% - var(--f7-safe-area-top) - var(--f7-safe-area-bottom) - var(--f7-navbar-height))
height var(--oh-chart-page-height) !important
&.with-tabbar &.with-tabbar
height calc(100dvh - var(--f7-safe-area-top) - var(--f7-safe-area-bottom) - var(--f7-navbar-height) - var(--f7-tabbar-labels-height)) !important height calc(var(--oh-chart-page-height) - var(--f7-tabbar-labels-height)) !important
&.with-toolbar &.with-toolbar
height calc(100dvh - var(--f7-safe-area-top) - var(--f7-safe-area-bottom) - var(--f7-navbar-height) - var(--f7-toolbar-height)) !important height calc(var(--oh-chart-page-height) - var(--f7-toolbar-height)) !important
&.sheet-opened &.sheet-opened
height calc(100dvh - var(--f7-safe-area-top) - var(--f7-safe-area-bottom) - var(--f7-navbar-height) - var(--f7-sheet-height)) !important height calc(var(--oh-chart-page-height) - var(--f7-sheet-height)) !important
.device-ios /* fix chart rendering issues on iOS >= 17.4 */
.oh-chart-page-chart
--oh-chart-page-height calc(100dvh - var(--f7-safe-area-top) - var(--f7-safe-area-bottom) - var(--f7-navbar-height)) /* use dvh because with % the height is calculated to 0px and ECharts fails to render */
</style> </style>
<script> <script>
@ -39,10 +44,14 @@ export default {
} }
}, },
mounted () { mounted () {
window.addEventListener('orientationchange', this.onOrientationChange) if (this.$device.ios) {
window.addEventListener('orientationchange', this.onOrientationChange)
}
}, },
beforeUnmount () { beforeUnmount () {
window.removeEventListener('orientationchange', this.onOrientationChange) if (this.$device.ios) {
window.removeEventListener('orientationchange', this.onOrientationChange)
}
} }
} }
</script> </script>

View File

@ -235,9 +235,6 @@
--f7-theme-color-rgb var(--f7-color-blue-rgb) --f7-theme-color-rgb var(--f7-color-blue-rgb)
--f7-theme-color-tint var(--f7-color-blue-tint) --f7-theme-color-tint var(--f7-color-blue-tint)
z-index 11000 z-index 11000
.analyzer-content
.analyzer-chart
position fixed !important
.md .analyzer-controls .toolbar .link .md .analyzer-controls .toolbar .link
width 28% width 28%
</style> </style>