[DE mobile] Correct offset

This commit is contained in:
SergeyEzhin 2022-12-08 18:49:35 +04:00
parent 9d08c6bfcb
commit ef7a42ec32
2 changed files with 17 additions and 9 deletions

View file

@ -61,10 +61,11 @@
.page.page-with-subnavbar {
.page-content {
--f7-page-subnavbar-offset: 0px;
padding-top: 0;
}
&.page-with-logo .page-content {
--f7-page-subnavbar-offset: 26px;
}
// &.page-with-logo .page-content {
// --f7-page-subnavbar-offset: 26px;
// }
}
.popup, .popover, .sheet-modal {

View file

@ -49,8 +49,11 @@ const ToolbarController = inject('storeAppOptions', 'users', 'storeReview', 'sto
useEffect(() => {
const api = Common.EditorApi.get();
const subnavbarHeight = document.querySelector('.subnavbar').clientHeight;
const onEngineCreated = api => {
if(isViewer) {
api.SetMobileTopOffset(subnavbarHeight, subnavbarHeight);
api.asc_registerCallback('onMobileScrollDelta', scrollHandler);
}
};
@ -64,7 +67,11 @@ const ToolbarController = inject('storeAppOptions', 'users', 'storeReview', 'sto
return () => {
const api = Common.EditorApi.get();
if (api) api.asc_unregisterCallback('onMobileScrollDelta', scrollHandler);
if (api) {
api.SetMobileTopOffset(subnavbarHeight, subnavbarHeight);
api.asc_unregisterCallback('onMobileScrollDelta', scrollHandler);
}
Common.Notifications.off('engineCreated', onEngineCreated);
}
}, [isViewer]);
@ -73,18 +80,18 @@ const ToolbarController = inject('storeAppOptions', 'users', 'storeReview', 'sto
const scrollHandler = offset => {
const api = Common.EditorApi.get();
const navbarBgHeight = document.querySelector('.navbar-bg').clientHeight;
// const navbarBgHeight = document.querySelector('.navbar-bg').clientHeight;
const subnavbarHeight = document.querySelector('.subnavbar').clientHeight;
const navbarHeight = navbarBgHeight + subnavbarHeight;
// const navbarHeight = navbarBgHeight + subnavbarHeight;
if(offset > navbarHeight) {
if(offset > subnavbarHeight) {
f7.navbar.hide('.main-navbar');
props.closeOptions('fab');
api.SetMobileTopOffset(undefined, 0);
} else if(offset < -navbarHeight) {
} else if(offset < -subnavbarHeight) {
f7.navbar.show('.main-navbar');
props.openOptions('fab');
api.SetMobileTopOffset(undefined, navbarHeight);
api.SetMobileTopOffset(undefined, subnavbarHeight);
}
}