This commit is contained in:
iqudoo
2026-05-02 23:04:49 +08:00
parent 69b0c4e27c
commit 4afa5ec8cb
3 changed files with 7 additions and 5 deletions

2
dist/index.js vendored

File diff suppressed because one or more lines are too long

View File

@@ -405,7 +405,7 @@ export function scanVideo() {
unlockScanBeep();
Promise.resolve().then(() => {
__scanning();
return startScanForWeb(getConfig("webScanCanvasStyle"), __result).then(resp => {
return startScanForWeb(__result).then(resp => {
if (resp && resp.result) {
__result(resp.result);
}

View File

@@ -423,7 +423,7 @@ export function startScanForImage() {
});
}
export function startScanForWeb(canvasStyle, onResult) {
export function startScanForWeb(onResult) {
let currentUuid = null;
return new Promise((resolve, reject) => {
try {
@@ -431,18 +431,20 @@ export function startScanForWeb(canvasStyle, onResult) {
scanWeb.uuid = createUUID();
scanWeb.finish = false;
currentUuid = scanWeb.uuid;
let canvasStyle = getConfig("webScanCanvasStyle");
let canvasClass = getConfig("webScanCanvasClass");
let videoEl = createEl("video",
"__webscan_video__",
"display: none", false);
let canvasEnabled = getConfig("webScanCanvasEnabled") !== false;
let canvasDisplay = "";
let canvasBaseStyle = canvasStyle || "position: fixed; width: 300px; height: 300px; top: 0; left: 0; z-index: 9999;";
let canvasBaseStyle = canvasStyle || (!!canvasClass ? "" : "position: fixed; width: 300px; height: 300px; top: 0; left: 0; z-index: 9999;");
let canvasEl = createEl("canvas",
"__webscan_canvas__",
canvasBaseStyle + " display: none;", true);
canvasDisplay = canvasEl.style.display;
canvasEl.style.cssText = canvasBaseStyle;
canvasEl.className = getConfig("webScanCanvasClass") || "";
canvasEl.className = canvasClass || "";
canvasDisplay = canvasEl.style.display;
let canvasDisplaySize = getCanvasDisplaySize(canvasEl, 300, 240);
canvasEl.style.display = "none";