Skip to content

Commit b59be1d

Browse files
committed
pull transition constants into own file, lower duration to 750ms
1 parent 1258f2d commit b59be1d

File tree

3 files changed

+20
-6
lines changed

3 files changed

+20
-6
lines changed

src/traces/sunburst/constants.js

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
/**
2+
* Copyright 2012-2019, Plotly, Inc.
3+
* All rights reserved.
4+
*
5+
* This source code is licensed under the MIT license found in the
6+
* LICENSE file in the root directory of this source tree.
7+
*/
8+
9+
'use strict';
10+
11+
module.exports = {
12+
CLICK_TRANSITION_TIME: 750,
13+
CLICK_TRANSITION_EASING: 'linear'
14+
};

src/traces/sunburst/plot.js

+4-5
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,7 @@ var transformInsideText = require('../pie/plot').transformInsideText;
2525
var formatPieValue = require('../pie/helpers').formatPieValue;
2626
var styleOne = require('./style').styleOne;
2727

28-
var CLICK_TRANSITION_TIME = 1000;
29-
var CLICK_TRANSITION_EASING = 'linear'; // TODO or something else?
28+
var constants = require('./constants');
3029

3130
module.exports = function(gd, cdmodule, transitionOpts, makeOnCompleteCallback) {
3231
var fullLayout = gd._fullLayout;
@@ -682,11 +681,11 @@ function attachFxHandlers(sliceTop, gd, cd) {
682681
var animOpts = {
683682
frame: {
684683
redraw: false,
685-
duration: CLICK_TRANSITION_TIME
684+
duration: constants.CLICK_TRANSITION_TIME
686685
},
687686
transition: {
688-
duration: CLICK_TRANSITION_TIME,
689-
easing: CLICK_TRANSITION_EASING
687+
duration: constants.CLICK_TRANSITION_TIME,
688+
easing: constants.CLICK_TRANSITION_EASING
690689
},
691690
mode: 'immediate',
692691
fromcurrent: true

test/jasmine/tests/sunburst_test.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
var Plotly = require('@lib');
22
var Plots = require('@src/plots/plots');
33
var Lib = require('@src/lib');
4+
var constants = require('@src/traces/sunburst/constants');
45

56
var d3 = require('d3');
67
var supplyAllDefaults = require('../assets/supply_defaults');
@@ -888,7 +889,7 @@ describe('Test sunburst tweening:', function() {
888889
click(gd, v)();
889890

890891
// 1 second more than the click transition duration
891-
return delay(1001);
892+
return delay(constants.CLICK_TRANSITION_TIME + 1);
892893
}
893894

894895
function trim(s) {

0 commit comments

Comments
 (0)