2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-07-11 07:24:15 +00:00

Add 1D barcode support to browser webcam scanner (#4007)

* Removed invalid characters

* Changed barcode scanning library to html5-qrcode

* Added responsive barcode scanner styles

* Fixed js formatting

* Added barcode scanner upscaling for performance

* Added scanner styles for firefox

* Removed unused qr-scanner JS files
This commit is contained in:
Maksim Stojkovic
2022-12-02 08:03:21 +11:00
committed by GitHub
parent 0b26bd0924
commit e22db29862
9 changed files with 71 additions and 149 deletions

View File

@ -12,6 +12,9 @@
--label-yellow: #fdc82a;
--bs-body-color: #68686a;
--scanner-upscale: 5;
--scanner-margin: 10%;
}
main {
@ -711,6 +714,33 @@ input[type="submit"] {
margin-bottom: 10px;
}
/* Make barcode scanner responsive and performant */
#barcode_scan_video video {
width: calc(100% * var(--scanner-upscale)) !important;
transform: scale(calc(1 / var(--scanner-upscale)));
margin: calc(-100% * (var(--scanner-upscale) - 1) / 2);
display: inline-block !important;
}
@-moz-document url-prefix() {
#barcode_scan_video video {
margin-top: calc(-100% * (var(--scanner-upscale) - 1) / 2 + 50%);
margin-bottom: calc(-100% * (var(--scanner-upscale) - 1) / 2 + 50%);
}
@media (pointer:coarse) {
#barcode_scan_video video {
margin-top: calc(-100% * (var(--scanner-upscale)) / 2 - 20%);
margin-bottom: calc(-100% * (var(--scanner-upscale)) / 2 - 20%);
}
}
}
#barcode_scan_video #qr-shaded-region {
border: none !important;
margin: var(--scanner-margin);
}
.sidebar-list-group-item {
background-color: var(--secondary-color);
color: var(--bs-body-color);