fixed calculation issue
fixed bug when resize fast
fixed reset after new window
fixed issue with new window