Skip to content

Commit

Permalink
pull transition constants into own file, lower duration to 750ms
Browse files Browse the repository at this point in the history
  • Loading branch information
etpinard committed Mar 28, 2019
1 parent 1258f2d commit b59be1d
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 6 deletions.
14 changes: 14 additions & 0 deletions src/traces/sunburst/constants.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/**
* Copyright 2012-2019, Plotly, Inc.
* All rights reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/

'use strict';

module.exports = {
CLICK_TRANSITION_TIME: 750,
CLICK_TRANSITION_EASING: 'linear'
};
9 changes: 4 additions & 5 deletions src/traces/sunburst/plot.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@ var transformInsideText = require('../pie/plot').transformInsideText;
var formatPieValue = require('../pie/helpers').formatPieValue;
var styleOne = require('./style').styleOne;

var CLICK_TRANSITION_TIME = 1000;
var CLICK_TRANSITION_EASING = 'linear'; // TODO or something else?
var constants = require('./constants');

module.exports = function(gd, cdmodule, transitionOpts, makeOnCompleteCallback) {
var fullLayout = gd._fullLayout;
Expand Down Expand Up @@ -682,11 +681,11 @@ function attachFxHandlers(sliceTop, gd, cd) {
var animOpts = {
frame: {
redraw: false,
duration: CLICK_TRANSITION_TIME
duration: constants.CLICK_TRANSITION_TIME
},
transition: {
duration: CLICK_TRANSITION_TIME,
easing: CLICK_TRANSITION_EASING
duration: constants.CLICK_TRANSITION_TIME,
easing: constants.CLICK_TRANSITION_EASING
},
mode: 'immediate',
fromcurrent: true
Expand Down
3 changes: 2 additions & 1 deletion test/jasmine/tests/sunburst_test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
var Plotly = require('@lib');
var Plots = require('@src/plots/plots');
var Lib = require('@src/lib');
var constants = require('@src/traces/sunburst/constants');

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

// 1 second more than the click transition duration
return delay(1001);
return delay(constants.CLICK_TRANSITION_TIME + 1);
}

function trim(s) {
Expand Down

0 comments on commit b59be1d

Please sign in to comment.