Skip to content

Commit a98d1d5

Browse files
committed
bring back scene.update + 🔒 down its used during drag
1 parent 687a1f5 commit a98d1d5

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

src/traces/scattergl/index.js

+16
Original file line numberDiff line numberDiff line change
@@ -486,6 +486,22 @@ function sceneUpdate(gd, subplot) {
486486
if(!subplot._scene) {
487487
scene = subplot._scene = Lib.extendFlat({}, reset, first);
488488

489+
// apply new option to all regl components (used on drag)
490+
scene.update = function update(opt) {
491+
var opts = new Array(scene.count);
492+
for(var i = 0; i < scene.count; i++) {
493+
opts[i] = opt;
494+
}
495+
496+
if(scene.fill2d) scene.fill2d.update(opts);
497+
if(scene.scatter2d) scene.scatter2d.update(opts);
498+
if(scene.line2d) scene.line2d.update(opts);
499+
if(scene.error2d) scene.error2d.update(opts.concat(opts));
500+
if(scene.select2d) scene.select2d.update(opts);
501+
502+
scene.draw();
503+
};
504+
489505
// draw traces in proper order
490506
scene.draw = function draw() {
491507
var i;

test/jasmine/tests/gl2d_plot_interact_test.js

+6
Original file line numberDiff line numberDiff line change
@@ -282,10 +282,16 @@ describe('@gl Test gl2d plots', function() {
282282
gd.on('plotly_relayout', relayoutCallback);
283283
})
284284
.then(function() {
285+
var scene = gd._fullLayout._plots.xy._scene;
286+
spyOn(scene, 'draw');
287+
285288
// Drag scene along the X axis
286289
return mouseTo([200, 200], [220, 200]);
287290
})
288291
.then(function() {
292+
var scene = gd._fullLayout._plots.xy._scene;
293+
expect(scene.draw).toHaveBeenCalledTimes(3);
294+
289295
expect(gd.layout.xaxis.autorange).toBe(false);
290296
expect(gd.layout.yaxis.autorange).toBe(false);
291297
expect(gd.layout.xaxis.range).toBeCloseToArray(newX, precision);

0 commit comments

Comments
 (0)