This commit is contained in:
parent
4ce17fb5f4
commit
6317a635f6
|
|
@ -30,7 +30,7 @@ ul, li {
|
||||||
|
|
||||||
.App-header {
|
.App-header {
|
||||||
background-color: #282c34;
|
background-color: #282c34;
|
||||||
min-height: 100vh;
|
min-height: calc(100vh / var(--zoom-compensation, 1));
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
|
@ -102,7 +102,7 @@ body {
|
||||||
.layout {
|
.layout {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
min-height: 100vh;
|
min-height: calc(100vh / var(--zoom-compensation, 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
.layout-header {
|
.layout-header {
|
||||||
|
|
@ -120,7 +120,7 @@ body {
|
||||||
|
|
||||||
.normal-p p {
|
.normal-p p {
|
||||||
font-weight: 400;
|
font-weight: 400;
|
||||||
font-size: 18px;
|
font-size: 1.125rem;
|
||||||
color: #222222;
|
color: #222222;
|
||||||
line-height: 34px;
|
line-height: 34px;
|
||||||
margin-bottom: 20px;
|
margin-bottom: 20px;
|
||||||
|
|
|
||||||
|
|
@ -8,12 +8,15 @@ import { useStore } from "@/store";
|
||||||
import { parsePageConfig } from "@/utils/parsePageConfig";
|
import { parsePageConfig } from "@/utils/parsePageConfig";
|
||||||
import type { I18nData, SupportLocale } from "@/type";
|
import type { I18nData, SupportLocale } from "@/type";
|
||||||
import { destroyLenis, initLenis } from "@/utils/lenis";
|
import { destroyLenis, initLenis } from "@/utils/lenis";
|
||||||
|
import useZoomCompensation from "@/hooks/useZoomCompensation";
|
||||||
|
|
||||||
// function AppRoutes() {
|
// function AppRoutes() {
|
||||||
// return useRoutes(routes);
|
// return useRoutes(routes);
|
||||||
// }
|
// }
|
||||||
|
|
||||||
function App() {
|
function App() {
|
||||||
|
useZoomCompensation();
|
||||||
|
|
||||||
const [init, setInit] = useState(false);
|
const [init, setInit] = useState(false);
|
||||||
const locale = useStore((s) => s.locale);
|
const locale = useStore((s) => s.locale);
|
||||||
const appConfig = useStore((s) => s.appConfig);
|
const appConfig = useStore((s) => s.appConfig);
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
/* Hero */
|
/* Hero */
|
||||||
.hero {
|
.hero {
|
||||||
position: relative;
|
position: relative;
|
||||||
min-height: 100vh;
|
min-height: calc(100vh / var(--zoom-compensation, 1));
|
||||||
background-size: cover;
|
background-size: cover;
|
||||||
background-position: center;
|
background-position: center;
|
||||||
padding-bottom: 3.125rem;
|
padding-bottom: 3.125rem;
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
.screenOpen {
|
.screenOpen {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100vh;
|
height: calc(100vh / var(--zoom-compensation, 1));
|
||||||
position: fixed;
|
position: fixed;
|
||||||
top: 0;
|
top: 0;
|
||||||
left: 0;
|
left: 0;
|
||||||
|
|
@ -21,7 +21,7 @@
|
||||||
|
|
||||||
.screenOpenBackground {
|
.screenOpenBackground {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100vh;
|
height: calc(100vh / var(--zoom-compensation, 1));
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 0;
|
top: 0;
|
||||||
left: 0;
|
left: 0;
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
/* height: 67.5rem; */
|
/* height: 67.5rem; */
|
||||||
height: 100vh;
|
height: calc(100vh / var(--zoom-compensation, 1));
|
||||||
padding: 6.25rem 0;
|
padding: 6.25rem 0;
|
||||||
background-size: cover;
|
background-size: cover;
|
||||||
background-position: center;
|
background-position: center;
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
.jobPage {
|
.jobPage {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
min-height: 100vh;
|
min-height: calc(100vh / var(--zoom-compensation, 1));
|
||||||
padding: 7.5rem 6.25rem;
|
padding: 7.5rem 6.25rem;
|
||||||
|
|
||||||
.jobPageHeaderLine {
|
.jobPageHeaderLine {
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
overflow-anchor: none;
|
overflow-anchor: none;
|
||||||
/* padding: 0 16.25rem; */
|
/* padding: 0 16.25rem; */
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100vh;
|
height: calc(100vh / var(--zoom-compensation, 1));
|
||||||
}
|
}
|
||||||
.rowAccordionBgContainer {
|
.rowAccordionBgContainer {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
.swiperCardSection {
|
.swiperCardSection {
|
||||||
min-height: 100vh;
|
min-height: calc(100vh / var(--zoom-compensation, 1));
|
||||||
padding: 6.25rem 16.25rem;
|
padding: 6.25rem 16.25rem;
|
||||||
background: #D8D8D8;
|
background: #D8D8D8;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
.topTabsSection {
|
.topTabsSection {
|
||||||
padding: 6.25rem 16.25rem 9.375rem 16.25rem;
|
padding: 6.25rem 16.25rem 9.375rem 16.25rem;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
min-height: 100vh;
|
min-height: calc(100vh / var(--zoom-compensation, 1));
|
||||||
background-size: cover;
|
background-size: cover;
|
||||||
background-position: center;
|
background-position: center;
|
||||||
background-repeat: repeat;
|
background-repeat: repeat;
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,54 @@
|
||||||
|
import { useEffect } from 'react';
|
||||||
|
|
||||||
|
const INITIAL_DPR = window.devicePixelRatio || 1;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 监听浏览器缩放(Ctrl+/Ctrl-),通过 CSS zoom 反向补偿,
|
||||||
|
* 使页面视觉比例始终保持与初始加载时一致。
|
||||||
|
*
|
||||||
|
* 原理:浏览器缩放会改变 window.devicePixelRatio,
|
||||||
|
* 据此计算补偿系数 1/(currentDPR/initialDPR) 设置到 html 元素上。
|
||||||
|
*/
|
||||||
|
export default function useZoomCompensation() {
|
||||||
|
useEffect(() => {
|
||||||
|
let cancelled = false;
|
||||||
|
|
||||||
|
function applyCompensation() {
|
||||||
|
const currentDPR = window.devicePixelRatio || 1;
|
||||||
|
const zoomFactor = currentDPR / INITIAL_DPR;
|
||||||
|
const html = document.documentElement;
|
||||||
|
const htmlStyle = html.style as CSSStyleDeclaration & { zoom: string };
|
||||||
|
const compensation = 1 / zoomFactor;
|
||||||
|
if (Math.abs(zoomFactor - 1) > 0.01) {
|
||||||
|
htmlStyle.zoom = `${compensation}`;
|
||||||
|
html.style.setProperty('--zoom-compensation', `${compensation}`);
|
||||||
|
} else {
|
||||||
|
htmlStyle.zoom = '';
|
||||||
|
html.style.setProperty('--zoom-compensation', '1');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function watchDPR() {
|
||||||
|
const mq = window.matchMedia(
|
||||||
|
`(resolution: ${window.devicePixelRatio}dppx)`,
|
||||||
|
);
|
||||||
|
mq.addEventListener(
|
||||||
|
'change',
|
||||||
|
() => {
|
||||||
|
if (cancelled) return;
|
||||||
|
applyCompensation();
|
||||||
|
watchDPR();
|
||||||
|
},
|
||||||
|
{ once: true },
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
applyCompensation();
|
||||||
|
watchDPR();
|
||||||
|
|
||||||
|
return () => {
|
||||||
|
cancelled = true;
|
||||||
|
(document.documentElement.style as CSSStyleDeclaration & { zoom: string }).zoom = '';
|
||||||
|
};
|
||||||
|
}, []);
|
||||||
|
}
|
||||||
|
|
@ -2,6 +2,7 @@
|
||||||
:root {
|
:root {
|
||||||
--design-rem-base: 16px;
|
--design-rem-base: 16px;
|
||||||
--ui-scale: 1;
|
--ui-scale: 1;
|
||||||
|
--zoom-compensation: 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
html {
|
html {
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
/* Section block - full-width with background */
|
/* Section block - full-width with background */
|
||||||
.section {
|
.section {
|
||||||
position: relative;
|
position: relative;
|
||||||
min-height: 100vh;
|
min-height: calc(100vh / var(--zoom-compensation, 1));
|
||||||
background-size: cover;
|
background-size: cover;
|
||||||
background-position: center;
|
background-position: center;
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
.section {
|
.section {
|
||||||
background: rgba(255, 255, 255, 0.6);
|
background: rgba(255, 255, 255, 0.6);
|
||||||
border-radius: 0;
|
border-radius: 0;
|
||||||
min-height: 100vh;
|
min-height: calc(100vh / var(--zoom-compensation, 1));
|
||||||
width: 100%;
|
width: 100%;
|
||||||
padding: 6.25rem 16.25rem;
|
padding: 6.25rem 16.25rem;
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|
@ -109,7 +109,7 @@
|
||||||
|
|
||||||
.sectionFounder {
|
.sectionFounder {
|
||||||
padding: 6.25rem 0 9.375rem;
|
padding: 6.25rem 0 9.375rem;
|
||||||
min-height: 100vh;
|
min-height: calc(100vh / var(--zoom-compensation, 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
.founderIntroduction h2 {
|
.founderIntroduction h2 {
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@
|
||||||
rgba(200, 200, 205, 0.3) .125rem,
|
rgba(200, 200, 205, 0.3) .125rem,
|
||||||
rgba(200, 200, 205, 0.3) .25rem
|
rgba(200, 200, 205, 0.3) .25rem
|
||||||
);
|
);
|
||||||
min-height: 100vh;
|
min-height: calc(100vh / var(--zoom-compensation, 1));
|
||||||
width: 100%;
|
width: 100%;
|
||||||
padding: 6.25rem auto;
|
padding: 6.25rem auto;
|
||||||
padding-bottom: 9.375rem;
|
padding-bottom: 9.375rem;
|
||||||
|
|
|
||||||
|
|
@ -134,7 +134,7 @@
|
||||||
/* Features Section */
|
/* Features Section */
|
||||||
.featuresHero {
|
.featuresHero {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100vh;
|
height: calc(100vh / var(--zoom-compensation, 1));
|
||||||
background-size: cover;
|
background-size: cover;
|
||||||
background-position: center;
|
background-position: center;
|
||||||
background-repeat: no-repeat;
|
background-repeat: no-repeat;
|
||||||
|
|
@ -223,7 +223,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.propertyServices {
|
.propertyServices {
|
||||||
height: 100vh;
|
height: calc(100vh / var(--zoom-compensation, 1));
|
||||||
color: #fff;
|
color: #fff;
|
||||||
padding: 0 16.25rem;
|
padding: 0 16.25rem;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -83,7 +83,7 @@
|
||||||
|
|
||||||
.industryFoster {
|
.industryFoster {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100vh;
|
height: calc(100vh / var(--zoom-compensation, 1));
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
position: relative;
|
position: relative;
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
/* Hero */
|
/* Hero */
|
||||||
.hero {
|
.hero {
|
||||||
position: relative;
|
position: relative;
|
||||||
min-height: 100vh;
|
min-height: calc(100vh / var(--zoom-compensation, 1));
|
||||||
background-size: cover;
|
background-size: cover;
|
||||||
background-position: center;
|
background-position: center;
|
||||||
}
|
}
|
||||||
|
|
@ -43,7 +43,7 @@
|
||||||
/* Commercial */
|
/* Commercial */
|
||||||
.commercial {
|
.commercial {
|
||||||
position: relative;
|
position: relative;
|
||||||
height: 100vh;
|
height: calc(100vh / var(--zoom-compensation, 1));
|
||||||
background-size: cover;
|
background-size: cover;
|
||||||
background-position: center;
|
background-position: center;
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue