Improve Data Sequence Analysis (#14)

* Improve the performance of `generateDataBlocks`

* fix: Apply masks when editing in Data Sequence Analysis

---------

Co-authored-by: Coxxs <coxxs@users.noreply.github.com>
This commit is contained in:
Coxxs 2024-01-18 20:54:36 +08:00 committed by GitHub
parent e21683438b
commit 0098124767
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1128,7 +1128,7 @@ function showQRTableOverlay(){
if($("#qr-"+i+"-"+j).hasClass("info") || $("#qr-"+i+"-"+j).hasClass("static")){ if($("#qr-"+i+"-"+j).hasClass("info") || $("#qr-"+i+"-"+j).hasClass("static")){
html += "<td class='invisible'></td>"; html += "<td class='invisible'></td>";
} else { } else {
html += "<td index='"+i+"-"+j+"' style='opacity:0;'></td>"; html += "<td id='qr-overlay-"+i+"-"+j+"' style='opacity:0;'></td>";
} }
} }
html += "</tr>"; html += "</tr>";
@ -1354,7 +1354,7 @@ function generateDataBlocks(){
for(var i=0; i < qr_data_block.length; i++){ for(var i=0; i < qr_data_block.length; i++){
for(var j=0; j < qr_data_block[i].modules.length; j++){ for(var j=0; j < qr_data_block[i].modules.length; j++){
var module = qr_data_block[i].modules[j]; var module = qr_data_block[i].modules[j];
$("#qr-overlay td[index="+module+"]").addClass("hoverable data-block-"+i); $("#qr-overlay-"+module).addClass("hoverable data-block-"+i);
} }
for(var j=0; j < qr_data_block[i].modules.length; j++){ for(var j=0; j < qr_data_block[i].modules.length; j++){
var module = qr_data_block[i].modules[j].split('-'); var module = qr_data_block[i].modules[j].split('-');
@ -1370,10 +1370,10 @@ function generateSeparator(i,j,cls){
i = parseInt(i); i = parseInt(i);
j = parseInt(j); j = parseInt(j);
var up = $("#qr-overlay td[index="+(i-1)+"-"+j+"]"); var up = $("#qr-overlay-"+(i-1)+"-"+j);
var down = $("#qr-overlay td[index="+(i+1)+"-"+j+"]"); var down = $("#qr-overlay-"+(i+1)+"-"+j);
var left = $("#qr-overlay td[index="+i+"-"+(j-1)+"]"); var left = $("#qr-overlay-"+i+"-"+(j-1));
var right = $("#qr-overlay td[index="+i+"-"+(j+1)+"]"); var right = $("#qr-overlay-"+i+"-"+(j+1));
if(!left.hasClass(cls)){ if(!left.hasClass(cls)){
@ -1426,12 +1426,12 @@ function updateBlock(value, cls){
else else
new_val = parseInt(new_val); new_val = parseInt(new_val);
/*if(mask(mask_pattern, cord[0], cord[1])){ if(mask(mask_pattern, parseInt(cord[0]), parseInt(cord[1]))){
if(new_val == 1) if(new_val == 1)
new_val = 0; new_val = 0;
else if(new_val == 0) else if(new_val == 0)
new_val = 1; new_val = 1;
}*/ }
qr_array[cord[0]][cord[1]] = new_val; qr_array[cord[0]][cord[1]] = new_val;
} }