10
10
'use strict' ;
11
11
12
12
var Lib = require ( '../../lib' ) ;
13
- var Color = require ( '../color' ) ;
14
13
var Axes = require ( '../../plots/cartesian/axes' ) ;
15
-
14
+ var handleAnnotationCommonDefaults = require ( './common_defaults' ) ;
16
15
var attributes = require ( './attributes' ) ;
17
16
18
17
@@ -29,26 +28,9 @@ module.exports = function handleAnnotationDefaults(annIn, annOut, fullLayout, op
29
28
30
29
if ( ! ( visible || clickToShow ) ) return annOut ;
31
30
32
- coerce ( 'opacity' ) ;
33
- var bgColor = coerce ( 'bgcolor' ) ;
34
-
35
- var borderColor = coerce ( 'bordercolor' ) ,
36
- borderOpacity = Color . opacity ( borderColor ) ;
37
-
38
- coerce ( 'borderpad' ) ;
39
-
40
- var borderWidth = coerce ( 'borderwidth' ) ;
41
- var showArrow = coerce ( 'showarrow' ) ;
42
-
43
- coerce ( 'text' , showArrow ? ' ' : 'new text' ) ;
44
- coerce ( 'textangle' ) ;
45
- Lib . coerceFont ( coerce , 'font' , fullLayout . font ) ;
46
-
47
- coerce ( 'width' ) ;
48
- coerce ( 'align' ) ;
31
+ handleAnnotationCommonDefaults ( annIn , annOut , fullLayout , coerce ) ;
49
32
50
- var h = coerce ( 'height' ) ;
51
- if ( h ) coerce ( 'valign' ) ;
33
+ var showArrow = annOut . showarrow ;
52
34
53
35
// positioning
54
36
var axLetters = [ 'x' , 'y' ] ,
@@ -90,14 +72,8 @@ module.exports = function handleAnnotationDefaults(annIn, annOut, fullLayout, op
90
72
// if you have one coordinate you should have both
91
73
Lib . noneOrAll ( annIn , annOut , [ 'x' , 'y' ] ) ;
92
74
75
+ // if you have one part of arrow length you should have both
93
76
if ( showArrow ) {
94
- coerce ( 'arrowcolor' , borderOpacity ? annOut . bordercolor : Color . defaultLine ) ;
95
- coerce ( 'arrowhead' ) ;
96
- coerce ( 'arrowsize' ) ;
97
- coerce ( 'arrowwidth' , ( ( borderOpacity && borderWidth ) || 1 ) * 2 ) ;
98
- coerce ( 'standoff' ) ;
99
-
100
- // if you have one part of arrow length you should have both
101
77
Lib . noneOrAll ( annIn , annOut , [ 'ax' , 'ay' ] ) ;
102
78
}
103
79
@@ -111,25 +87,5 @@ module.exports = function handleAnnotationDefaults(annIn, annOut, fullLayout, op
111
87
annOut . _yclick = ( yClick === undefined ) ? annOut . y : yClick ;
112
88
}
113
89
114
- var hoverText = coerce ( 'hovertext' ) ;
115
- var globalHoverLabel = fullLayout . hoverlabel || { } ;
116
-
117
- if ( hoverText ) {
118
- var hoverBG = coerce ( 'hoverlabel.bgcolor' , globalHoverLabel . bgcolor ||
119
- ( Color . opacity ( bgColor ) ? Color . rgb ( bgColor ) : Color . defaultLine )
120
- ) ;
121
-
122
- var hoverBorder = coerce ( 'hoverlabel.bordercolor' , globalHoverLabel . bordercolor ||
123
- Color . contrast ( hoverBG )
124
- ) ;
125
-
126
- Lib . coerceFont ( coerce , 'hoverlabel.font' , {
127
- family : globalHoverLabel . font . family ,
128
- size : globalHoverLabel . font . size ,
129
- color : globalHoverLabel . font . color || hoverBorder
130
- } ) ;
131
- }
132
- coerce ( 'captureevents' , ! ! hoverText ) ;
133
-
134
90
return annOut ;
135
91
} ;
0 commit comments