only update nodes in viewport

This commit is contained in:
multiSnow 2023-02-03 22:49:15 +08:00
parent 982ca15d80
commit e768162041
Signed by: multiSnow
GPG Key ID: 18EDAC29CAA2DBCE
1 changed files with 12 additions and 0 deletions

View File

@ -87,6 +87,10 @@ function opr_active(gid,dict){
pausecanvas(pause_icon);
removecanvas(remove_icon);
optioncanvas(option_icon);
}else{
let rect=node.getBoundingClientRect();
if(rect.top>window.innerHeight||rect.top+rect.height<0)
return 0;
};
for(let n of node.getElementsByTagName('div')){
if(n.id in dictmap){
@ -140,6 +144,10 @@ function opr_stopped(gid,dict){
removecanvas(remove_icon);
optioncanvas(option_icon);
}else{
let rect=node.getBoundingClientRect();
if(rect.top>window.innerHeight||rect.top+rect.height<0)
return 0;
};
for(let n of node.getElementsByTagName('div')){
if(n.id in dictmap){
@ -216,6 +224,10 @@ function opr_waiting(gid,dict){
unpausecanvas(unpause_icon);
removecanvas(remove_icon);
optioncanvas(option_icon);
}else{
let rect=node.getBoundingClientRect();
if(rect.top>window.innerHeight||rect.top+rect.height<0)
return 0;
};
for(let n of node.getElementsByTagName('div')){
if(n.id in dictmap){