提交 cd5b7f87 authored 作者: gzcnkilys_admin's avatar gzcnkilys_admin

fix: 修复detail下BookReader被加载两次的问题,有两个footer。

进一步优化pdf文本的选中、可惜不同的pdf,可能展示不同。
上级 04646f87
......@@ -15,10 +15,11 @@
.textLayer {
position: absolute;
left: 0;
top: 0;
right: 0;
bottom: 0;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
right: auto;
bottom: auto;
overflow: hidden;
opacity: 0.2;
line-height: 1.0;
......@@ -313,7 +314,7 @@
direction: ltr;
width: 816px;
height: 1056px;
margin: 1px auto -8px auto;
/* margin: 1px auto -8px auto; */
position: relative;
overflow: visible;
border: 9px solid transparent;
......
......@@ -687,7 +687,7 @@ const initBook = async () => {
}
// 调试:检查页面状态
setTimeout(() => debugPageStatus(), 100);
// setTimeout(() => debugPageStatus(), 100);
}, 50);
// 播放声音
......@@ -857,6 +857,7 @@ const renderPdfPage = async (pageIndex) => {
pageContainer.innerHTML = '';
// 创建页面div元素
// todo 这里可能能够优化一下
const pageDiv = document.createElement('div');
pageDiv.className = 'pdf-page-container';
pageDiv.setAttribute('data-page-number', pageNum);
......@@ -902,8 +903,9 @@ const renderPdfPage = async (pageIndex) => {
console.log(`页面${pageNum}容器尺寸: ${containerWidth}x${containerHeight}`);
// 设置页面div的尺寸
pageDiv.style.width = `${containerWidth}px`;
pageDiv.style.height = `${containerHeight}px`;
// 这里可能能够优化
// pageDiv.style.width = `${containerWidth}px`;
// pageDiv.style.height = `${containerHeight}px`;
// 创建PDF页面视图
const rawPdfDocument = toRaw(pdfDocument.value);
......@@ -918,6 +920,10 @@ const renderPdfPage = async (pageIndex) => {
// 创建基于缩放比例的视口
const scaledViewport = pdfPage.getViewport({ scale: scale });
// 源码可以设置宽高,但是对文字层和page层还是不按照这个来。
// scaledViewport.width = containerWidth;
// scaledViewport.height = containerHeight;
console.log(`PDF原始尺寸: ${originalViewport.width}x${originalViewport.height}, 缩放比例: ${scale}, 缩放后尺寸: ${scaledViewport.width}x${scaledViewport.height}`);
// 创建PDFPageView实例
......
......@@ -13,7 +13,6 @@
:bookmarks="bookmarks"
:enableTextLayer="true"
/>
<BookReader :src="pdfUrl" />
</div>
</template>
<script setup>
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论