Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
coopwire-hypothesis
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
孙灵跃 Leon Sun
coopwire-hypothesis
Commits
8a0d63a7
Commit
8a0d63a7
authored
Aug 04, 2020
by
Robert Knight
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix typechecking errors in src/annotator/adder.js
parent
092689e1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
7 deletions
+15
-7
adder.js
src/annotator/adder.js
+15
-7
No files found.
src/annotator/adder.js
View file @
8a0d63a7
...
...
@@ -41,7 +41,7 @@ const ARROW_H_MARGIN = 20;
* @return {Element}
*/
function
nearestPositionedAncestor
(
el
)
{
let
parentEl
=
el
.
parentElement
;
let
parentEl
=
/** @type {Element} */
(
el
.
parentElement
)
;
while
(
parentEl
.
parentElement
)
{
if
(
getComputedStyle
(
parentEl
).
position
!==
'static'
)
{
break
;
...
...
@@ -95,15 +95,23 @@ export class Adder {
zIndex
:
999
,
});
this
.
_view
=
container
.
ownerDocument
.
defaultView
;
this
.
_view
=
/** @type {Window} */
(
container
.
ownerDocument
.
defaultView
)
;
this
.
_width
=
()
=>
this
.
_shadowRoot
.
firstChild
.
getBoundingClientRect
().
width
;
this
.
_height
=
()
=>
this
.
_shadowRoot
.
firstChild
.
getBoundingClientRect
().
height
;
this
.
_width
=
()
=>
{
const
firstChild
=
/** @type {Element} */
(
this
.
_shadowRoot
.
firstChild
);
return
firstChild
.
getBoundingClientRect
().
width
;
};
this
.
_height
=
()
=>
{
const
firstChild
=
/** @type {Element} */
(
this
.
_shadowRoot
.
firstChild
);
return
firstChild
.
getBoundingClientRect
().
height
;
};
this
.
_isVisible
=
false
;
/** @type {'up'|'down'} */
this
.
_arrowDirection
=
'up'
;
this
.
_onAnnotate
=
options
.
onAnnotate
;
this
.
_onHighlight
=
options
.
onHighlight
;
this
.
_onShowAnnotations
=
options
.
onShowAnnotations
;
...
...
@@ -130,7 +138,7 @@ export class Adder {
* Return the best position to show the adder in order to target the
* selected text in `targetRect`.
*
* @param {Rect} targetRect - The rect of text to target, in viewport
* @param {
DOM
Rect} targetRect - The rect of text to target, in viewport
* coordinates.
* @param {boolean} isSelectionBackwards - True if the selection was made
* backwards, such that the focus point is mosty likely at the top-left
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment