@steveck-chung 
The following lines can be moved after function declaration
state.resizing = true;
 resizedImg(imgNodes[done]);