-
-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Clear image from file input #193
Comments
I also want to mention related to it, that with "stop" i don't want to clear the last image from the canvas, just with "clear" (I'm sending it to the backend) Pls. remove line: 452 - $this._element.removeChild($this._canvasElement); From 149 - 156 is not that good. Pls. use either promise or callback, but not both. qrCodeErrorCallback - verbose flag is missing - i have been forced to define an empty function, to avoid logging. |
mmhm ok, I just realized also that the clear() function remove completely the scanner if it's currently scanning, |
Ok I think I have to make a PR, the code is incomplete and using "clear" to "remove" is confusing. |
do you know how to use the sources rather than the minified file? tried to import html5-qrcode.js html5-qrcode-scanner.js and zxing-js.umd.min.js but does not work. My problem is for my test I don't want to bother to minify everytime, and also there is no minified on Fedora 33 but yui-compressor which destroy the current code... |
ok for now I mad a temporary trick to clear the canvas + file input; var canvas = document.getElementById("qr-canvas-visible"); |
Robert, if you have time, it's not that difficult to rewrite the whole, i don't think it's good enough for production, little bit spaghetti here and there. Unfortunately, i'm working with angular, and with typescript, so even if i refactor it completely it won't be javascript. I might also reduce the number of parameters to make it cleaner. I have an image upload, where the user can rotate / scale the image, i'm not sure what the flip is all about. Anyway Shape Recognition API on the way for chrome at least, so for the next coming month Zing might not be needed anymore. Next year this library might be completely obsolete, when other browsers are introducing the API also. (text/face recognition is included also) Native QR Code scanner already in Canary. |
I unfortunately no time to pass to much on html5-qrcode project, so as long as my spaghettis work for old and new browsers it's ok. |
@ROBERT-MCDOWELL
Please file a separate issue, with this context in detail
You mean here, the callback should report the |
If you bombard the logger 10 times per second as default, if i set verbosity flag to false, i expect that you avoid logging under this circumstances, as it has performance effect also. (and very likely meaningless, as i can't track problems) Until the plugin caugth my qr code, 2000 lines has been logged and i was not able to read it in the logger. You missed the versobe flag out completely from it. The error might not be needed to be logged that frequently also, as it does not really help to track issues. (i need to use the chrome developer scripting feature for that in this case, which has been used to debug mouse movement step by step for example, which would be ridiculous testing method in such a simple plugin) Other sentence quite easy to explain. When QR code has been successfully scanned you are removing the canvas at stopping, however the stop should only freeze the last QR image on the canvas, the clear method should clear the image from the canvas, and the destroy should remove the canvas from the html tree. I also argue that it's necessary, as most of the time, the whole thing will be warpped, so destroying the html is just simply removing the wrapper div. (yes you need to take care of your variables, but i do think there are approaches when you don't need to bother that kind of cleanup) |
Starting |
Calling `Html5QrcodeScanner#clear()` will also clear the UI rendered due to image based scan. This should address [issue#193](#193)
* Version 2.1.5 ### Changelog - Changed behavior from throwing error in case `qrbox.width` or `qrbox` is larger than the width of the root element. In such cases the dimension will automatically be truncated to the size of root element and will throw a warning based on verbosity settings. This should address [issue#357](#357) * Fix error when qrbox size is not set. * fix codacy error * Calling Html5QrcodeScanner#clear() will clear the entire UI Calling `Html5QrcodeScanner#clear()` will also clear the UI rendered due to image based scan. This should address [issue#193](#193)
Describe the bug
from Html5QrcodeScanner class
clear function does not remove the loaded file with file upload mode
To Reproduce
load an image from file upload input
use Html5QrcodeScanner.clear();
Expected behavior
clear must clear all current variables and remove the image canvas showing the file loaded
Smartphone (please complete the following information):
The text was updated successfully, but these errors were encountered: