Skip to content

Commit eb54f24

Browse files
committed
pass hover and transition options to fx
1 parent e23a577 commit eb54f24

File tree

4 files changed

+20
-9
lines changed

4 files changed

+20
-9
lines changed

src/traces/sunburst/fx.js

+6-6
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ var pieHelpers = require('../pie/helpers');
2121
var formatValue = pieHelpers.formatPieValue;
2222
var formatPercent = pieHelpers.formatPiePercent;
2323

24-
module.exports = function attachFxHandlers(sliceTop, entry, gd, cd, styleOne, constants) {
24+
module.exports = function attachFxHandlers(sliceTop, entry, gd, cd, opts) {
2525
var cd0 = cd[0];
2626
var trace = cd0.trace;
2727
var hierarchy = cd0.hierarchy;
@@ -180,7 +180,7 @@ module.exports = function attachFxHandlers(sliceTop, entry, gd, cd, styleOne, co
180180

181181
if(isTreemap) {
182182
var slice = sliceTop.select('path.surface');
183-
styleOne(slice, pt, traceNow, true);
183+
opts.styleOne(slice, pt, traceNow, true);
184184
}
185185

186186
trace._hasHoverEvent = true;
@@ -211,7 +211,7 @@ module.exports = function attachFxHandlers(sliceTop, entry, gd, cd, styleOne, co
211211

212212
if(isTreemap) {
213213
var slice = sliceTop.select('path.surface');
214-
styleOne(slice, pt, traceNow, false);
214+
opts.styleOne(slice, pt, traceNow, false);
215215
}
216216
};
217217

@@ -287,11 +287,11 @@ module.exports = function attachFxHandlers(sliceTop, entry, gd, cd, styleOne, co
287287
var animOpts = {
288288
frame: {
289289
redraw: false,
290-
duration: constants.CLICK_TRANSITION_TIME
290+
duration: opts.transitionTime
291291
},
292292
transition: {
293-
duration: constants.CLICK_TRANSITION_TIME,
294-
easing: constants.CLICK_TRANSITION_EASING
293+
duration: opts.transitionTime,
294+
easing: opts.transitionEasing
295295
},
296296
mode: 'immediate',
297297
fromcurrent: true

src/traces/sunburst/plot.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,10 @@ function plotOne(gd, cd, element, transitionOpts) {
228228
}
229229

230230
sliceTop
231-
.call(attachFxHandlers, entry, gd, cd, styleOne, constants)
231+
.call(attachFxHandlers, entry, gd, cd, {
232+
transitionTime: constants.CLICK_TRANSITION_TIME,
233+
transitonEasing: constants.CLICK_TRANSITION_EASING
234+
})
232235
.call(helpers.setSliceCursor, gd, {isTransitioning: gd._transitioning});
233236

234237
slicePath.call(styleOne, pt, trace);

src/traces/treemap/draw_ancestors.js

+5-1
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,11 @@ module.exports = function drawAncestors(gd, cd, entry, slices, opts) {
115115
}
116116

117117
sliceTop
118-
.call(attachFxHandlers, entry, gd, cd, styleOne, constants)
118+
.call(attachFxHandlers, entry, gd, cd, {
119+
styleOne: styleOne,
120+
transitionTime: constants.CLICK_TRANSITION_TIME,
121+
transitonEasing: constants.CLICK_TRANSITION_EASING
122+
})
119123
.call(helpers.setSliceCursor, gd, { isTransitioning: gd._transitioning });
120124

121125
slicePath.call(styleOne, pt, trace);

src/traces/treemap/draw_descendants.js

+5-1
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,11 @@ module.exports = function drawDescendants(gd, cd, entry, slices, opts) {
117117
}
118118

119119
sliceTop
120-
.call(attachFxHandlers, entry, gd, cd, styleOne, constants)
120+
.call(attachFxHandlers, entry, gd, cd, {
121+
styleOne: styleOne,
122+
transitionTime: constants.CLICK_TRANSITION_TIME,
123+
transitonEasing: constants.CLICK_TRANSITION_EASING
124+
})
121125
.call(helpers.setSliceCursor, gd, { isTransitioning: gd._transitioning });
122126

123127
slicePath.call(styleOne, pt, trace);

0 commit comments

Comments
 (0)