@@ -20,6 +20,7 @@ var splitData = require('./data_split_helpers');
20
20
var Color = require ( '../../components/color' ) ;
21
21
22
22
module . exports = function plot ( gd , wrappedTraceHolders ) {
23
+ var dynamic = ! gd . _context . staticPlot ;
23
24
24
25
var table = gd . _fullLayout . _paper . selectAll ( '.' + c . cn . table )
25
26
. data ( wrappedTraceHolders . map ( function ( wrappedTraceHolder ) {
@@ -51,22 +52,30 @@ module.exports = function plot(gd, wrappedTraceHolders) {
51
52
var tableControlView = table . selectAll ( '.' + c . cn . tableControlView )
52
53
. data ( gup . repeat , gup . keyFun ) ;
53
54
54
- tableControlView . enter ( )
55
+ var cvEnter = tableControlView . enter ( )
55
56
. append ( 'g' )
56
57
. classed ( c . cn . tableControlView , true )
57
- . style ( 'box-sizing' , 'content-box' )
58
- . on ( 'mousemove' , function ( d ) { tableControlView . filter ( function ( dd ) { return d === dd ; } ) . call ( renderScrollbarKit , gd ) ; } )
59
- . on ( 'mousewheel' , function ( d ) {
60
- if ( d . scrollbarState . wheeling ) return ;
61
- d . scrollbarState . wheeling = true ;
62
- var noChange = makeDragRow ( gd , tableControlView , null , d . scrollY + d3 . event . deltaY ) ( d ) ;
63
- if ( ! noChange ) {
64
- d3 . event . stopPropagation ( ) ;
65
- d3 . event . preventDefault ( ) ;
66
- }
67
- d . scrollbarState . wheeling = false ;
68
- } )
69
- . call ( renderScrollbarKit , gd , true ) ;
58
+ . style ( 'box-sizing' , 'content-box' ) ;
59
+ if ( dynamic ) {
60
+ cvEnter
61
+ . on ( 'mousemove' , function ( d ) {
62
+ tableControlView
63
+ . filter ( function ( dd ) { return d === dd ; } )
64
+ . call ( renderScrollbarKit , gd ) ;
65
+ } )
66
+ . on ( 'mousewheel' , function ( d ) {
67
+ if ( d . scrollbarState . wheeling ) return ;
68
+ d . scrollbarState . wheeling = true ;
69
+ var newY = d . scrollY + d3 . event . deltaY ;
70
+ var noChange = makeDragRow ( gd , tableControlView , null , newY ) ( d ) ;
71
+ if ( ! noChange ) {
72
+ d3 . event . stopPropagation ( ) ;
73
+ d3 . event . preventDefault ( ) ;
74
+ }
75
+ d . scrollbarState . wheeling = false ;
76
+ } )
77
+ . call ( renderScrollbarKit , gd , true ) ;
78
+ }
70
79
71
80
tableControlView
72
81
. attr ( 'transform' , function ( d ) { return 'translate(' + d . size . l + ' ' + d . size . t + ')' ; } ) ;
@@ -98,9 +107,10 @@ module.exports = function plot(gd, wrappedTraceHolders) {
98
107
99
108
yColumn . exit ( ) . remove ( ) ;
100
109
101
- yColumn
102
- . attr ( 'transform' , function ( d ) { return 'translate(' + d . x + ' 0)' ; } )
103
- . call ( d3 . behavior . drag ( )
110
+ yColumn . attr ( 'transform' , function ( d ) { return 'translate(' + d . x + ' 0)' ; } ) ;
111
+
112
+ if ( dynamic ) {
113
+ yColumn . call ( d3 . behavior . drag ( )
104
114
. origin ( function ( d ) {
105
115
var movedColumn = d3 . select ( this ) ;
106
116
easeColumn ( movedColumn , d , - c . uplift ) ;
@@ -139,6 +149,7 @@ module.exports = function plot(gd, wrappedTraceHolders) {
139
149
columnMoved ( gd , p , p . columns . map ( function ( dd ) { return dd . xIndex ; } ) ) ;
140
150
} )
141
151
) ;
152
+ }
142
153
143
154
yColumn . each ( function ( d ) {
144
155
Drawing . setClipUrl ( d3 . select ( this ) , columnBoundaryClipKey ( gd , d ) , gd ) ;
@@ -160,8 +171,8 @@ module.exports = function plot(gd, wrappedTraceHolders) {
160
171
var headerColumnBlock = columnBlock . filter ( headerBlock ) ;
161
172
var cellsColumnBlock = columnBlock . filter ( cellsBlock ) ;
162
173
163
- cellsColumnBlock
164
- . call ( d3 . behavior . drag ( )
174
+ if ( dynamic ) {
175
+ cellsColumnBlock . call ( d3 . behavior . drag ( )
165
176
. origin ( function ( d ) {
166
177
d3 . event . stopPropagation ( ) ;
167
178
return d ;
@@ -171,6 +182,7 @@ module.exports = function plot(gd, wrappedTraceHolders) {
171
182
// fixme emit plotly notification
172
183
} )
173
184
) ;
185
+ }
174
186
175
187
// initial rendering: header is rendered first, as it may may have async LaTeX (show header first)
176
188
// but blocks are _entered_ the way they are due to painter's algo (header on top)
0 commit comments