Commit 9e5652f2 authored by Gabriel Monnerat's avatar Gabriel Monnerat

erp5_document_scanner: improve UI

parent 8e4c732e
......@@ -20,7 +20,16 @@
min-height: 390px;
}
.camera-input, .camera-output {
.page-number {
display: inline;
}
.camera-header {
font-size: 12pt;
font-weight: 400;
}
.camera-input, .camera-output, .camera-header {
text-align: center;
}
......@@ -53,8 +62,4 @@
font-size: 16px;
font-family: "Lucida Grande", "Arial", sans-serif;
width: 760px;
}
.camera {
margin-top: 1em;
}
\ No newline at end of file
......@@ -11,6 +11,9 @@
</head>
<body>
<div class="camera">
<div class="camera-header">
<h4>Page <label class="page-number">1</label></h4>
</div>
<div class="camera-input" style="display: none">
<video class="video">Webcam is not available</video>
<button type="button" class="startbutton">Take a picture!</button>
......
......@@ -47,6 +47,14 @@
});
}
function setPageOne(root) {
root.querySelector(".page-number").innerText = "1";
}
function setPageTwo(root) {
root.querySelector(".page-number").innerText = "2";
}
function drawCanvas(gadget, img) {
var ratio, x, y;
canvas.width = imageWidth;
......@@ -263,7 +271,7 @@
}, false, true)*/
.onEvent("click", function (evt) {
var gadget;
var root;
if (evt.target.name === "grayscale") {
return this.getElement()
.push(function () {
......@@ -274,8 +282,12 @@
evt.preventDefault();
return this.getElement()
.push(function (el) {
root = el;
el.querySelector(".camera-input").style.display = "none";
return takePicture(el);
})
.push(function () {
return setPageTwo(root);
});
}
if (evt.target.className === "reset-button") {
......@@ -285,6 +297,7 @@
el.querySelector(".camera-input").style.display = "";
el.querySelector(".camera-output").style.display = "none";
cropper.destroy();
return setPageOne(el);
});
}
if (evt.target.className === "capture-button") {
......@@ -292,7 +305,7 @@
preferredCroppedCanvasData = cropper.getData();
return this.getElement()
.push(function (el) {
gadget = el;
root = el;
return cropper.getCroppedCanvas();
})
.push(function (canvas) {
......@@ -312,10 +325,11 @@
photo.src = base64data;
photoInput.value = realData;
gadget.querySelector(".camera-input").style.display = "none";
gadget.querySelector(".camera-output").style.display = "";
gadget.querySelector(".capture-button").style.display = "none";
root.querySelector(".camera-input").style.display = "none";
root.querySelector(".camera-output").style.display = "";
root.querySelector(".capture-button").style.display = "none";
cropper.destroy();
return setPageTwo(root);
});
}
}, false, false);
......
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