added option to setup border size and contentInset for better detection