Skip to content

Commit 9574099

Browse files
committed
fixing multitrace drag bug 3
1 parent f3f1a5d commit 9574099

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

src/traces/table/plot.js

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ module.exports = function plot(gd, calcdata) {
5353
.append('g')
5454
.classed('tableControlView', true)
5555
.style('box-sizing', 'content-box')
56-
.on('mousemove', function() {tableControlView.call(renderScrollbarKit, gd);})
56+
.on('mousemove', function(d) {tableControlView.filter(function(dd) {return d === dd;}).call(renderScrollbarKit, gd);})
5757
.on('mousewheel', function(d) {
5858
if(d.scrollbarState.wheeling) return;
5959
d.scrollbarState.wheeling = true;
@@ -100,7 +100,7 @@ module.exports = function plot(gd, calcdata) {
100100
easeColumn(movedColumn, d, -c.uplift);
101101
raiseToTop(this);
102102
d.calcdata.columnDragInProgress = true;
103-
renderScrollbarKit(tableControlView, gd);
103+
renderScrollbarKit(tableControlView.filter(function(dd) {return d.calcdata.key === dd.key;}), gd);
104104
return d;
105105
})
106106
.on('drag', function(d) {
@@ -704,7 +704,7 @@ function findPagesAndCacheHeights(blocks, scrollY, scrollHeight) {
704704
}
705705

706706
function updateBlockYPosition(gd, cellsColumnBlock, tableControlView) {
707-
var d = cellsColumnBlock.data()[0];
707+
var d = flatData(cellsColumnBlock)[0];
708708
var blocks = d.rowBlocks;
709709
var calcdata = d.calcdata;
710710

@@ -736,6 +736,7 @@ function updateBlockYPosition(gd, cellsColumnBlock, tableControlView) {
736736
cellsColumnBlock
737737
.attr('transform', function(d) {
738738
var yTranslate = firstRowAnchor(d.rowBlocks, d.page) - d.scrollY;
739+
//console.log(d.scrollY, Math.round(yTranslate))
739740
return 'translate(0 ' + yTranslate + ')';
740741
});
741742

@@ -747,8 +748,11 @@ function updateBlockYPosition(gd, cellsColumnBlock, tableControlView) {
747748
}
748749
}
749750

750-
function makeDragRow(gd, tableControlView, optionalMultiplier, optionalPosition) {
751-
return function dragRow(d) {
751+
function makeDragRow(gd, allTableControlView, optionalMultiplier, optionalPosition) {
752+
return function dragRow(eventD) {
753+
// may come from whicever DOM event target: drag, wheel, bar... eventD corresponds to event target
754+
var d = eventD.calcdata ? eventD.calcdata : eventD;
755+
var tableControlView = allTableControlView.filter(function(dd) {return d.key === dd.key;})
752756
var multiplier = optionalMultiplier || d.scrollbarState.dragMultiplier;
753757
d.scrollY = optionalPosition === void(0) ? d.scrollY + multiplier * d3.event.dy : optionalPosition;
754758
var cellsColumnBlock = tableControlView.selectAll('.yColumn').selectAll('.columnBlock').filter(cellsBlock);

0 commit comments

Comments
 (0)