-
@@ -181,6 +245,7 @@ onUnmounted(() => {
.target-box {
position: absolute;
+ transform-origin: 50% 50%;
user-select: none;
-webkit-user-drag: none;
}
diff --git a/docs/.vitepress/src/layouts/LayoutDoc.vue b/docs/.vitepress/src/layouts/LayoutDoc.vue
index f45b84c06466e65676b8296c54d7efba35381947..66526d81345e68907debb8598c68e89dc10760ab 100644
--- a/docs/.vitepress/src/layouts/LayoutDoc.vue
+++ b/docs/.vitepress/src/layouts/LayoutDoc.vue
@@ -50,7 +50,7 @@ import { scrollIntoView } from '@/utils/scroll-to';
import { useDebounceFn } from '@vueuse/core';
const { hash } = useData();
-const { lePad, isPhone, gtPadV, size } = useScreen();
+const { lePad, isPhone, gtPadV, size, gtLaptop } = useScreen();
const route = useRoute();
const router = useRouter();
const { t, locale } = useLocale();
@@ -420,14 +420,16 @@ const zoomVisible = ref(false);
const zoomWidth = ref(0);
const zoomHeight = ref(0);
+const zoom = ref
(0);
+
const bindImageZoom = (img: HTMLImageElement) => {
if (img.naturalWidth < 200) {
img.parentElement?.classList.add('img-expand-not');
} else {
const btn = img.parentElement?.querySelector('.img-mask');
btn?.addEventListener('click', () => {
- zoomWidth.value = img.naturalWidth;
- zoomHeight.value = img.naturalHeight;
+ zoomWidth.value = img.offsetWidth;
+ zoomHeight.value = img.offsetHeight;
imgUrl.value = img.src;
zoomVisible.value = true;
@@ -436,6 +438,7 @@ const bindImageZoom = (img: HTMLImageElement) => {
};
const imgInit = () => {
+ zoom.value = gtLaptop.value ? 1.5 : 1.1;
const imgDom = document.querySelectorAll('.markdown-body img');
imgDom.forEach((img) => {
if (img.naturalWidth === 0 || img.naturalHeight === 0) {
@@ -615,7 +618,7 @@ const readyVisible = ref(false);