Skip to content

Commit b9ed688

Browse files
committed
limit smith interactions to hover, select and click
1 parent e367b07 commit b9ed688

File tree

2 files changed

+12
-66
lines changed

2 files changed

+12
-66
lines changed

src/plots/polar/polar.js

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -777,6 +777,7 @@ proto.updateFx = function(fullLayout, polarLayout) {
777777

778778
proto.updateHoverAndMainDrag = function(fullLayout) {
779779
var _this = this;
780+
var isSmith = _this.isSmith;
780781
var gd = _this.gd;
781782
var layers = _this.layers;
782783
var zoomlayer = fullLayout._zoomlayer;
@@ -1089,14 +1090,18 @@ proto.updateHoverAndMainDrag = function(fullLayout) {
10891090

10901091
switch(dragModeNow) {
10911092
case 'zoom':
1092-
if(vangles) {
1093-
dragOpts.moveFn = zoomMoveForPolygons;
1094-
} else {
1095-
dragOpts.moveFn = zoomMove;
1096-
}
10971093
dragOpts.clickFn = zoomClick;
1098-
dragOpts.doneFn = zoomDone;
1099-
zoomPrep(evt, startX, startY);
1094+
1095+
if(!isSmith) {
1096+
if(vangles) {
1097+
dragOpts.moveFn = zoomMoveForPolygons;
1098+
} else {
1099+
dragOpts.moveFn = zoomMove;
1100+
}
1101+
1102+
dragOpts.doneFn = zoomDone;
1103+
zoomPrep(evt, startX, startY);
1104+
}
11001105
break;
11011106
case 'select':
11021107
case 'lasso':

test/jasmine/tests/smith_test.js

Lines changed: 0 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
var Plotly = require('@lib/index');
22
var Lib = require('@src/lib');
33
var Smith = require('@src/plots/smith');
4-
var layerNames = require('@src/plots/polar/constants').layerNames;
54

65
var basicMock = require('@mocks/zzz_smith_basic.json');
76

@@ -89,64 +88,6 @@ describe('Test smith plots defaults:', function() {
8988
describe('Test relayout on smith subplots:', function() {
9089
afterEach(destroyGraphDiv);
9190

92-
it('should be able to reorder axis layers when relayout\'ing *layer*', function(done) {
93-
var gd = createGraphDiv();
94-
var fig = Lib.extendDeep({}, basicMock);
95-
var dflt = layerNames;
96-
97-
function _assert(expected) {
98-
var actual = d3SelectAll('g.smith > .smithsublayer');
99-
100-
expect(actual.size()).toBe(expected.length, '# of layer');
101-
102-
actual.each(function(d, i) {
103-
var className = d3Select(this)
104-
.attr('class')
105-
.split('smithsublayer ')[1];
106-
107-
expect(className).toBe(expected[i], 'layer ' + i);
108-
});
109-
}
110-
111-
Plotly.newPlot(gd, fig).then(function() {
112-
_assert(dflt);
113-
return Plotly.relayout(gd, 'smith.realaxis.layer', 'below traces');
114-
})
115-
.then(function() {
116-
_assert([
117-
'draglayer', 'plotbg', 'backplot', 'angular-grid', 'radial-grid',
118-
'radial-line', 'radial-axis',
119-
'frontplot',
120-
'angular-line', 'angular-axis'
121-
]);
122-
return Plotly.relayout(gd, 'smith.imaginaryaxis.layer', 'below traces');
123-
})
124-
.then(function() {
125-
_assert([
126-
'draglayer', 'plotbg', 'backplot', 'angular-grid', 'radial-grid',
127-
'angular-line',
128-
'radial-line',
129-
'angular-axis',
130-
'radial-axis',
131-
'frontplot'
132-
]);
133-
return Plotly.relayout(gd, 'smith.realaxis.layer', 'above traces');
134-
})
135-
.then(function() {
136-
_assert([
137-
'draglayer', 'plotbg', 'backplot', 'angular-grid', 'radial-grid',
138-
'angular-line', 'angular-axis',
139-
'frontplot',
140-
'radial-line', 'radial-axis'
141-
]);
142-
return Plotly.relayout(gd, 'smith.imaginaryaxis.layer', null);
143-
})
144-
.then(function() {
145-
_assert(dflt);
146-
})
147-
.then(done, done.fail);
148-
});
149-
15091
it('should be able to relayout imaginary axis ticks', function(done) {
15192
var gd = createGraphDiv();
15293
var fig = Lib.extendDeep({}, basicMock);

0 commit comments

Comments
 (0)