-
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.
Refactoring + removed unused API args
- Loading branch information
Showing
5 changed files
with
18 additions
and
37 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
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,12 +1,7 @@ | ||
import RBush from 'rbush'; | ||
import type { Store } from '@annotorious/core'; | ||
import type { TextAnnotation, TextAnnotationTarget } from '../model'; | ||
import { | ||
isRevived, | ||
reviveSelector, | ||
mergeClientRects, | ||
normalizeRectWithOffset | ||
} from '../utils'; | ||
import { isRevived, reviveSelector, mergeClientRects } from '../utils'; | ||
import type { AnnotationRects } from './TextAnnotationStore'; | ||
|
||
interface IndexedHighlightRect { | ||
|
@@ -42,11 +37,11 @@ export const createSpatialTree = <T extends TextAnnotation>(store: Store<T>, con | |
return Array.from(revivedRange.getClientRects()); | ||
}); | ||
|
||
/** | ||
* Offset the merged client rects so that coords | ||
* are relative to the parent container | ||
*/ | ||
const merged = mergeClientRects(rects).map(rect => normalizeRectWithOffset(rect, offset)); | ||
const merged = mergeClientRects(rects) | ||
// Offset the merged client rects so that coords | ||
// are relative to the parent container | ||
.map(({ left, top, right, bottom }) => | ||
new DOMRect(left - offset.left, top - offset.top, right - left, bottom - top)); | ||
This comment has been minimized.
Sorry, something went wrong.
oleksandr-danylchenko
Contributor
|
||
|
||
return merged.map(rect => { | ||
const { x, y, width, height } = rect; | ||
|
This file was deleted.
Oops, something went wrong.
2 comments
on commit 945c09d
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
UPD: Reverted this commit in #182
That's a breaking change for the consumers ⚠
We relied on the exported
denormalizeRectWithOffset
in our custom popup component. I don't think that we should co-locate it with the popup.