File tree 6 files changed +29
-8
lines changed
6 files changed +29
-8
lines changed Original file line number Diff line number Diff line change @@ -32,8 +32,8 @@ var rules = {
32
32
"X .cursor-ne-resize" : "cursor:ne-resize;" ,
33
33
"X .cursor-grab" : "cursor:-webkit-grab;cursor:grab;" ,
34
34
"X .modebar" : "position:absolute;top:2px;right:2px;z-index:1001;" ,
35
- "X .modebar--hover" : "opacity:0;-webkit-transition:opacity 0.3s ease 0s;-moz-transition:opacity 0.3s ease 0s;-ms-transition:opacity 0.3s ease 0s;-o-transition:opacity 0.3s ease 0s;transition:opacity 0.3s ease 0s;" ,
36
- "X:hover .modebar--hover" : "opacity:1;" ,
35
+ "X .modebar--hover>:not(.watermark) " : "opacity:0;-webkit-transition:opacity 0.3s ease 0s;-moz-transition:opacity 0.3s ease 0s;-ms-transition:opacity 0.3s ease 0s;-o-transition:opacity 0.3s ease 0s;transition:opacity 0.3s ease 0s;" ,
36
+ "X:hover .modebar--hover .modebar-group " : "opacity:1;" ,
37
37
"X .modebar-group" : "float:left;display:inline-block;box-sizing:border-box;margin-left:8px;position:relative;vertical-align:middle;white-space:nowrap;" ,
38
38
"X .modebar-btn" : "position:relative;font-size:16px;padding:3px 4px;height:22px;cursor:pointer;line-height:normal;box-sizing:border-box;" ,
39
39
"X .modebar-btn svg" : "position:relative;top:2px;" ,
Original file line number Diff line number Diff line change @@ -29,7 +29,7 @@ module.exports = function manageModeBar(gd) {
29
29
context = gd . _context ,
30
30
modeBar = fullLayout . _modeBar ;
31
31
32
- if ( ! context . displayModeBar ) {
32
+ if ( ! context . displayModeBar && ! context . watermark ) {
33
33
if ( modeBar ) {
34
34
modeBar . destroy ( ) ;
35
35
delete fullLayout . _modeBar ;
@@ -57,6 +57,9 @@ module.exports = function manageModeBar(gd) {
57
57
if ( Array . isArray ( customButtons ) && customButtons . length ) {
58
58
buttonGroups = fillCustomButton ( customButtons ) ;
59
59
}
60
+ else if ( ! context . displayModeBar && context . watermark ) {
61
+ buttonGroups = [ ] ;
62
+ }
60
63
else {
61
64
buttonGroups = getButtonGroups (
62
65
gd ,
Original file line number Diff line number Diff line change @@ -80,11 +80,16 @@ proto.update = function(graphInfo, buttons) {
80
80
81
81
this . updateButtons ( buttons ) ;
82
82
83
- if ( context . displaylogo ) {
83
+ if ( context . watermark || context . displaylogo ) {
84
+ var logoGroup = this . getLogo ( ) ;
85
+ if ( context . watermark ) {
86
+ logoGroup . className = logoGroup . className + ' watermark' ;
87
+ }
88
+
84
89
if ( fullLayout . modebar . orientation === 'v' ) {
85
- this . element . prepend ( this . getLogo ( ) ) ;
90
+ this . element . prepend ( logoGroup ) ;
86
91
} else {
87
- this . element . appendChild ( this . getLogo ( ) ) ;
92
+ this . element . appendChild ( logoGroup ) ;
88
93
}
89
94
90
95
this . hasLogo = true ;
Original file line number Diff line number Diff line change 5
5
z-index : 1001 ;
6
6
}
7
7
8
- .modebar--hover {
8
+ .modebar--hover > :not ( .watermark ) {
9
9
opacity : 0 ;
10
10
@include vendor (' transition' , opacity 0.3s ease 0s );
11
11
}
12
12
13
- & :hover .modebar--hover {
13
+ & :hover .modebar--hover .modebar-group {
14
14
opacity : 1 ;
15
15
}
16
16
Original file line number Diff line number Diff line change @@ -133,6 +133,9 @@ module.exports = {
133
133
// add the plotly logo on the end of the mode bar
134
134
displaylogo : true ,
135
135
136
+ // watermark the images with the company's logo
137
+ watermark : false ,
138
+
136
139
// increase the pixel ratio for Gl plot images
137
140
plotGlPixelRatio : 2 ,
138
141
Original file line number Diff line number Diff line change @@ -756,6 +756,16 @@ describe('ModeBar', function() {
756
756
expect ( countLogo ( gd . _fullLayout . _modeBar ) ) . toEqual ( 0 ) ;
757
757
} ) ;
758
758
759
+ it ( 'always displays the logo if watermark config arg is true' , function ( ) {
760
+ var gd = getMockGraphInfo ( ) ;
761
+ gd . _context . displaylogo = false ;
762
+ gd . _context . displayModeBar = false ;
763
+ gd . _context . watermark = true ;
764
+ manageModeBar ( gd ) ;
765
+ expect ( countLogo ( gd . _fullLayout . _modeBar ) ) . toEqual ( 1 ) ;
766
+ expect ( countButtons ( gd . _fullLayout . _modeBar ) ) . toEqual ( 1 ) ;
767
+ } ) ;
768
+
759
769
// gives 11 buttons in 5 groups by default
760
770
function setupGraphInfo ( ) {
761
771
var gd = getMockGraphInfo ( [ 'x' ] , [ 'y' ] ) ;
You can’t perform that action at this time.
0 commit comments