Commit 448b00fb by Lynette Lizardo

add zoom display

parent f92f3838
...@@ -407,6 +407,7 @@ export class ImageViewer { ...@@ -407,6 +407,7 @@ export class ImageViewer {
}); });
} }
container.style.zoom = scale; container.style.zoom = scale;
document.getElementById("zoomDetails").textContent = "Zoom: "+ Math.trunc(scale*100) +"%";
//container.style.transform = "scale(" + scale + ")"; //container.style.transform = "scale(" + scale + ")";
//container.style.transformOrigin = (scale * 100) + "% " + (scale * 100) + "%"; //container.style.transformOrigin = (scale * 100) + "% " + (scale * 100) + "%";
...@@ -425,12 +426,13 @@ export class ImageViewer { ...@@ -425,12 +426,13 @@ export class ImageViewer {
zoomOutBtn.setAttribute("id", "zoomOutBtn"); zoomOutBtn.setAttribute("id", "zoomOutBtn");
zoomOutBtn.setAttribute("title", "Zoom Out") zoomOutBtn.setAttribute("title", "Zoom Out")
zoomOutBtn.addEventListener('click', function () { zoomOutBtn.addEventListener('click', function () {
if (scale > 1) { if (scale > 0) {
scale -= 0.10; scale -= 0.10;
console.log(scale); console.log(scale);
} }
const container = document.getElementById(_this.currentImageID); const container = document.getElementById(_this.currentImageID);
container.style.zoom = scale; container.style.zoom = scale;
document.getElementById("zoomDetails").textContent = "Zoom: "+ Math.trunc(scale*100) +"%";
//container.style.transform = "scale(" + scale + ")"; //container.style.transform = "scale(" + scale + ")";
//container.style.transformOrigin = (scale * 100) + "% " + (scale * 100) + "%"; //container.style.transformOrigin = (scale * 100) + "% " + (scale * 100) + "%";
...@@ -488,9 +490,14 @@ export class ImageViewer { ...@@ -488,9 +490,14 @@ export class ImageViewer {
this.previousPageButton.setAttribute("id", "previousPageBtn"); this.previousPageButton.setAttribute("id", "previousPageBtn");
this.previousPageButton.setAttribute("class", "button image-btn-control"); this.previousPageButton.setAttribute("class", "button image-btn-control");
let zoomDetails = document.createElement("label");
zoomDetails.setAttribute("class", "label")
zoomDetails.setAttribute("id", "zoomDetails");
pagesDiv.appendChild(this.previousPageButton); pagesDiv.appendChild(this.previousPageButton);
pagesDiv.appendChild(pageDetails); pagesDiv.appendChild(pageDetails);
pagesDiv.appendChild(this.nextPageButton); pagesDiv.appendChild(this.nextPageButton);
pagesDiv.appendChild(zoomDetails);
let refreshDiv = document.createElement("div"); let refreshDiv = document.createElement("div");
refreshDiv.setAttribute("class", "row"); refreshDiv.setAttribute("class", "row");
......
...@@ -176,6 +176,7 @@ async function initializeImageDisplay() { ...@@ -176,6 +176,7 @@ async function initializeImageDisplay() {
document.getElementById("previousRecordImage").style.visibility = "hidden"; document.getElementById("previousRecordImage").style.visibility = "hidden";
} }
DISPLAY_FIELD_OBJECT.updateHeaderText(2, "Record 1 of " + urls.length); DISPLAY_FIELD_OBJECT.updateHeaderText(2, "Record 1 of " + urls.length);
document.getElementById("zoomDetails").textContent = "Zoom: 100%";
} }
async function createWebGdeInterface(GDEContainer) { async function createWebGdeInterface(GDEContainer) {
...@@ -347,7 +348,7 @@ async function createImageViewer() { ...@@ -347,7 +348,7 @@ async function createImageViewer() {
await IMAGE_VIEWER_OBJECT.createCurrentImage(filename.split(".").pop(), filename, imageBlob); await IMAGE_VIEWER_OBJECT.createCurrentImage(filename.split(".").pop(), filename, imageBlob);
} }
} }
document.getElementById("zoomDetails").textContent = "Zoom: 100%";
}); });
}; };
...@@ -363,6 +364,7 @@ async function displayPreviousRecord(e) { ...@@ -363,6 +364,7 @@ async function displayPreviousRecord(e) {
HIGHLIGHT_OBJECT.createHighlight(); HIGHLIGHT_OBJECT.createHighlight();
DISPLAY_FIELD_OBJECT.updateHeaderText(2, "Record "+ (current +1) +" of " + urls.length); DISPLAY_FIELD_OBJECT.updateHeaderText(2, "Record "+ (current +1) +" of " + urls.length);
document.getElementById("zoomDetails").textContent = "Zoom: 100%";
DISPLAY_FIELD_OBJECT.clearForm(); DISPLAY_FIELD_OBJECT.clearForm();
await populateFields(urls[current]); await populateFields(urls[current]);
...@@ -400,6 +402,7 @@ export async function displayNextRecord(e) { ...@@ -400,6 +402,7 @@ export async function displayNextRecord(e) {
HIGHLIGHT_OBJECT.createHighlight(); HIGHLIGHT_OBJECT.createHighlight();
DISPLAY_FIELD_OBJECT.updateHeaderText(2, "Record "+ (current +1) +" of " + urls.length); DISPLAY_FIELD_OBJECT.updateHeaderText(2, "Record "+ (current +1) +" of " + urls.length);
document.getElementById("zoomDetails").textContent = "Zoom: 100%";
DISPLAY_FIELD_OBJECT.clearForm(); DISPLAY_FIELD_OBJECT.clearForm();
await populateFields(urls[current]); await populateFields(urls[current]);
...@@ -643,7 +646,7 @@ function init() { ...@@ -643,7 +646,7 @@ function init() {
} }
} }
if (e.shiftKey == true && e.keyCode == 72) { if (e.ctrlKey == true && e.shiftKey == true && e.keyCode == 72) {
e.preventDefault(); e.preventDefault();
let button = IMAGE_VIEWER_OBJECT.imageControls.flipHorizontalButton; let button = IMAGE_VIEWER_OBJECT.imageControls.flipHorizontalButton;
if(button && button.style.visibility !== "hidden"){ if(button && button.style.visibility !== "hidden"){
...@@ -652,7 +655,7 @@ function init() { ...@@ -652,7 +655,7 @@ function init() {
} }
} }
if (e.shiftKey == true && e.keyCode == 86) { if (e.ctrlKey == true && e.shiftKey == true && e.keyCode == 86) {
e.preventDefault(); e.preventDefault();
let button = IMAGE_VIEWER_OBJECT.imageControls.flipVerticalButton; let button = IMAGE_VIEWER_OBJECT.imageControls.flipVerticalButton;
if(button && button.style.visibility !== "hidden"){ if(button && button.style.visibility !== "hidden"){
...@@ -808,10 +811,10 @@ function showListOfShortcutKeys() { ...@@ -808,10 +811,10 @@ function showListOfShortcutKeys() {
} }
export const SHORTCUT_KEYS = [ export const SHORTCUT_KEYS = [
// { {
// "function": "Pause", "function": "Pause",
// "keys": ["ESC"] "keys": ["ESC"]
// }, },
{ {
"function": "Submit", "function": "Submit",
"keys": ["Shift", "Enter"] "keys": ["Shift", "Enter"]
...@@ -830,11 +833,11 @@ export const SHORTCUT_KEYS = [ ...@@ -830,11 +833,11 @@ export const SHORTCUT_KEYS = [
}, },
{ {
"function": "Flip Horizontally", "function": "Flip Horizontally",
"keys": ["Shift", "H"] "keys": ["Ctrl","Shift", "H"]
}, },
{ {
"function": "Flip Vertically", "function": "Flip Vertically",
"keys": ["Shift", "V"] "keys": ["Ctrl","Shift", "V"]
}, },
{ {
"function": "Rotate to Right", "function": "Rotate to Right",
......
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