Skip to content

Commit 4260df1

Browse files
committed
DRY-up scene.clear
- no need for two separate viewport computation blocks - break up one more loooooooooong line
1 parent 1c6144e commit 4260df1

File tree

1 file changed

+12
-20
lines changed

1 file changed

+12
-20
lines changed

src/traces/scattergl/index.js

Lines changed: 12 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -246,25 +246,14 @@ function sceneUpdate(gd, subplot) {
246246
var height = fullLayout.height;
247247
var xaxis = subplot.xaxis;
248248
var yaxis = subplot.yaxis;
249-
var vp, gl, regl;
250-
251-
// multisubplot case
252-
if(xaxis && xaxis.domain && yaxis && yaxis.domain) {
253-
vp = [
254-
vpSize.l + xaxis.domain[0] * vpSize.w,
255-
vpSize.b + yaxis.domain[0] * vpSize.h,
256-
(width - vpSize.r) - (1 - xaxis.domain[1]) * vpSize.w,
257-
(height - vpSize.t) - (1 - yaxis.domain[1]) * vpSize.h
258-
];
259-
}
260-
else {
261-
vp = [
262-
vpSize.l,
263-
vpSize.b,
264-
(width - vpSize.r),
265-
(height - vpSize.t)
266-
];
267-
}
249+
var vp = [
250+
vpSize.l + xaxis.domain[0] * vpSize.w,
251+
vpSize.b + yaxis.domain[0] * vpSize.h,
252+
(width - vpSize.r) - (1 - xaxis.domain[1]) * vpSize.w,
253+
(height - vpSize.t) - (1 - yaxis.domain[1]) * vpSize.h
254+
];
255+
256+
var gl, regl;
268257

269258
if(scene.select2d) {
270259
regl = scene.select2d.regl;
@@ -554,7 +543,10 @@ function plot(gd, subplot, cdata) {
554543
// create select2d
555544
if(!scene.select2d) {
556545
// create scatter instance by cloning scatter2d
557-
scene.select2d = createScatter(fullLayout._glcanvas.data()[1].regl, {clone: scene.scatter2d});
546+
scene.select2d = createScatter(
547+
fullLayout._glcanvas.data()[1].regl,
548+
{clone: scene.scatter2d}
549+
);
558550
}
559551

560552
if(scene.scatter2d && scene.selectBatch && scene.selectBatch.length) {

0 commit comments

Comments
 (0)