Skip to content

Commit cf62849

Browse files
committed
Zoom: Add clipId property to subplot objects
1 parent 336c12f commit cf62849

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

src/plot_api/plot_api.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2913,16 +2913,16 @@ function lsInner(gd) {
29132913

29142914

29152915
// Clip so that data only shows up on the plot area.
2916-
var clips = fullLayout._defs.selectAll('g.clips'),
2917-
clipId = 'clip' + fullLayout._uid + subplot + 'plot';
2916+
plotinfo.clipId = 'clip' + fullLayout._uid + subplot + 'plot';
29182917

2919-
var plotClip = clips.selectAll('#' + clipId)
2918+
var plotClip = fullLayout._defs.selectAll('g.clips')
2919+
.selectAll('#' + plotinfo.clipId)
29202920
.data([0]);
29212921

29222922
plotClip.enter().append('clipPath')
29232923
.attr({
29242924
'class': 'plotclip',
2925-
'id': clipId
2925+
'id': plotinfo.clipId
29262926
})
29272927
.append('rect');
29282928

@@ -2934,7 +2934,7 @@ function lsInner(gd) {
29342934

29352935

29362936
plotinfo.plot.call(Lib.setTranslate, xa._offset, ya._offset);
2937-
plotinfo.plot.call(Drawing.setClipUrl, clipId);
2937+
plotinfo.plot.call(Drawing.setClipUrl, plotinfo.clipId);
29382938

29392939
var xlw = Drawing.crispRound(gd, xa.linewidth, 1),
29402940
ylw = Drawing.crispRound(gd, ya.linewidth, 1),

src/plots/cartesian/dragbox.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -603,7 +603,6 @@ module.exports = function dragBox(gd, plotinfo, x, y, w, h, ns, ew) {
603603
for(var i = 0; i < subplots.length; i++) {
604604

605605
var subplot = plotinfos[subplots[i]],
606-
clipId = 'clip' + fullLayout._uid + subplots[i] + 'plot',
607606
xa2 = subplot.x(),
608607
ya2 = subplot.y(),
609608
editX = ew && xa.indexOf(xa2) !== -1 && !xa2.fixedrange,
@@ -623,7 +622,7 @@ module.exports = function dragBox(gd, plotinfo, x, y, w, h, ns, ew) {
623622
plotDy = ya2._offset - fracDy;
624623

625624

626-
fullLayout._defs.selectAll('#' + clipId)
625+
fullLayout._defs.selectAll('#' + subplot.clipId)
627626
.call(Lib.setTranslate, clipDx, clipDy)
628627
.call(Lib.setScale, 1 / xScaleFactor, 1 / yScaleFactor);
629628

0 commit comments

Comments
 (0)