fix ifOnEdgeBounce logic for CAT-1060

change repositioning logic
adapt tests
differ between horizontal and vertical border