Skip to content

Commit

Permalink
globally safe clipPath #1
Browse files Browse the repository at this point in the history
  • Loading branch information
monfera committed Oct 5, 2017
1 parent 3cab51d commit fa84c68
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/traces/table/plot.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,8 @@ module.exports = function plot(gd, wrappedTraceHolders) {
.attr('width', function(d) {return d.width;})
.attr('height', function(d) {return d.height;});

tableControlView.attr('clip-path', function(d) {return 'url(#scrollAreaBottomClip_' + d.key + ')';});
tableControlView
.each(function(d) {Drawing.setClipUrl(tableControlView, scrollAreaBottomClipKey(gd, d));});

var yColumn = tableControlView.selectAll('.yColumn')
.data(function(vm) {return vm.columns;}, gup.keyFun);
Expand Down Expand Up @@ -174,7 +175,7 @@ module.exports = function plot(gd, wrappedTraceHolders) {
scrollAreaClip.enter()
.append('clipPath')
.classed('scrollAreaClip', true)
.attr('id', function(d) { return 'scrollAreaBottomClip_' + d.key;});
.attr('id', function(d) {return scrollAreaBottomClipKey(gd, d);});

var scrollAreaClipRect = scrollAreaClip.selectAll('.scrollAreaClipRect')
.data(gup.repeat, gup.keyFun);
Expand Down Expand Up @@ -225,6 +226,10 @@ module.exports = function plot(gd, wrappedTraceHolders) {
updateBlockYPosition(null, cellsColumnBlock, tableControlView);
};

function scrollAreaBottomClipKey(gd, d) {
return 'clip' + gd._fullLayout._uid + '_scrollAreaBottomClip_' + d.key;
}

function flatData(selection) {
return [].concat.apply([], selection.map(function(g) {return g;}))
.map(function(g) {return g.__data__;});
Expand Down

0 comments on commit fa84c68

Please sign in to comment.