|
132 | 132 | return elCSS.flexDirection === 'column' || elCSS.flexDirection === 'column-reverse' |
133 | 133 | ? 'vertical' : 'horizontal'; |
134 | 134 | } |
| 135 | + if (child1 && firstChildCSS.float !== 'none') { |
| 136 | + var touchingSideChild2 = firstChildCSS.float === 'left' ? 'left' : 'right'; |
| 137 | + |
| 138 | + return child2 && (secondChildCSS.clear === 'both' || secondChildCSS.clear === touchingSideChild2) ? |
| 139 | + 'vertical' : 'horizontal'; |
| 140 | + } |
135 | 141 | return (child1 && |
136 | 142 | ( |
137 | | - child1.style.display === 'block' || // getComputedStyle() gives 'block' when 'inline-block' |
| 143 | + firstChildCSS.display === 'block' || |
138 | 144 | firstChildCSS.display === 'flex' || |
139 | 145 | firstChildCSS.display === 'table' || |
140 | 146 | firstChildCSS.display === 'grid' || |
|
1923 | 1929 | } |
1924 | 1930 |
|
1925 | 1931 | /** |
1926 | | - * Gets the last child in the el, ignoring ghostEl |
| 1932 | + * Gets the last child in the el, ignoring ghostEl or invisible elements (clones) |
1927 | 1933 | * @param {HTMLElement} el Parent element |
1928 | 1934 | * @return {HTMLElement} The last child, ignoring ghostEl |
1929 | 1935 | */ |
1930 | 1936 | function _lastChild(el) { |
1931 | 1937 | var last = el.lastElementChild; |
1932 | 1938 |
|
1933 | | - if (last === ghostEl) { |
1934 | | - last = el.children[el.childElementCount - 2]; |
| 1939 | + while (last === ghostEl || last.style.display === 'none') { |
| 1940 | + last = last.previousElementSibling; |
| 1941 | + |
| 1942 | + if (!last) break; |
1935 | 1943 | } |
1936 | 1944 |
|
1937 | 1945 | return last || null; |
|
1943 | 1951 | mouseOnOppAxis = axis === 'vertical' ? evt.clientX : evt.clientY, |
1944 | 1952 | targetS2 = axis === 'vertical' ? elRect.bottom : elRect.right, |
1945 | 1953 | targetS1Opp = axis === 'vertical' ? elRect.left : elRect.top, |
1946 | | - targetS2Opp = axis === 'vertical' ? elRect.right : elRect.bottom; |
| 1954 | + targetS2Opp = axis === 'vertical' ? elRect.right : elRect.bottom, |
| 1955 | + spacer = 10; |
1947 | 1956 |
|
1948 | 1957 | return ( |
1949 | | - mouseOnOppAxis > targetS1Opp && |
1950 | | - mouseOnOppAxis < targetS2Opp && |
1951 | | - mouseOnAxis > targetS2 |
| 1958 | + axis === 'vertical' ? |
| 1959 | + (mouseOnOppAxis > targetS2Opp + spacer || mouseOnOppAxis <= targetS2Opp && mouseOnAxis > targetS2 && mouseOnOppAxis >= targetS1Opp) : |
| 1960 | + (mouseOnAxis > targetS2 && mouseOnOppAxis > targetS1Opp || mouseOnAxis <= targetS2 && mouseOnOppAxis > targetS2Opp + spacer) |
1952 | 1961 | ); |
1953 | 1962 | } |
1954 | 1963 |
|
|
0 commit comments