Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 78a8ac7

Browse files
committed
baseline for making the scrollbar interactive
1 parent 840c064 commit 78a8ac7

File tree

2 files changed

+22
-6
lines changed

2 files changed

+22
-6
lines changed

src/traces/table/constants.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,9 @@ module.exports = {
2424
releaseTransitionEase: 'elastic',
2525
releaseTransitionDuration: 300,
2626
scrollbarWidth: 8,
27+
scrollbarCaptureWidth: 18,
2728
scrollbarOffset: 5,
2829
scrollbarHideDelay: 1000,
2930
scrollbarHideDuration: 1000,
30-
clipView: false
31+
clipView: true
3132
};

src/traces/table/plot.js

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -256,16 +256,14 @@ function renderScrollbarKit(tableControlView) {
256256
.classed('scrollbarGlyph', true)
257257
.attr('stroke', 'black')
258258
.attr('stroke-width', c.scrollbarWidth)
259-
.attr('stroke-linecap', 'round');
259+
.attr('stroke-linecap', 'round')
260+
.attr('y1', c.scrollbarWidth / 2);
260261

261262
scrollbarGlyph
262-
.attr('y1', function(d) {
263-
return c.scrollbarWidth / 2;
264-
})
265263
.attr('y2', function(d) {
266264
return d.scrollbarState.barLength - c.scrollbarWidth / 2;
267265
})
268-
.attr('stroke-opacity', 0.4)
266+
.attr('stroke-opacity', 0.4);
269267

270268
// cancel transition: possible pending (also, delayed) transition
271269
scrollbarGlyph
@@ -274,6 +272,23 @@ function renderScrollbarKit(tableControlView) {
274272
scrollbarGlyph
275273
.transition().delay(c.scrollbarHideDelay).duration(c.scrollbarHideDuration)
276274
.attr('stroke-opacity', 0);
275+
276+
var scrollbarCaptureZone = scrollbarSlider.selectAll('.scrollbarCaptureZone')
277+
.data(gup.repeat, gup.keyFun);
278+
279+
scrollbarCaptureZone.enter()
280+
.append('line')
281+
.classed('scrollbarCaptureZone', true)
282+
.attr('stroke', 'red')
283+
.attr('stroke-width', c.scrollbarCaptureWidth)
284+
.attr('stroke-linecap', 'square')
285+
.attr('stroke-opacity', c.clipView ? 0.5 : 0)
286+
.attr('y1', c.scrollbarCaptureWidth / 2);
287+
288+
scrollbarCaptureZone
289+
.attr('y2', function(d) {
290+
return d.scrollbarState.barLength - c.scrollbarCaptureWidth / 2;
291+
});
277292
}
278293

279294
function renderColumnBlocks(gd, tableControlView, columnBlock, allColumnBlock) {

0 commit comments

Comments
 (0)