Adjusting custom flow layout to also work with the horizontal scrolling direction.