Example 2, prevent from extending beyond the parent edge