| @@ -64,7 +64,7 @@ const teamsCount = 2; | |||||
| <div> | <div> | ||||
| <a class="down-capture display-none" target="_blank"></a> | <a class="down-capture display-none" target="_blank"></a> | ||||
| <button class="btn-qrcode fa"></button> | <button class="btn-qrcode fa"></button> | ||||
| <button class="btn-capture" onclick="captureScreenshot(formationBox);"></button> | |||||
| <button id="draw-screenshot"><input type="checkbox" id="screenshot-transparent"><label for="screenshot-transparent">透明</label></button> | |||||
| <label for="default-level"></label><input id="default-level" type="number" min="1" max="120" placeholder="110"/> | <label for="default-level"></label><input id="default-level" type="number" min="1" max="120" placeholder="110"/> | ||||
| <input type="checkbox" name="change-swap-to-copy" id="change-swap-to-copy"><label class="switch-lbl" for="change-swap-to-copy"></label> | <input type="checkbox" name="change-swap-to-copy" id="change-swap-to-copy"><label class="switch-lbl" for="change-swap-to-copy"></label> | ||||
| </div> | </div> | ||||
| @@ -1787,13 +1787,13 @@ function paddbFotmationToPdfFotmation(obj) | |||||
| return f; | return f; | ||||
| } | } | ||||
| //截图 | //截图 | ||||
| function captureScreenshot(target) { | |||||
| function captureScreenshot(target, transparent) { | |||||
| statusLine?.writeText(localTranslating.status_message.prepare_capture); | statusLine?.writeText(localTranslating.status_message.prepare_capture); | ||||
| //去掉可能的空白文字的编辑状态 | //去掉可能的空白文字的编辑状态 | ||||
| formationBox.classList.remove("edit-code"); | formationBox.classList.remove("edit-code"); | ||||
| const downLink = controlBox.querySelector(".down-capture"); | const downLink = controlBox.querySelector(".down-capture"); | ||||
| setTimeout(()=>{ | setTimeout(()=>{ | ||||
| html2canvas(target, {backgroundColor: null}).then(canvas => { | |||||
| html2canvas(target, transparent ? {backgroundColor: null} : undefined).then(canvas => { | |||||
| canvas.toBlob(function(blob) { | canvas.toBlob(function(blob) { | ||||
| window.URL.revokeObjectURL(downLink.href); | window.URL.revokeObjectURL(downLink.href); | ||||
| downLink.href = URL.createObjectURL(blob); | downLink.href = URL.createObjectURL(blob); | ||||
| @@ -1810,6 +1810,14 @@ window.onload = initialize; //界面初始化 | |||||
| //初始化 | //初始化 | ||||
| function initialize() { | function initialize() { | ||||
| const drawScreenshot = document.querySelector("#draw-screenshot"); | |||||
| const screenshotTransparent = document.querySelector("#screenshot-transparent"); | |||||
| drawScreenshot.onclick = function(event) { | |||||
| if (event.target == this) { | |||||
| captureScreenshot(formationBox, screenshotTransparent.checked); | |||||
| } | |||||
| } | |||||
| document.body.lang = currentLanguage.i18n; | document.body.lang = currentLanguage.i18n; | ||||
| qrcodeReader = new ZXing.BrowserQRCodeReader(); //二维码读取 | qrcodeReader = new ZXing.BrowserQRCodeReader(); //二维码读取 | ||||
| @@ -2004,8 +2012,8 @@ function initialize() { | |||||
| qrCodeFrame.ondrop = function(e) | qrCodeFrame.ondrop = function(e) | ||||
| { | { | ||||
| imagesSelected(e.dataTransfer.files); | imagesSelected(e.dataTransfer.files); | ||||
| e.stopPropagation(); | |||||
| e.preventDefault(); | |||||
| e.stopPropagation(); | |||||
| e.preventDefault(); | |||||
| } | } | ||||
| qrCodeFrame.refreshQrCode = function(string) | qrCodeFrame.refreshQrCode = function(string) | ||||
| @@ -46,7 +46,7 @@ const teamsCount = 1; | |||||
| <div> | <div> | ||||
| <a class="down-capture display-none" target="_blank"></a> | <a class="down-capture display-none" target="_blank"></a> | ||||
| <button class="btn-qrcode fa"></button> | <button class="btn-qrcode fa"></button> | ||||
| <button class="btn-capture" onclick="captureScreenshot(formationBox);"></button> | |||||
| <button id="draw-screenshot"><input type="checkbox" id="screenshot-transparent"><label for="screenshot-transparent"></label></button> | |||||
| <label for="default-level"></label><input id="default-level" type="number" min="1" max="120" placeholder="110"/> | <label for="default-level"></label><input id="default-level" type="number" min="1" max="120" placeholder="110"/> | ||||
| <input type="checkbox" name="change-swap-to-copy" id="change-swap-to-copy"><label class="switch-lbl" for="change-swap-to-copy"></label> | <input type="checkbox" name="change-swap-to-copy" id="change-swap-to-copy"><label class="switch-lbl" for="change-swap-to-copy"></label> | ||||
| </div> | </div> | ||||
| @@ -57,7 +57,7 @@ const teamsCount = 3; | |||||
| <div> | <div> | ||||
| <a class="down-capture display-none" target="_blank"></a> | <a class="down-capture display-none" target="_blank"></a> | ||||
| <button class="btn-qrcode fa"></button> | <button class="btn-qrcode fa"></button> | ||||
| <button class="btn-capture" onclick="captureScreenshot(formationBox);"></button> | |||||
| <button id="draw-screenshot"><input type="checkbox" id="screenshot-transparent"><label for="screenshot-transparent">透明</label></button> | |||||
| <label for="default-level"></label><input id="default-level" type="number" min="1" max="120" placeholder="110"/> | <label for="default-level"></label><input id="default-level" type="number" min="1" max="120" placeholder="110"/> | ||||
| <input type="checkbox" name="change-swap-to-copy" id="change-swap-to-copy"><label class="switch-lbl" for="change-swap-to-copy"></label> | <input type="checkbox" name="change-swap-to-copy" id="change-swap-to-copy"><label class="switch-lbl" for="change-swap-to-copy"></label> | ||||
| </div> | </div> | ||||