Skip to content
This repository has been archived by the owner on Apr 18, 2024. It is now read-only.

fix: LEAP-419: Fix brush issues appeared after fixing zoom performance #1625

Merged
merged 10 commits into from
Nov 30, 2023

Conversation

Gondragos
Copy link
Contributor

@Gondragos Gondragos commented Nov 27, 2023

PR fulfills these requirements

  • Commit message(s) and PR title follows the format [fix|feat|ci|chore|doc]: TICKET-ID: Short description of change made ex. fix: DEV-XXXX: Removed inconsistent code usage causing intermittent errors
  • Tests for the changes have been added/updated (for bug fixes/features)
  • Docs have been added/updated (for bug fixes/features)
  • Best efforts were made to ensure docs/code are concise and coherent (checked for spelling/grammatical errors, commented out code, debug logs etc.)
  • Self-reviewed and ran all changes on a local instance (for bug fixes/features)

Change has impacts in these area(s)

(check all that apply)

  • Product design
  • Frontend

Describe the reason for change

Fixes after #1565 for LEAP-32

What does this fix?

  • an issue with wrong position of brush stroke highlighted on hover.
  • an issue with clipping brush strokes by image boundaries.
  • an issue with drawing and erasing over existing brush regions.

What libraries were added/updated?

@heartexlabs/ls-test

Does this change affect performance?

Nope

Does this change affect security?

Nope

What alternative approaches were there?

N/A

What feature flags were used to cover this change?

fflag_fix_front_leap_32_zoom_perf_190923_short

Does this PR introduce a breaking change?

(check only one)

  • Yes, and covered entirely by feature flag(s)
  • Yes, and covered partially by feature flag(s)
  • No
  • Not sure (briefly explain the situation below)

What level of testing was included in the change?

(check all that apply)

  • e2e
  • integration
  • unit

Which logical domain(s) does this change affect?

Brush, Magic wand, Image Segmentation

@@ -271,6 +271,11 @@ const Model = types
const ctx = layer.canvas.context;

ctx.save();
if (isFF(FF_ZOOM_OPTIM)) {
ctx.beginPath();
ctx.rect(self.parent.alignmentOffset.x, self.parent.alignmentOffset.y, self.parent.stageWidth, self.parent.stageHeight);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do we need this rect here?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also looks like this rect is created with wrong dimensions on zoomed in image — brush is not displayed during drawing after some line, but displayed after you finish it

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's dynamic clipining of drawing brush region. As long as we have this optimization with rendering strokes on fly we need to duplicate clipping functionality during it or we will be able to have strokes renered out of image bounds till we release mouse button. And without this clipping test will be failed at https://github.com/HumanSignal/label-studio-frontend/pull/1625/files#diff-1d9ae97357e362d1cf5b1ed46609b84b9e7cdfd80a8158e8f4c955d0187628e1R64 and https://github.com/HumanSignal/label-studio-frontend/pull/1625/files#diff-1d9ae97357e362d1cf5b1ed46609b84b9e7cdfd80a8158e8f4c955d0187628e1R90

@@ -648,11 +648,25 @@ const Model = types.model({
return {
views: {
getSkipInteractions() {
const manager = self.getToolsManager();
if (isFF(FF_ZOOM_OPTIM)) {
if (skipInteractions) return true;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

one more reason to rewrite this whole approach: skipInteractions is just a var, so it won't invalidate this getter per se, so it might loose some checks.

Comment on lines +699 to +702
const tool = item.parent.getToolsManager().findSelectedTool();
const isMoveTool = tool && getType(tool).name === 'MoveTool';

if (tool && !isMoveTool) return;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks like this fixes bug in both states — with flag ON and OFF. but how?
is there some fix for FF ON down the code?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is how it worked before I had found some problems with this part. Right now the solution is here
https://github.com/HumanSignal/label-studio-frontend/pull/1625/files#diff-fe7c98bf1c96a7516510c192b4c2d947adaef36b394240756f6d044b32eb2cc8R652-R662
and it looks better for me.

@Gondragos Gondragos force-pushed the fb-leap-419/brush-fixes branch from 7326961 to f0cd2d7 Compare November 27, 2023 20:23
@Gondragos Gondragos force-pushed the fb-leap-419/brush-fixes branch from f0cd2d7 to 2468827 Compare November 27, 2023 21:57
@Gondragos Gondragos enabled auto-merge (squash) November 30, 2023 06:07
@codecov-commenter
Copy link

Codecov Report

Attention: 11 lines in your changes are missing coverage. Please review.

Comparison is base (6fb65c8) 68.17% compared to head (5049a61) 64.56%.
Report is 2 commits behind head on master.

Files Patch % Lines
src/regions/BrushRegion.js 56.25% 7 Missing ⚠️
src/tags/object/Image/Image.js 66.66% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1625      +/-   ##
==========================================
- Coverage   68.17%   64.56%   -3.62%     
==========================================
  Files         443      443              
  Lines       28662    28688      +26     
  Branches     7615     7518      -97     
==========================================
- Hits        19540    18521    -1019     
- Misses       7865    10167    +2302     
+ Partials     1257        0    -1257     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@Gondragos Gondragos merged commit bee2622 into master Nov 30, 2023
13 of 14 checks passed
@Gondragos Gondragos deleted the fb-leap-419/brush-fixes branch November 30, 2023 06:59
MasherJames pushed a commit to HelloPareto/label-studio-frontend that referenced this pull request Feb 29, 2024
HumanSignal#1625)

* fix: LEAP-419: Fix brush issues appeared after fixing zoom performance

* Add tests

* Fix clipping boundaries

* Fix tests

* Fix missprints

* Add debugging info

* Fix tests according to CI problems

* Update ls-test

* Fix tests about drawing without ctrl

* Update ls-test
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants