Used optional chaining (?.) to simplify the extraction of the zoom level from the scaleMatch array. This avoids the need for an explicit check if scaleMatch is truthy before accessing its second element.

testing_refactoring
richrobber2 2024-06-12 02:59:08 -07:00
parent e00b3f58a4
commit c51f6bf0f2
1 changed files with 1 additions and 2 deletions

View File

@ -267,7 +267,7 @@ onUiLoaded(async () => {
imageARPreview.style.transform = "";
if (parseFloat(mainTab.style.width) > 865) {
const scaleMatch = mainTab.style.transform.match(/scale\(([-+]?[0-9]*\.?[0-9]+)\)/);
const zoom = scaleMatch && scaleMatch[1] ? Number(scaleMatch[1]) : 1; // default zoom
const zoom = scaleMatch?.[1] ? Number(scaleMatch[1]) : 1; // default zoom
imageARPreview.style.transformOrigin = "0 0";
imageARPreview.style.transform = `scale(${zoom})`;
}
@ -278,7 +278,6 @@ onUiLoaded(async () => {
setTimeout(() => { img.style.display = "none"; }, 400);
};
const hotkeysConfigOpts = await waitForOpts();
// Default config