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

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

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