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

fix: LSDV-5248: BBoxes optimizations #1523

Merged
merged 22 commits into from
Sep 4, 2023
Merged

Conversation

Gondragos
Copy link
Contributor

@Gondragos Gondragos commented Aug 7, 2023

Previously, we used the deferred action call approach for double-clicking on a region. It was caused by the fact that there was no way to catch dblclick interaction 'cause re-rendering elements on selection prevents emiting events.

Right now this problem should be solved by using Portal element of Konva. As long as the elements are still the same we can catch second click on them so we do not need ta wait anymore.

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

What libraries were added/updated?

N/A

Does this change affect performance?

Nope

Does this change affect security?

Nope

What alternative approaches were there?

(briefly list any if applicable)

What feature flags were used to cover this change?

fflag_fix_front_lsdv_5248_double_click_delay_280823_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?

Image Segmentation

@github-actions github-actions bot added the fix label Aug 7, 2023
@codecov-commenter
Copy link

codecov-commenter commented Aug 16, 2023

Codecov Report

Patch coverage is 66.66% of modified lines.

Files Changed Coverage
src/regions/KeyPointRegion.js 0.00%
src/mixins/KonvaRegion.js 50.00%
src/components/ImageView/ImageView.js 76.92%
src/regions/AliveRegion.tsx 100.00%
src/regions/BrushRegion.js 100.00%
src/utils/feature-flags.ts 100.00%

📢 Thoughts on this report? Let us know!.

src/regions/AliveRegion.tsx Show resolved Hide resolved
@@ -28,13 +38,20 @@ export const AliveRegion = (

return observer(({ item, ...rest }: RegionComponentProps) => {
const canRender = options?.renderHidden || !item.hidden;
const shouldNotUsePortal = isFF(FF_DBLCLICK_DELAY) || options?.shouldNotUsePortal;
Copy link
Collaborator

Choose a reason for hiding this comment

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

options.shouldNotUsePortal is set to true only in one region (Brush) and the value is isFF(FF_DBLCLICK_DELAY), so it can be just removed.

@@ -388,7 +392,10 @@ const SelectionLayer = observer(({ item, selectionArea }) => {
const Selection = observer(({ item, selectionArea, ...triggeredOnResize }) => {
return (
<>
<SelectedRegions item={item} selectedRegions={item.selectedRegions} {...triggeredOnResize} />
{ !isFF(FF_DBLCLICK_DELAY)
Copy link
Collaborator

Choose a reason for hiding this comment

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

reverse condition for readability, please

if ('ruler' === el?.attrs?.name) {
return true;
}
if ((!isFF(FF_DBLCLICK_DELAY) || !isMoveTool)
Copy link
Collaborator

Choose a reason for hiding this comment

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

please, rewrite this! extract lambda into separate named function, add comment, simplify condition

@@ -35,7 +34,7 @@ export const KonvaRegionMixin = types.model({})
};
})
.actions(self => {
let deferredSelectId = null;
let deferredSelectId;
Copy link
Collaborator

Choose a reason for hiding this comment

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

are there some importance in this change from null to undefined?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Nope, it's just an accident

src/mixins/KonvaRegion.js Show resolved Hide resolved
@Gondragos Gondragos merged commit e888b2d into master Sep 4, 2023
16 of 17 checks passed
@Gondragos Gondragos deleted the fb-lsdv-5248/bbox-optimization branch September 4, 2023 17:41
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants