Skip to content

Commit 77aaad2

Browse files
committed
Merge branch 'master' into fix-layout-animation
Conflicts: test/jasmine/tests/animate_test.js
2 parents 133b9d6 + 2ac3dd7 commit 77aaad2

File tree

15 files changed

+170
-52
lines changed

15 files changed

+170
-52
lines changed

circle.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ dependencies:
1717
- npm run cibuild
1818
- npm run pretest
1919
- eval $(node tasks/docker.js setup)
20+
- npm ls
2021

2122
test:
2223
override:

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@
9797
"browserify-transform-tools": "^1.5.1",
9898
"deep-equal": "^1.0.1",
9999
"ecstatic": "^2.1.0",
100-
"eslint": "^3.5.0",
100+
"eslint": "^3.9.1",
101101
"falafel": "^2.0.0",
102102
"fs-extra": "^0.30.0",
103103
"fuse.js": "^2.2.0",

src/components/sliders/draw.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -366,13 +366,21 @@ function handleInput(gd, sliderGroup, sliderOpts, normalizedPosition, doTransiti
366366
}
367367

368368
function setActive(gd, sliderGroup, sliderOpts, index, doCallback, doTransition) {
369+
var previousActive = sliderOpts.active;
369370
sliderOpts._input.active = sliderOpts.active = index;
370371

371372
var step = sliderOpts.steps[sliderOpts.active];
372373

373374
sliderGroup.call(setGripPosition, sliderOpts, sliderOpts.active / (sliderOpts.steps.length - 1), doTransition);
374375
sliderGroup.call(drawCurrentValue, sliderOpts);
375376

377+
gd.emit('plotly_sliderchange', {
378+
slider: sliderOpts,
379+
step: sliderOpts.steps[sliderOpts.active],
380+
interaction: doCallback,
381+
previousActive: previousActive
382+
});
383+
376384
if(step && step.method && doCallback) {
377385
if(sliderGroup._nextMethod) {
378386
// If we've already queued up an update, just overwrite it with the most recent:
@@ -399,6 +407,8 @@ function attachGripEvents(item, gd, sliderGroup, sliderOpts) {
399407
var $gd = d3.select(gd);
400408

401409
item.on('mousedown', function() {
410+
gd.emit('plotly_sliderstart', {slider: sliderOpts});
411+
402412
var grip = sliderGroup.select('.' + constants.gripRectClass);
403413

404414
d3.event.stopPropagation();
@@ -419,6 +429,11 @@ function attachGripEvents(item, gd, sliderGroup, sliderOpts) {
419429
grip.call(Color.fill, sliderOpts.bgcolor);
420430
$gd.on('mouseup', null);
421431
$gd.on('mousemove', null);
432+
433+
gd.emit('plotly_sliderend', {
434+
slider: sliderOpts,
435+
step: sliderOpts.steps[sliderOpts.active]
436+
});
422437
});
423438
});
424439
}

src/components/updatemenus/draw.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,8 @@ function drawButtons(gd, gHeader, gButton, menuOpts) {
299299
setActive(gd, menuOpts, buttonOpts, gHeader, gButton, buttonIndex);
300300

301301
Plots.executeAPICommand(gd, buttonOpts.method, buttonOpts.args);
302+
303+
gd.emit('plotly_buttonclicked', {menu: menuOpts, button: buttonOpts, active: menuOpts.active});
302304
});
303305

304306
button.on('mouseover', function() {

src/plot_api/plot_api.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2005,7 +2005,7 @@ function _relayout(gd, aobj) {
20052005
*/
20062006
else if(['hovermode', 'dragmode'].indexOf(ai) !== -1) flags.domodebar = true;
20072007
else if(['hovermode', 'dragmode', 'height',
2008-
'width', 'autosize'].indexOf(ai) === -1) {
2008+
'width', 'autosize'].indexOf(ai) === -1) {
20092009
flags.doplot = true;
20102010
}
20112011

@@ -2416,6 +2416,8 @@ Plotly.animate = function(gd, frameOrGroupNameOrFrameList, animationOpts) {
24162416
for(i = 0; i < trans._frames.length; i++) {
24172417
frame = trans._frames[i];
24182418

2419+
if(!frame) continue;
2420+
24192421
if(allFrames || frame.group === frameOrGroupNameOrFrameList) {
24202422
frameList.push({
24212423
type: 'byname',
@@ -2579,7 +2581,7 @@ Plotly.addFrames = function(gd, frameList, indices) {
25792581
if(_hash[frame.name]) {
25802582
// If frame is present, overwrite its definition:
25812583
for(j = 0; j < _frames.length; j++) {
2582-
if(_frames[j].name === frame.name) break;
2584+
if((_frames[j] || {}).name === frame.name) break;
25832585
}
25842586
ops.push({type: 'replace', index: j, value: frame});
25852587
revops.unshift({type: 'replace', index: j, value: _frames[j]});

src/plots/cartesian/tick_label_defaults.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,8 @@ module.exports = function handleTickLabelDefaults(containerIn, containerOut, coe
6767
*/
6868
function getShowAttrDflt(containerIn) {
6969
var showAttrsAll = ['showexponent',
70-
'showtickprefix',
71-
'showticksuffix'],
70+
'showtickprefix',
71+
'showticksuffix'],
7272
showAttrs = showAttrsAll.filter(function(a) {
7373
return containerIn[a] !== undefined;
7474
}),

src/plots/geo/set_scale.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ function makeRangeBox(lon0, lat0, lon1, lat1) {
127127
return {
128128
type: 'Polygon',
129129
coordinates: [
130-
[ [lon0, lat0],
130+
[ [lon0, lat0],
131131
[lon0, lat1],
132132
[lon0 + dlon4, lat1],
133133
[lon0 + 2 * dlon4, lat1],

src/plots/plots.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1437,7 +1437,7 @@ plots.modifyFrames = function(gd, operations) {
14371437
break;*/
14381438
case 'replace':
14391439
frame = op.value;
1440-
var oldName = _frames[op.index].name;
1440+
var oldName = (_frames[op.index] || {}).name;
14411441
var newName = frame.name;
14421442
_frames[op.index] = _hash[newName] = frame;
14431443

src/traces/contour/plot.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@ function makePath(pi, loc, edgeflag) {
320320
// even # of pts - average central two
321321
else {
322322
newpt = [(getpt(ptavg)[0] + getpt(ptavg + 1)[0]) / 2,
323-
(getpt(ptavg)[1] + getpt(ptavg + 1)[1]) / 2];
323+
(getpt(ptavg)[1] + getpt(ptavg + 1)[1]) / 2];
324324
}
325325

326326
pts.splice(cnt2 + 1, cnt - cnt2 + 1, newpt);
@@ -458,12 +458,12 @@ function getInterpPx(pi, loc, step) {
458458
if(step[1]) {
459459
var dx = (pi.level - zxy) / (pi.z[locy][locx + 1] - zxy);
460460
return [xa.c2p((1 - dx) * pi.x[locx] + dx * pi.x[locx + 1], true),
461-
ya.c2p(pi.y[locy], true)];
461+
ya.c2p(pi.y[locy], true)];
462462
}
463463
else {
464464
var dy = (pi.level - zxy) / (pi.z[locy + 1][locx] - zxy);
465465
return [xa.c2p(pi.x[locx], true),
466-
ya.c2p((1 - dy) * pi.y[locy] + dy * pi.y[locy + 1], true)];
466+
ya.c2p((1 - dy) * pi.y[locy] + dy * pi.y[locy + 1], true)];
467467
}
468468
}
469469

src/traces/surface/convert.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,8 +151,8 @@ function refine(coords) {
151151
var padImg = padField(coords[i]);
152152
var scaledImg = ndarray(new Float32Array(nsize), nshape);
153153
homography(scaledImg, padImg, [scaleF, 0, 0,
154-
0, scaleF, 0,
155-
0, 0, 1]);
154+
0, scaleF, 0,
155+
0, 0, 1]);
156156
coords[i] = scaledImg;
157157
}
158158

0 commit comments

Comments
 (0)