Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Mirador Video
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This project is archived. Its data is
read-only
.
Show more breadcrumbs
IIIF
Mirador
Mirador Video
Commits
6eeb8796
Commit
6eeb8796
authored
Apr 18, 2019
by
Jessie Keck
Browse files
Options
Downloads
Patches
Plain Diff
Rename annotation mouse enter/leave functions and use them on focus/blur too.
parent
bd15e7ef
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
__tests__/src/components/CanvasAnnotations.test.js
+18
-0
18 additions, 0 deletions
__tests__/src/components/CanvasAnnotations.test.js
src/components/CanvasAnnotations.js
+8
-6
8 additions, 6 deletions
src/components/CanvasAnnotations.js
with
26 additions
and
6 deletions
__tests__/src/components/CanvasAnnotations.test.js
+
18
−
0
View file @
6eeb8796
...
...
@@ -132,6 +132,24 @@ describe('CanvasAnnotations', () => {
expect
(
highlightAnnotation
).
toHaveBeenCalledWith
(
'
abc
'
,
'
annoId
'
);
});
it
(
'
highlights annotations on focus
'
,
()
=>
{
const
highlightAnnotation
=
jest
.
fn
();
wrapper
=
createWrapper
({
annotations
:
[
{
content
:
'
Annotation
'
,
id
:
'
annoId
'
,
targetId
:
'
example.com/iiif/12345
'
,
},
],
highlightAnnotation
,
});
wrapper
.
find
(
'
WithStyles(ListItem)
'
).
first
().
simulate
(
'
focus
'
);
expect
(
highlightAnnotation
).
toHaveBeenCalledWith
(
'
abc
'
,
'
annoId
'
);
});
it
(
'
sets the highlighted annotation to null on mouse leave
'
,
()
=>
{
const
highlightAnnotation
=
jest
.
fn
();
...
...
...
...
This diff is collapsed.
Click to expand it.
src/components/CanvasAnnotations.js
+
8
−
6
View file @
6eeb8796
...
...
@@ -17,8 +17,8 @@ export class CanvasAnnotations extends Component {
super
(
props
);
this
.
handleClick
=
this
.
handleClick
.
bind
(
this
);
this
.
handle
MouseEnter
=
this
.
handleMouseEnter
.
bind
(
this
);
this
.
handle
MouseLeave
=
this
.
handleMouseLeave
.
bind
(
this
);
this
.
handle
AnnotationHighlight
=
this
.
handleAnnotationHighlight
.
bind
(
this
);
this
.
handle
AnnotationUnHighlight
=
this
.
handleAnnotationUnHighlight
.
bind
(
this
);
}
/**
...
...
@@ -37,7 +37,7 @@ export class CanvasAnnotations extends Component {
}
/** */
handle
MouseEnter
(
annotation
)
{
handle
AnnotationHighlight
(
annotation
)
{
const
{
allAnnotationsAreHighlighted
,
highlightAnnotation
,
windowId
}
=
this
.
props
;
if
(
allAnnotationsAreHighlighted
)
return
;
...
...
@@ -45,7 +45,7 @@ export class CanvasAnnotations extends Component {
}
/** */
handle
MouseLeave
()
{
handle
AnnotationUnHighlight
()
{
const
{
allAnnotationsAreHighlighted
,
highlightAnnotation
,
windowId
}
=
this
.
props
;
if
(
allAnnotationsAreHighlighted
)
return
;
...
...
@@ -76,8 +76,10 @@ export class CanvasAnnotations extends Component {
key
=
{
annotation
.
id
}
selected
=
{
selectedAnnotationIds
.
includes
(
annotation
.
id
)}
onClick
=
{
e
=>
this
.
handleClick
(
e
,
annotation
)}
onMouseEnter
=
{()
=>
this
.
handleMouseEnter
(
annotation
)}
onMouseLeave
=
{()
=>
this
.
handleMouseLeave
(
annotation
)}
onFocus
=
{()
=>
this
.
handleAnnotationHighlight
(
annotation
)}
onBlur
=
{
this
.
handleAnnotationUnHighlight
}
onMouseEnter
=
{()
=>
this
.
handleAnnotationHighlight
(
annotation
)}
onMouseLeave
=
{
this
.
handleAnnotationUnHighlight
}
>
<
ListItemText
primaryTypographyProps
=
{{
variant
:
'
body2
'
}}
>
<
SanitizedHtml
ruleSet
=
"
iiif
"
htmlString
=
{
annotation
.
content
}
/
>
...
...
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
sign in
to comment