feat: freehand polygon drawing (press-and-drag) behind feature flag - #9820
Open
ozymandiashh wants to merge 3 commits into
Open
feat: freehand polygon drawing (press-and-drag) behind feature flag#9820ozymandiashh wants to merge 3 commits into
ozymandiashh wants to merge 3 commits into
Conversation
Acceptance criteria: - When the flag is off, Polygon retains its existing click-to-place behavior and pointer drags create nothing. - When the flag is on, primary mouse, pen, and touch drags create one simplified polygon while ordinary clicks still place vertices. - Each sample keeps the coordinate transform active when it was collected, including during mid-drag zoom changes. - One undo action removes the entire completed contour. - Pointer cancellation, tool switches, teardown, and capture-less fallback leave no in-progress drawing or frozen history. - Unit and integration coverage exercises simplification, flag gating, input types, click coexistence, transform changes, and undo. Closes-PRD: HumanSignal#8315 References: HumanSignal#8315
👷 Deploy request for heartex-docs pending review.Visit the deploys page to approve it
|
👷 Deploy request for label-studio-docs-new-theme pending review.Visit the deploys page to approve it
|
✅ Deploy Preview for label-studio-playground ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
✅ Deploy Preview for label-studio-storybook ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c4e480cbff
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Author
The compatibility guard that suppresses the synthetic mouse event following a touch/pen freehand interaction was only time-checked, never cleared. If its synthetic event never arrived (e.g. the browser cancels the click after a sub-threshold cursor move between mousedown and mouseup), the stale guard could suppress one later, unrelated mouse event with nearby coordinates. Prune the guard as soon as it is found expired, extend the TTL from 500ms to 1500ms to comfortably cover the synthetic-event window, and route the timestamp through an injectable clock so the behaviour is unit-testable.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Problem
The accepted community PRD in #8315 describes the current limitation:
Solution
fflag_feat_front_polygon_freehand, default off.User Stories
Acceptance Criteria
fflag_feat_front_polygon_freehandis disabled, when an annotator uses the Polygon tool, then the existing click-to-place workflow is unchanged and a pointer drag does not create a contour.Testing
yarn lsf:unit --runInBand --silent: 129 test suites passed; 3,331 tests passed and 5 were skipped.yarn lsf:unit --runInBand --silent --testPathPatterns='components/ImageView/__tests__/ImageView.test.jsx|tools/__tests__/Polygon.test.js|utils/__tests__/freehand.test.js': 3 suites and 85 tests passed.BABEL_ENV=test MODE=standalone yarn nx run editor:build:production --skip-nx-cache: production build compiled successfully.Credit and context
Thank you to @cozeybozey for the PRD and proof of concept in #8315 and the earlier exploration in #8388. This implementation is intentionally scoped to the generic freehand Polygon workflow and uses pointer events plus an in-house simplifier without the extra dependency or unrelated changes from the prior attempt.
The interaction model has been production-tested with a medical imaging annotation team using tablets and styluses.
Closes-PRD: #8315