cvat icon indicating copy to clipboard operation
cvat copied to clipboard

Enhance Annotation Layer Changes: Relative zOrder Updates

Open arianizadi opened this issue 9 months ago • 11 comments

Motivation and context

Closes #9064 The current method of moving objects in CVAT using absolute placements (sending them directly to the front or back) can be disorienting and unpredictable. When repeatedly moving an object backward, it can continue to shift unexpectedly, making it difficult to track and control its position accurately.

This update introduces a relative movement approach, allowing users to adjust an object’s z-order one layer at a time. Instead of jumping directly to the back or front, users can precisely move objects step-by-step, ensuring greater accuracy and control over the annotation layout. This prevents unwanted drastic changes and makes object layering more intuitive and predictable.

By constraining the movement within minZLayer and maxZLayer, this solution also prevents objects from going out of bounds, further improving usability.

How has this been tested?

I had tested by rebuilding and using the functionality for my semantic segmentation tasks. Just by testing the keybinds and buttons in multiple images.

Checklist

  • [x] I submit my changes into the develop branch
  • [x] I have created a changelog fragment
  • [x] I have updated the documentation accordingly
  • [x] I have added tests to cover my changes
  • [x] I have linked related issues (see GitHub docs)

License

  • [x] I submit my code changes under the same MIT License that covers the project. Feel free to contact the maintainers if that's a concern.

arianizadi avatar Feb 06 '25 06:02 arianizadi

Would this kind of change need a test? I did not find any tests for the previous implementation.

arianizadi avatar Feb 06 '25 06:02 arianizadi

Hi, Moving objects between layers could be a useful feature. However, I don’t think we should completely remove the To Background and To Foreground functions. What do you think about adding additional shortcuts or buttons to support moving objects between layers?

An e2e test would be much appreciated. You can find basic tests for z order here

klakhov avatar Feb 06 '25 08:02 klakhov

That makes sense. I will try to fix that and write the tests. Thank you!

arianizadi avatar Feb 06 '25 18:02 arianizadi

Any updates on this?

klakhov avatar Feb 24 '25 08:02 klakhov

Sorry for the delay, school had gotten busy. I updated the code. I will work on the e2e tests.

arianizadi avatar Feb 24 '25 20:02 arianizadi

I’m having trouble writing a test for the toForeground button. When clicked, the button creates a new layer on top, but I can’t figure out how to move the slider in Cypress to reveal that layer.

I’ve tried: • Simulating button clicks to move the slider • Setting the current z-value using JavaScript • Clicking the bottom of the slider

None of these approaches have worked. If anyone has suggestions, I’d really appreciate the help!

arianizadi avatar Mar 04 '25 20:03 arianizadi

Everything should be working now. All tests are passing.

arianizadi avatar Mar 15 '25 02:03 arianizadi

What icons would be preferred for the two new buttons? Also, I forgot to mention I added E2E tests for the existing toForeground and toBackground buttons.

arianizadi avatar Mar 31 '25 20:03 arianizadi

As for the icons, I would suggest using something like a box with an arrow pointing up and down, respectively. Or maybe just an arrow. However, I believe the first option would be better.

klakhov avatar Apr 01 '25 08:04 klakhov

The proper key bindings should be working now. Is there anything else I should update? @klakhov

arianizadi avatar May 26 '25 04:05 arianizadi

@klakhov @bsekachev @nmanovic — Is anything else needed before final review and merge?

arianizadi avatar Aug 06 '25 17:08 arianizadi

Codecov Report

:white_check_mark: All modified and coverable lines are covered by tests. :white_check_mark: Project coverage is 73.43%. Comparing base (a7c13b2) to head (3332e2f).

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #9063      +/-   ##
===========================================
- Coverage    82.25%   73.43%   -8.83%     
===========================================
  Files          467      411      -56     
  Lines        48648    45616    -3032     
  Branches      4091     4091              
===========================================
- Hits         40016    33496    -6520     
- Misses        8632    12120    +3488     
Components Coverage Δ
cvat-ui 77.27% <ø> (+0.07%) :arrow_up:
cvat-server 70.15% <ø> (-15.93%) :arrow_down:
:rocket: New features to boost your workflow:
  • :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • :package: JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

codecov-commenter avatar Oct 08 '25 09:10 codecov-commenter