-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Renamed to the
toParentBounds
& toViewportBounds
- Loading branch information
1 parent
8ad4fae
commit 98532a3
Showing
4 changed files
with
8 additions
and
8 deletions.
There are no files selected for viewing
This file contains 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 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 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
4 changes: 2 additions & 2 deletions
4
...ext-annotator/src/utils/normalizeRects.ts → ...text-annotator/src/utils/rectsToBounds.ts
This file contains 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 |
---|---|---|
@@ -1,9 +1,9 @@ | ||
export const normalizeRectWithOffset = (rect: DOMRect, offset: DOMRect): DOMRect => { | ||
export const toParentBounds = (rect: DOMRect, offset: DOMRect): DOMRect => { | ||
const { left, top, right, bottom } = rect; | ||
return new DOMRect(left - offset.left, top - offset.top, right - left, bottom - top); | ||
}; | ||
|
||
export const denormalizeRectWithOffset = (rect: DOMRect, offset: DOMRect): DOMRect => { | ||
export const toViewportBounds = (rect: DOMRect, offset: DOMRect): DOMRect => { | ||
const { left, top, right, bottom } = rect; | ||
return new DOMRect(left + offset.left, top + offset.top, right - left, bottom - top); | ||
} |