Added visibility check to _calcHeight