[DE mobile] Correct offset
This commit is contained in:
parent
9d08c6bfcb
commit
ef7a42ec32
|
@ -61,10 +61,11 @@
|
||||||
.page.page-with-subnavbar {
|
.page.page-with-subnavbar {
|
||||||
.page-content {
|
.page-content {
|
||||||
--f7-page-subnavbar-offset: 0px;
|
--f7-page-subnavbar-offset: 0px;
|
||||||
|
padding-top: 0;
|
||||||
}
|
}
|
||||||
&.page-with-logo .page-content {
|
// &.page-with-logo .page-content {
|
||||||
--f7-page-subnavbar-offset: 26px;
|
// --f7-page-subnavbar-offset: 26px;
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
.popup, .popover, .sheet-modal {
|
.popup, .popover, .sheet-modal {
|
||||||
|
|
|
@ -49,8 +49,11 @@ const ToolbarController = inject('storeAppOptions', 'users', 'storeReview', 'sto
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const api = Common.EditorApi.get();
|
const api = Common.EditorApi.get();
|
||||||
|
const subnavbarHeight = document.querySelector('.subnavbar').clientHeight;
|
||||||
|
|
||||||
const onEngineCreated = api => {
|
const onEngineCreated = api => {
|
||||||
if(isViewer) {
|
if(isViewer) {
|
||||||
|
api.SetMobileTopOffset(subnavbarHeight, subnavbarHeight);
|
||||||
api.asc_registerCallback('onMobileScrollDelta', scrollHandler);
|
api.asc_registerCallback('onMobileScrollDelta', scrollHandler);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -64,7 +67,11 @@ const ToolbarController = inject('storeAppOptions', 'users', 'storeReview', 'sto
|
||||||
return () => {
|
return () => {
|
||||||
const api = Common.EditorApi.get();
|
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);
|
Common.Notifications.off('engineCreated', onEngineCreated);
|
||||||
}
|
}
|
||||||
}, [isViewer]);
|
}, [isViewer]);
|
||||||
|
@ -73,18 +80,18 @@ const ToolbarController = inject('storeAppOptions', 'users', 'storeReview', 'sto
|
||||||
|
|
||||||
const scrollHandler = offset => {
|
const scrollHandler = offset => {
|
||||||
const api = Common.EditorApi.get();
|
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 subnavbarHeight = document.querySelector('.subnavbar').clientHeight;
|
||||||
const navbarHeight = navbarBgHeight + subnavbarHeight;
|
// const navbarHeight = navbarBgHeight + subnavbarHeight;
|
||||||
|
|
||||||
if(offset > navbarHeight) {
|
if(offset > subnavbarHeight) {
|
||||||
f7.navbar.hide('.main-navbar');
|
f7.navbar.hide('.main-navbar');
|
||||||
props.closeOptions('fab');
|
props.closeOptions('fab');
|
||||||
api.SetMobileTopOffset(undefined, 0);
|
api.SetMobileTopOffset(undefined, 0);
|
||||||
} else if(offset < -navbarHeight) {
|
} else if(offset < -subnavbarHeight) {
|
||||||
f7.navbar.show('.main-navbar');
|
f7.navbar.show('.main-navbar');
|
||||||
props.openOptions('fab');
|
props.openOptions('fab');
|
||||||
api.SetMobileTopOffset(undefined, navbarHeight);
|
api.SetMobileTopOffset(undefined, subnavbarHeight);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue