From 2775c8fcb1bedf63d93cc9342fb2bc8b7d2ed70e Mon Sep 17 00:00:00 2001 From: Boris Sekachev Date: Mon, 30 Mar 2020 16:04:51 +0300 Subject: [PATCH] Fixed zOrder range computing in case when there are tags --- cvat-ui/src/actions/annotation-actions.ts | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/cvat-ui/src/actions/annotation-actions.ts b/cvat-ui/src/actions/annotation-actions.ts index 0d32cc8d9246..46989db34630 100644 --- a/cvat-ui/src/actions/annotation-actions.ts +++ b/cvat-ui/src/actions/annotation-actions.ts @@ -80,13 +80,10 @@ function receiveAnnotationsParameters(): AnnotationsParameters { } export function computeZRange(states: any[]): number[] { - let minZ = states.length ? states[0].zOrder : 0; - let maxZ = states.length ? states[0].zOrder : 0; - states.forEach((state: any): void => { - if (state.objectType === ObjectType.TAG) { - return; - } - + const filteredStates = states.filter((state: any): any => state.objectType !== ObjectType.TAG); + let minZ = filteredStates.length ? filteredStates[0].zOrder : 0; + let maxZ = filteredStates.length ? filteredStates[0].zOrder : 0; + filteredStates.forEach((state: any): void => { minZ = Math.min(minZ, state.zOrder); maxZ = Math.max(maxZ, state.zOrder); });