Commit 8e872566 authored by shiyunjie's avatar shiyunjie

update viewer

parent bd2e49ca
# pdf-html
### 简介
引用pdf.js iframe方式浏览pdf文件,支持手势缩放,滚动页数
引用pdf.js 浏览pdf文件,支持手势缩放,滚动页数
### 使用
部署后直接访问iframe.html
部署后直接访问web/viewer.html
```js
https://oest.aia.com.cn/oap/es/com/pdf/iframe.html?https://oest.aia.com.cn/oap/es/com/test/test.pdf
https://oest.aia.com.cn/oap/es/com/pdf/web/viewer.html?file=https://oest.aia.com.cn/oap/es/com/test/test.pdf
```
......@@ -411,8 +411,8 @@ html {
body {
height: 100%;
width: 100%;
background-color: #404040;
background-image: url(images/texture.png);
background-color: #cccccc;
/*background-image: url(images/texture.png);*/
}
body,
......
......@@ -106,7 +106,12 @@ See https://github.com/adobe-type-tools/cmap-resources
const reset = () => { startX = startY = initialPinchDistance = 0; pinchScale = 1; };
// Prevent native iOS page zoom
document.addEventListener("touchmove", (e) => { if (e.scale !== 1 && isiOSXZ ) { e.preventDefault(); } }, { passive: false });
document.addEventListener("touchmove", (e) => {
if (e.scale !== 1 && isiOSXZ ) {
e.preventDefault();
}
}, { passive: false });
viewer.addEventListener("touchstart", (e) => {
e.preventDefault();
......@@ -120,8 +125,11 @@ See https://github.com/adobe-type-tools/cmap-resources
});
viewer.addEventListener("touchmove", (e) => {
if (initialPinchDistance <= 0 || e.touches.length < 2) { return; }
console.log('viewer_touchmove')
if (initialPinchDistance <= 0 || e.touches.length < 2) {
return;
}
console.log('viewer_touchmove_do')
const pinchDistance = Math.hypot((e.touches[1].pageX - e.touches[0].pageX), (e.touches[1].pageY - e.touches[0].pageY));
const originX = startX + container.scrollLeft;
const originY = startY + container.scrollTop;
......@@ -148,7 +156,7 @@ See https://github.com/adobe-type-tools/cmap-resources
});
}
//if(!isWeixin){
/* if(!isWeixin){
document.addEventListener('webviewerloaded', () => {
console.log('webviewerloaded');
//console.log('webviewerloaded:pinchZoomEnabled', pinchZoomEnabled)
......@@ -157,10 +165,11 @@ See https://github.com/adobe-type-tools/cmap-resources
enablePinchZoom();
}
});
//}
}*/
</script>
<body tabindex="1" class="loadingInProgress">
<div id="outerContainer">
<div id="sidebarContainer">
......@@ -1046,5 +1055,10 @@ See https://github.com/adobe-type-tools/cmap-resources
</div>
<!-- outerContainer -->
<div id="printContainer"></div>
<script src="https://cdn.bootcss.com/vConsole/3.3.4/vconsole.min.js" ></script >
<script >
// 初始化
let vConsole = new VConsole();
</script >
</body>
</html>
......@@ -1793,7 +1793,7 @@ function webViewerInitialized() {
var file;
var queryString = document.location.search.substring(1);
var params = (0, _ui_utils.parseQueryString)(queryString);
file = 'file' in params ? params.file : _app_options.AppOptions.get('defaultUrl');
file = 'file' in params ? params.file : '';
validateFileURL(file);
var fileInput = document.createElement('input');
fileInput.id = appConfig.openFileInputName;
......@@ -1877,6 +1877,9 @@ var webViewerOpenFileViaURL;
{
webViewerOpenFileViaURL = function webViewerOpenFileViaURL(file) {
var sURL = window.sessionStorage.getItem('file') || file;
if(!sURL){
sURL = (0, _ui_utils.parseQueryString)('file');
}
if (file && file.lastIndexOf('file:', 0) === 0) {
PDFViewerApplication.setTitleUsingUrl(file);
console.log('XMLHttpRequest:',file.split('&'))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment