-
Notifications
You must be signed in to change notification settings - Fork 45
Extract edit bounding box (Part 2) #1158
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
jpggvilaca
wants to merge
10
commits into
main
Choose a base branch
from
jvilaca/extract-edit-bounding-box-part-2
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
9c49ad5
WIP fixing tests
jpggvilaca d0dda26
Fix test of tests
jpggvilaca 887dbf1
Move tool utils
jpggvilaca 603c9b0
Move edit bounding box
jpggvilaca 4bb6976
Move translate shape
jpggvilaca 4afe683
Update imports
jpggvilaca 1f073b4
Update interfaces/tests/utils
jpggvilaca c4625ac
Fix translate shape style issue
jpggvilaca 1eb0ce3
Add missing annotation color
jpggvilaca b3d2733
Fix most playwright tests
jpggvilaca File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
// Copyright (C) 2022-2025 Intel Corporation | ||
// LIMITED EDGE SOFTWARE DISTRIBUTION LICENSE | ||
|
||
declare module '*.module.scss' { | ||
const classes: { [key: string]: string }; | ||
export default classes; | ||
} |
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
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
8 changes: 8 additions & 0 deletions
8
...ackages/smart-tools/src/edit-bounding-box/edit-bounding-box/edit-bounding-box.module.scss
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
.disabledLayer { | ||
position: absolute; | ||
top: 0; | ||
left: 0; | ||
bottom: 0; | ||
right: 0; | ||
pointer-events: none; | ||
} |
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
// Copyright (C) 2022-2025 Intel Corporation | ||
// LIMITED EDGE SOFTWARE DISTRIBUTION LICENSE | ||
|
||
import { PointerEvent, SVGProps } from 'react'; | ||
|
||
interface MouseButton { | ||
button: number; | ||
buttons: number; | ||
} | ||
|
||
const BUTTON_LEFT = { | ||
button: 0, | ||
buttons: 1, | ||
}; | ||
const BUTTON_WHEEL = { | ||
button: 1, | ||
buttons: 4, | ||
}; | ||
|
||
const isButton = (button: MouseButton, buttonToCompare: MouseButton): boolean => | ||
button.button === buttonToCompare.button || button.buttons === buttonToCompare.buttons; | ||
|
||
export const isLeftButton = (button: MouseButton): boolean => { | ||
return button.button === BUTTON_LEFT.button || button.buttons === BUTTON_LEFT.buttons; | ||
}; | ||
|
||
export const isWheelButton = (button: MouseButton): boolean => { | ||
return isButton(button, BUTTON_WHEEL); | ||
}; | ||
|
||
type OnPointerDown = SVGProps<SVGElement>['onPointerDown']; | ||
export const allowPanning = (onPointerDown?: OnPointerDown): OnPointerDown | undefined => { | ||
if (onPointerDown === undefined) { | ||
return; | ||
} | ||
|
||
return (event: PointerEvent<SVGElement>) => { | ||
const isPressingPanningHotKeys = (isLeftButton(event) && event.ctrlKey) || isWheelButton(event); | ||
|
||
if (isPressingPanningHotKeys) { | ||
return; | ||
} | ||
|
||
return onPointerDown(event); | ||
}; | ||
}; |
2 changes: 1 addition & 1 deletion
2
...s/annotator/tools/edit-tool/utils.test.ts β .../smart-tools/src/utils/tool-utils.test.ts
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
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.