added fit(targetIsHidden) method to address a bug when a view is not visible