Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
Mirador annotations
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
Show more breadcrumbs
Loïs Poujade
Mirador annotations
Commits
330c488b
Commit
330c488b
authored
May 14, 2020
by
Jack Reed
Browse files
Options
Downloads
Patches
Plain Diff
Add cursor tool and enable multi-polygon annos
parent
6e46543f
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/AnnotationCreation.js
+62
-30
62 additions, 30 deletions
src/AnnotationCreation.js
src/AnnotationDrawing.js
+4
-5
4 additions, 5 deletions
src/AnnotationDrawing.js
src/icons/Cursor.js
+24
-0
24 additions, 0 deletions
src/icons/Cursor.js
with
90 additions
and
35 deletions
src/AnnotationCreation.js
+
62
−
30
View file @
330c488b
...
@@ -13,19 +13,22 @@ import FormatColorFillIcon from '@material-ui/icons/FormatColorFill';
...
@@ -13,19 +13,22 @@ import FormatColorFillIcon from '@material-ui/icons/FormatColorFill';
import
StrokeColorIcon
from
'
@material-ui/icons/BorderColor
'
;
import
StrokeColorIcon
from
'
@material-ui/icons/BorderColor
'
;
import
ArrowDropDownIcon
from
'
@material-ui/icons/ArrowDropDown
'
;
import
ArrowDropDownIcon
from
'
@material-ui/icons/ArrowDropDown
'
;
import
Popover
from
'
@material-ui/core/Popover
'
;
import
Popover
from
'
@material-ui/core/Popover
'
;
import
Divider
from
'
@material-ui/core/Divider
'
;
import
{
SketchPicker
}
from
'
react-color
'
;
import
{
SketchPicker
}
from
'
react-color
'
;
import
{
v4
as
uuid
}
from
'
uuid
'
;
import
{
v4
as
uuid
}
from
'
uuid
'
;
import
{
withStyles
}
from
'
@material-ui/core/styles
'
;
import
{
withStyles
}
from
'
@material-ui/core/styles
'
;
import
AnnotationDrawing
from
'
./AnnotationDrawing
'
;
import
AnnotationDrawing
from
'
./AnnotationDrawing
'
;
import
TextEditor
from
'
./TextEditor
'
;
import
TextEditor
from
'
./TextEditor
'
;
import
WebAnnotation
from
'
./WebAnnotation
'
;
import
WebAnnotation
from
'
./WebAnnotation
'
;
import
CursorIcon
from
'
./icons/Cursor
'
;
/** */
/** */
class
AnnotationCreation
extends
Component
{
class
AnnotationCreation
extends
Component
{
/** */
/** */
constructor
(
props
)
{
constructor
(
props
)
{
super
(
props
);
super
(
props
);
this
.
state
=
{
this
.
state
=
{
activeTool
:
null
,
activeTool
:
'
cursor
'
,
annoBody
:
''
,
annoBody
:
''
,
colorPopoverOpen
:
false
,
colorPopoverOpen
:
false
,
currentColorType
:
false
,
currentColorType
:
false
,
...
@@ -123,7 +126,6 @@ class AnnotationCreation extends Component {
...
@@ -123,7 +126,6 @@ class AnnotationCreation extends Component {
}
=
this
.
state
;
}
=
this
.
state
;
return
(
return
(
<
Paper
className
=
{
classes
.
root
}
>
<
Paper
className
=
{
classes
.
root
}
>
{
activeTool
&&
(
<
AnnotationDrawing
<
AnnotationDrawing
activeTool
=
{
activeTool
}
activeTool
=
{
activeTool
}
fillColor
=
{
fillColor
}
fillColor
=
{
fillColor
}
...
@@ -131,7 +133,6 @@ class AnnotationCreation extends Component {
...
@@ -131,7 +133,6 @@ class AnnotationCreation extends Component {
updateGeometry
=
{
this
.
updateGeometry
}
updateGeometry
=
{
this
.
updateGeometry
}
windowId
=
{
windowId
}
windowId
=
{
windowId
}
/
>
/
>
)}
<
form
onSubmit
=
{
this
.
submitForm
}
>
<
form
onSubmit
=
{
this
.
submitForm
}
>
<
Grid
container
>
<
Grid
container
>
<
Grid
item
xs
=
{
12
}
>
<
Grid
item
xs
=
{
12
}
>
...
@@ -140,7 +141,22 @@ class AnnotationCreation extends Component {
...
@@ -140,7 +141,22 @@ class AnnotationCreation extends Component {
<
/Typography
>
<
/Typography
>
<
/Grid
>
<
/Grid
>
<
Grid
item
xs
=
{
12
}
>
<
Grid
item
xs
=
{
12
}
>
<
Paper
elevation
=
{
0
}
className
=
{
classes
.
paper
}
>
<
ToggleButtonGroup
className
=
{
classes
.
grouped
}
value
=
{
activeTool
}
exclusive
onChange
=
{
this
.
changeTool
}
aria
-
label
=
"
tool selection
"
size
=
"
small
"
>
<
ToggleButton
value
=
"
cursor
"
aria
-
label
=
"
select cursor
"
>
<
CursorIcon
/>
<
/ToggleButton
>
<
/ToggleButtonGroup
>
<
Divider
flexItem
orientation
=
"
vertical
"
className
=
{
classes
.
divider
}
/
>
<
ToggleButtonGroup
<
ToggleButtonGroup
className
=
{
classes
.
grouped
}
value
=
{
activeTool
}
value
=
{
activeTool
}
exclusive
exclusive
onChange
=
{
this
.
changeTool
}
onChange
=
{
this
.
changeTool
}
...
@@ -157,6 +173,7 @@ class AnnotationCreation extends Component {
...
@@ -157,6 +173,7 @@ class AnnotationCreation extends Component {
<
PolygonIcon
/>
<
PolygonIcon
/>
<
/ToggleButton
>
<
/ToggleButton
>
<
/ToggleButtonGroup
>
<
/ToggleButtonGroup
>
<
/Paper
>
<
/Grid
>
<
/Grid
>
<
/Grid
>
<
/Grid
>
<
Grid
container
>
<
Grid
container
>
...
@@ -226,6 +243,23 @@ class AnnotationCreation extends Component {
...
@@ -226,6 +243,23 @@ class AnnotationCreation extends Component {
/** */
/** */
const
styles
=
(
theme
)
=>
({
const
styles
=
(
theme
)
=>
({
divider
:
{
margin
:
theme
.
spacing
(
1
,
0.5
),
},
grouped
:
{
'
&:first-child
'
:
{
borderRadius
:
theme
.
shape
.
borderRadius
,
},
'
&:not(:first-child)
'
:
{
borderRadius
:
theme
.
shape
.
borderRadius
,
},
border
:
'
none
'
,
margin
:
theme
.
spacing
(
0.5
),
},
paper
:
{
display
:
'
flex
'
,
flexWrap
:
'
wrap
'
,
},
root
:
{
root
:
{
padding
:
theme
.
spacing
(
1
),
padding
:
theme
.
spacing
(
1
),
},
},
...
@@ -235,9 +269,7 @@ AnnotationCreation.propTypes = {
...
@@ -235,9 +269,7 @@ AnnotationCreation.propTypes = {
canvases
:
PropTypes
.
arrayOf
(
canvases
:
PropTypes
.
arrayOf
(
PropTypes
.
shape
({
id
:
PropTypes
.
string
,
index
:
PropTypes
.
number
}),
PropTypes
.
shape
({
id
:
PropTypes
.
string
,
index
:
PropTypes
.
number
}),
),
),
classes
:
PropTypes
.
shape
({
classes
:
PropTypes
.
object
.
isRequired
,
// eslint-disable-line react/forbid-prop-types
root
:
PropTypes
.
string
,
}).
isRequired
,
config
:
PropTypes
.
shape
({
config
:
PropTypes
.
shape
({
annotation
:
PropTypes
.
shape
({
annotation
:
PropTypes
.
shape
({
adapter
:
PropTypes
.
func
,
adapter
:
PropTypes
.
func
,
...
...
This diff is collapsed.
Click to expand it.
src/AnnotationDrawing.js
+
4
−
5
View file @
330c488b
...
@@ -24,17 +24,16 @@ class AnnotationDrawing extends Component {
...
@@ -24,17 +24,16 @@ class AnnotationDrawing extends Component {
/** */
/** */
addPath
(
path
)
{
addPath
(
path
)
{
const
{
strokeWidth
,
updateGeometry
}
=
this
.
props
;
const
{
strokeWidth
,
updateGeometry
}
=
this
.
props
;
// TODO: Compute xywh of bounding container of layers
const
{
bounds
}
=
path
;
const
{
bounds
}
=
path
;
const
{
const
{
x
,
y
,
width
,
height
,
x
,
y
,
width
,
height
,
}
=
bounds
;
}
=
bounds
;
// Reset strokeWidth for persistence
// Reset strokeWidth for persistence
const
pathClone
=
path
.
clone
();
path
.
strokeWidth
=
strokeWidth
;
// eslint-disable-line no-param-reassign
pathClone
.
strokeWidth
=
strokeWidth
;
// eslint-disable-line no-param-reassign
updateGeometry
({
updateGeometry
({
svg
:
path
Clone
.
exportSVG
({
svg
:
path
.
project
.
exportSVG
({
asString
:
true
,
asString
:
true
,
}),
}),
xywh
:
[
xywh
:
[
...
@@ -52,7 +51,7 @@ class AnnotationDrawing extends Component {
...
@@ -52,7 +51,7 @@ class AnnotationDrawing extends Component {
const
{
const
{
activeTool
,
fillColor
,
strokeColor
,
strokeWidth
,
activeTool
,
fillColor
,
strokeColor
,
strokeWidth
,
}
=
this
.
props
;
}
=
this
.
props
;
if
(
!
activeTool
)
return
null
;
if
(
!
activeTool
||
activeTool
===
'
cursor
'
)
return
null
;
// Setup Paper View to have the same center and zoom as the OSD Viewport
// Setup Paper View to have the same center and zoom as the OSD Viewport
const
viewportZoom
=
this
.
OSDReference
.
viewer
.
viewport
.
getZoom
(
true
);
const
viewportZoom
=
this
.
OSDReference
.
viewer
.
viewport
.
getZoom
(
true
);
const
image1
=
this
.
OSDReference
.
viewer
.
world
.
getItemAt
(
0
);
const
image1
=
this
.
OSDReference
.
viewer
.
world
.
getItemAt
(
0
);
...
...
This diff is collapsed.
Click to expand it.
src/icons/Cursor.js
0 → 100644
+
24
−
0
View file @
330c488b
import
React
from
'
react
'
;
import
SvgIcon
from
'
@material-ui/core/SvgIcon
'
;
/**
* CursorIcon ~
*/
export
default
function
CursorIcon
(
props
)
{
return
(
// eslint-disable-next-line react/jsx-props-no-spreading
<
SvgIcon
{...
props
}
>
<
svg
version
=
"
1.1
"
xmlns
=
"
http://www.w3.org/2000/svg
"
x
=
"
0px
"
y
=
"
0px
"
viewBox
=
"
1064.7701 445.5539 419.8101 717.0565
"
enableBackground
=
"
new 1064.7701 445.5539 419.8101 717.0565
"
xmlSpace
=
"
preserve
"
>
<
polygon
fill
=
"
#231F20
"
points
=
"
1283.1857,1127.3097 1406.1421,1077.6322 1314.2406,850.1678 1463.913,852.7823 1093.4828,480.8547 1085.4374,1005.6964 1191.2842,899.8454
"
/>
<
/svg
>
<
/SvgIcon
>
);
}
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
register
or
sign in
to comment