|
@@ -1,5 +1,15 @@
|
|
|
import React, { useEffect, useState } from "react";
|
|
|
|
|
|
+const isWeiXin = () => {
|
|
|
+ const ua = window.navigator.userAgent.toLowerCase();
|
|
|
+ // @ts-ignore
|
|
|
+ if (ua.match(/MicroMessenger/i) === 'micromessenger') {
|
|
|
+ return true;
|
|
|
+ } else {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
export const Page = (props: any) => {
|
|
|
const [zoom, setZoom] = useState(0.5);
|
|
|
const [scale, setScale] = useState("");
|
|
@@ -15,7 +25,11 @@ export const Page = (props: any) => {
|
|
|
if (width > height) {
|
|
|
setScale(`scale(1,${scale})`)
|
|
|
} else {
|
|
|
- setScale(`scale(${scale},1) rotate(90deg)`)
|
|
|
+ if (isWeiXin()) {
|
|
|
+ setScale(`scale(${scale},1) rotate(90deg)`)
|
|
|
+ } else {
|
|
|
+ setScale(`scale(${scale},${(1792 - 120)/1792}) rotate(90deg) translateX(${-60 * max * scale / 1792}px)`)
|
|
|
+ }
|
|
|
}
|
|
|
};
|
|
|
recalc()
|