Skip to content

Commit c6a3e11

Browse files
committed
Rename sliders and bump circular require tolerance
1 parent ca5f9f5 commit c6a3e11

File tree

9 files changed

+17
-7
lines changed

9 files changed

+17
-7
lines changed
File renamed without changes.
File renamed without changes.
File renamed without changes.

src/components/slider/draw.js renamed to src/components/sliders/draw.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,6 @@ function findDimensions(gd, sliderOpts) {
155155
sliderOpts.labelStride = Math.max(1, Math.ceil(computedSpacePerLabel / availableSpacePerLabel));
156156
sliderOpts.labelHeight = labelHeight;
157157

158-
// Hard-code this for now:
159158
sliderOpts.height = constants.tickOffset + constants.tickLength + sliderOpts.labelHeight + sliderOpts.ypad * 2;
160159

161160
var xanchor = 'left';
@@ -205,6 +204,8 @@ function drawSlider(gd, sliderGroup, sliderOpts) {
205204
// Position the rectangle:
206205
Lib.setTranslate(sliderGroup, sliderOpts.lx + sliderOpts.xpad, sliderOpts.ly + sliderOpts.ypad);
207206

207+
// Every time the slider is draw from scratch, just detach and reattach the event listeners.
208+
// This could perhaps be avoided.
208209
removeListeners(gd, sliderGroup, sliderOpts);
209210
attachListeners(gd, sliderGroup, sliderOpts);
210211

src/components/slider/index.js renamed to src/components/sliders/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
exports.moduleType = 'component';
1313

14-
exports.name = 'slider';
14+
exports.name = 'sliders';
1515

1616
exports.layoutAttributes = require('./attributes');
1717

src/core.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ exports.register([
5858
require('./components/shapes'),
5959
require('./components/images'),
6060
require('./components/updatemenus'),
61-
require('./components/slider'),
61+
require('./components/sliders'),
6262
require('./components/rangeslider'),
6363
require('./components/rangeselector')
6464
]);

src/plot_api/plot_api.js

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ Plotly.plot = function(gd, data, layout, config) {
178178
Registry.getComponentMethod('legend', 'draw')(gd);
179179
Registry.getComponentMethod('rangeselector', 'draw')(gd);
180180
Registry.getComponentMethod('updatemenus', 'draw')(gd);
181-
Registry.getComponentMethod('slider', 'draw')(gd);
181+
Registry.getComponentMethod('sliders', 'draw')(gd);
182182

183183
for(i = 0; i < calcdata.length; i++) {
184184
cd = calcdata[i];
@@ -304,7 +304,7 @@ Plotly.plot = function(gd, data, layout, config) {
304304
Registry.getComponentMethod('rangeslider', 'draw')(gd);
305305
Registry.getComponentMethod('rangeselector', 'draw')(gd);
306306
Registry.getComponentMethod('updatemenus', 'draw')(gd);
307-
Registry.getComponentMethod('slider', 'draw')(gd);
307+
Registry.getComponentMethod('sliders', 'draw')(gd);
308308
}
309309

310310
function cleanUp() {
@@ -1946,6 +1946,15 @@ function _relayout(gd, aobj) {
19461946
for(i = 0; i < diff; i++) menus.push({});
19471947
flags.doplot = true;
19481948
}
1949+
else if(p.parts[0] === 'sliders') {
1950+
Lib.extendDeepAll(gd.layout, Lib.objectFromPath(ai, vi));
1951+
1952+
var sliders = gd._fullLayout.sliders || [];
1953+
diff = (p.parts[2] + 1) - sliders.length;
1954+
1955+
for(i = 0; i < diff; i++) sliders.push({});
1956+
flags.doplot = true;
1957+
}
19491958
// alter gd.layout
19501959
else {
19511960
// check whether we can short-circuit a full redraw

src/plotly.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ exports.Shapes = require('./components/shapes');
3737
exports.Legend = require('./components/legend');
3838
exports.Images = require('./components/images');
3939
exports.UpdateMenus = require('./components/updatemenus');
40-
exports.Slider = require('./components/slider');
40+
exports.Sliders = require('./components/sliders');
4141
exports.ModeBar = require('./components/modebar');
4242

4343
// plot api

tasks/test_syntax.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ function assertCircularDeps() {
105105
// as of v1.17.0 - 2016/09/08
106106
// see https://github.com/plotly/plotly.js/milestone/9
107107
// for more details
108-
var MAX_ALLOWED_CIRCULAR_DEPS = 33;
108+
var MAX_ALLOWED_CIRCULAR_DEPS = 34;
109109

110110
if(circularDeps.length > MAX_ALLOWED_CIRCULAR_DEPS) {
111111
logs.push('some new circular dependencies were added to src/');

0 commit comments

Comments
 (0)