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
495e4e2e
Commit
495e4e2e
authored
Apr 06, 2018
by
Robert Knight
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make `enterTimeout` and `container` instance properties
parent
d1908496
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
6 deletions
+7
-6
adder.js
src/annotator/adder.js
+7
-6
No files found.
src/annotator/adder.js
View file @
495e4e2e
...
@@ -132,6 +132,7 @@ class Adder {
...
@@ -132,6 +132,7 @@ class Adder {
*/
*/
constructor
(
container
,
options
)
{
constructor
(
container
,
options
)
{
this
.
element
=
createAdderDOM
(
container
);
this
.
element
=
createAdderDOM
(
container
);
this
.
_container
=
container
;
// Set initial style
// Set initial style
Object
.
assign
(
container
.
style
,
{
Object
.
assign
(
container
.
style
,
{
...
@@ -151,7 +152,7 @@ class Adder {
...
@@ -151,7 +152,7 @@ class Adder {
this
.
element
.
style
.
visibility
=
'hidden'
;
this
.
element
.
style
.
visibility
=
'hidden'
;
var
view
=
this
.
element
.
ownerDocument
.
defaultView
;
var
view
=
this
.
element
.
ownerDocument
.
defaultView
;
var
enterTimeout
;
this
.
_enterTimeout
=
null
;
var
handleCommand
=
(
event
)
=>
{
var
handleCommand
=
(
event
)
=>
{
event
.
preventDefault
();
event
.
preventDefault
();
...
@@ -178,7 +179,7 @@ class Adder {
...
@@ -178,7 +179,7 @@ class Adder {
/** Hide the adder */
/** Hide the adder */
this
.
hide
=
()
=>
{
this
.
hide
=
()
=>
{
clearTimeout
(
enterTimeout
);
clearTimeout
(
this
.
_
enterTimeout
);
this
.
element
.
className
=
classnames
({
'annotator-adder'
:
true
});
this
.
element
.
className
=
classnames
({
'annotator-adder'
:
true
});
this
.
element
.
style
.
visibility
=
'hidden'
;
this
.
element
.
style
.
visibility
=
'hidden'
;
};
};
...
@@ -268,17 +269,17 @@ class Adder {
...
@@ -268,17 +269,17 @@ class Adder {
// Typically the adder is a child of the `<body>` and the NPA is the root
// Typically the adder is a child of the `<body>` and the NPA is the root
// `<html>` element. However page styling may make the `<body>` positioned.
// `<html>` element. However page styling may make the `<body>` positioned.
// See https://github.com/hypothesis/client/issues/487.
// See https://github.com/hypothesis/client/issues/487.
var
positionedAncestor
=
nearestPositionedAncestor
(
container
);
var
positionedAncestor
=
nearestPositionedAncestor
(
this
.
_
container
);
var
parentRect
=
positionedAncestor
.
getBoundingClientRect
();
var
parentRect
=
positionedAncestor
.
getBoundingClientRect
();
Object
.
assign
(
container
.
style
,
{
Object
.
assign
(
this
.
_
container
.
style
,
{
top
:
toPx
(
top
-
parentRect
.
top
),
top
:
toPx
(
top
-
parentRect
.
top
),
left
:
toPx
(
left
-
parentRect
.
left
),
left
:
toPx
(
left
-
parentRect
.
left
),
});
});
this
.
element
.
style
.
visibility
=
'visible'
;
this
.
element
.
style
.
visibility
=
'visible'
;
clearTimeout
(
enterTimeout
);
clearTimeout
(
this
.
_
enterTimeout
);
enterTimeout
=
setTimeout
(()
=>
{
this
.
_
enterTimeout
=
setTimeout
(()
=>
{
this
.
element
.
className
+=
' is-active'
;
this
.
element
.
className
+=
' is-active'
;
},
1
);
},
1
);
};
};
...
...
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