Skip to content

Commit

Permalink
BuildVu 2021.12 (1.14.0)
Browse files Browse the repository at this point in the history
  • Loading branch information
leonatherton committed Dec 14, 2021
1 parent 0447da2 commit c06d7ab
Show file tree
Hide file tree
Showing 8 changed files with 67 additions and 18 deletions.
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "idrviewer",
"version": "1.13.0",
"version": "1.14.0",
"description": "The IDRViewer is a viewer designed for documents converted using BuildVu",
"keywords": [
"idrsolutions",
Expand Down
3 changes: 3 additions & 0 deletions src/examples/complete/changelog.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
Complete UI Changelog
---------------------

2.3.0 (14 Dec 2021)
- Improved the print behavior (now prints the loaded pages)

2.2.0 (02 Nov 2021)
- Updated thumbnail sidebar to support loading from external URL
- Added keyboard and mouse wheel shortcuts for zoom
Expand Down
9 changes: 8 additions & 1 deletion src/examples/complete/index.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!DOCTYPE html>
<html lang="en">
<head>
<!-- v2.2.0 -->
<!-- v2.3.0 -->
<meta http-equiv="X-UA-Compatible" content="IE=Edge" />
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
Expand Down Expand Up @@ -1120,6 +1120,13 @@
background-color: #ddd;
}

/* Print styles */
@media print {
#controls { display: none; }
#idrviewer { overflow: visible; }
.page { box-shadow: none; }
.page:not([data-state="loaded"]) { display: none; }
}
</style>
</head>
<body class="light-theme">
Expand Down
6 changes: 6 additions & 0 deletions src/js/changelog.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
IDRViewer Changelog
-------------------

1.14.0 (14 Dec 2021)
- Add support for the Sound annotation subtype
- Tweak the implementation of annotations that play sounds to allow the sound to be paused
- Fix bug in magazine layout where annotations could be incorrectly visible in the space opposite to the first page and the last page in documents with an even page count
- Improve the print behavior in the Complete UI (now prints the loaded pages)

1.13.0 (02 Nov 2021)
- Add console message when loading from the file: protocol to explain that search/annotations functionality will not be available and that HTML pages will fallback to displaying in iframes as browsers do not support AJAX over the file: protocol
- Update idrviewer.annotations.js and idrviewer.search.js to support loading from external url
Expand Down
57 changes: 44 additions & 13 deletions src/js/idrviewer.annotations.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* v1.4.0 */
/* v1.5.0 */
(function() {
"use strict";

Expand Down Expand Up @@ -28,7 +28,7 @@

var annotationsContainer = document.createElement("div");
annotationsContainer.className = "page-inner";
annotationsContainer.setAttribute("style", "position: absolute; visibility: hidden;");
annotationsContainer.setAttribute("style", "position: absolute; pointer-events: none;");
annotationsContainer.style.width = pageContainer.style.width;
annotationsContainer.style.height = pageContainer.style.height;
pageContainer.appendChild(annotationsContainer);
Expand Down Expand Up @@ -139,9 +139,29 @@
return ActionHandler;
})();

var SoundHelper = (function() {
var currentSound,
currentRef;

return {
play: function(src, ref) {
// HTMLAudioElement is not supported in any version of IE
var isPlaying = currentSound && !currentSound.ended && !currentSound.paused;
if (isPlaying) {
currentSound.pause();
if (ref === currentRef) {
return;
}
}
currentRef = ref;
currentSound = new Audio(src);
currentSound.play();
}
};
})();

(function() {
var LinkActionHandler = {},
currentSound;
var LinkActionHandler = {};

var pageCount;
IDRViewer.on("ready", function(data) {
Expand Down Expand Up @@ -187,12 +207,7 @@
}
break;
case "Sound":
// HTMLAudioElement is not supported in any version of IE
if (currentSound) {
currentSound.pause();
}
currentSound = new Audio((config.url || "") + data.action.sound);
currentSound.play();
SoundHelper.play((config.url || "") + data.action.sound, data.objref);
break;
case "Launch":
if (config.enableLaunchActions) {
Expand All @@ -207,6 +222,22 @@
ActionHandler.register(["Link", "Widget", "TextLink"], ["click", "mouseover"], LinkActionHandler);
})();

(function() {
var SoundHandler = {};

SoundHandler.onmouseover = function() {
this.style.cursor = "pointer";
};

SoundHandler.onclick = function(data, config) {
if (data.sound) {
SoundHelper.play((config.url || "") + data.sound, data.objref);
}
};

ActionHandler.register(["Sound"], ["click", "mouseover"], SoundHandler);
})();

(function() {
var FileAttachmentHandler = {};

Expand Down Expand Up @@ -314,7 +345,7 @@
if (data.richmedia.length) {
var isVideo = data.richmedia[0].type.startsWith("video");
var newElement = document.createElement(isVideo ? "video" : "audio");
newElement.setAttribute("style", "position: absolute; object-fit: fill; visibility: visible;");
newElement.setAttribute("style", "position: absolute; object-fit: fill; pointer-events: auto;");
newElement.setAttribute("controls", "controls");
newElement.style.left = data.bounds[0] + "px";
newElement.style.top = data.bounds[1] + "px";
Expand Down Expand Up @@ -346,7 +377,7 @@
ScreenHandler.onclick = function(data, config) {
if (data.action) {
var newElement = document.createElement(data.action.media.type.substr(0, 5)); // 5 = length of "audio" or "video"
newElement.setAttribute("style", "position: absolute; visibility: visible;");
newElement.setAttribute("style", "position: absolute; pointer-events: auto;");
newElement.setAttribute("controls", "controls");
newElement.style.left = data.bounds[0] + "px";
newElement.style.top = data.bounds[1] + "px";
Expand Down Expand Up @@ -377,7 +408,7 @@
(function() {
var createAnnotation = function(container, data, config) {
var annotation = document.createElement("div");
annotation.setAttribute("style", "position: absolute; visibility: visible; -webkit-user-select: none;");
annotation.setAttribute("style", "position: absolute; pointer-events: auto; -webkit-user-select: none;");
annotation.style.left = data.bounds[0] + "px";
annotation.style.top = data.bounds[1] + "px";
annotation.style.width = data.bounds[2] + "px";
Expand Down
2 changes: 2 additions & 0 deletions src/js/idrviewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -333,12 +333,14 @@

for (var i = 1; i <= pgCount; i++) {
states[i] = PageStates.UNLOADED; // Initialise states to unloaded
pages[i].dataset.state = PageStates.UNLOADED;
}
};

var setState = function(page, state) {
updateStateCounts(states[page], state);
states[page] = state;
pages[page].dataset.state = state;
};

var updateStateCounts = function(before, after) {
Expand Down
Loading

0 comments on commit c06d7ab

Please sign in to comment.