File tree Expand file tree Collapse file tree 2 files changed +11
-5
lines changed
Expand file tree Collapse file tree 2 files changed +11
-5
lines changed Original file line number Diff line number Diff line change @@ -1893,8 +1893,6 @@ export class CoreNode extends EventEmitter {
18931893 const inRttCluster =
18941894 this . props . rtt === true || this . parentHasRenderTexture === true ;
18951895 const children = this . children ;
1896- const min = this . zIndexMin ;
1897- const max = this . zIndexMax ;
18981896 const zIndex = node . zIndex ;
18991897 const autosizeTarget = this . autosizer || this . parentAutosizer ;
19001898 let attachToAutosizer = autosizeTarget !== null ;
@@ -1932,7 +1930,14 @@ export class CoreNode extends EventEmitter {
19321930
19331931 children . push ( node ) ;
19341932
1935- if ( min !== max || ( zIndex !== min && zIndex !== max ) ) {
1933+ if ( zIndex < this . zIndexMin ) {
1934+ this . zIndexMin = zIndex ;
1935+ }
1936+ if ( zIndex > this . zIndexMax ) {
1937+ this . zIndexMax = zIndex ;
1938+ }
1939+
1940+ if ( this . zIndexMax !== this . zIndexMin ) {
19361941 this . zIndexSortList . push ( node ) ;
19371942 this . setUpdateType ( UpdateType . SortZIndexChildren ) ;
19381943 }
Original file line number Diff line number Diff line change @@ -73,11 +73,12 @@ export const incrementalRepositionByZIndex = (
7373
7474 //binary search for correct insertion position
7575 let left = 0 ;
76- let right = nodes . length ;
76+ let right = currentIndex === nodes . length - 1 ? currentIndex : nodes . length ;
7777
7878 while ( left < right ) {
7979 const mid = ( left + right ) >>> 1 ;
80- if ( nodes [ mid ] ! . props . zIndex <= targetZIndex ) {
80+ const target = nodes [ mid ] ! ;
81+ if ( target . props . zIndex <= targetZIndex ) {
8182 left = mid + 1 ;
8283 } else {
8384 right = mid ;
You can’t perform that action at this time.
0 commit comments