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

Skip to content

Commit 3c6979f

Browse files
Sean LawlorSean Lawlor
Sean Lawlor
authored and
Sean Lawlor
committed
Revert "Merging initial.diff from WLChung"
This reverts commit 121637d.
1 parent 4bc118b commit 3c6979f

File tree

16 files changed

+156
-573
lines changed

16 files changed

+156
-573
lines changed

src/components/dragelement/unhover.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@ var getGraphDiv = require('../../lib/dom').getGraphDiv;
1414

1515
var hoverConstants = require('../fx/constants');
1616

17-
var removeNonPersistentSpikeLines = require('../fx/hover').removeNonPersistentSpikeLines
18-
1917
var unhover = module.exports = {};
2018

2119
unhover.wrapped = function(gd, evt, subplot) {
@@ -42,8 +40,7 @@ unhover.raw = function raw(gd, evt) {
4240
}
4341

4442
fullLayout._hoverlayer.selectAll('g').remove();
45-
removeNonPersistentSpikeLines(gd);
46-
//fullLayout._hoverlayer.selectAll('line').remove();
43+
fullLayout._hoverlayer.selectAll('line').remove();
4744
fullLayout._hoverlayer.selectAll('circle').remove();
4845
gd._hoverdata = undefined;
4946

src/components/drawing/index.js

Lines changed: 4 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ drawing.setRect = function(s, x, y, w, h) {
6969
* true if selection got translated
7070
* false if selection could not get translated
7171
*/
72-
drawing.translatePoint = function(d, sel, xa, ya, gd) {
72+
drawing.translatePoint = function(d, sel, xa, ya) {
7373
var x = xa.c2p(d.x);
7474
var y = ya.c2p(d.y);
7575

@@ -78,7 +78,6 @@ drawing.translatePoint = function(d, sel, xa, ya, gd) {
7878
if(sel.node().nodeName === 'text') {
7979
sel.attr('x', x).attr('y', y);
8080
} else {
81-
if (gd !== undefined && gd !== null) updateSpikeLines(gd, sel, d.x, d.y, x, y, xa, ya);
8281
sel.attr('transform', 'translate(' + x + ',' + y + ')');
8382
}
8483
} else {
@@ -88,10 +87,10 @@ drawing.translatePoint = function(d, sel, xa, ya, gd) {
8887
return true;
8988
};
9089

91-
drawing.translatePoints = function(s, xa, ya, gd = undefined) {
90+
drawing.translatePoints = function(s, xa, ya) {
9291
s.each(function(d) {
9392
var sel = d3.select(this);
94-
drawing.translatePoint(d, sel, xa, ya, gd);
93+
drawing.translatePoint(d, sel, xa, ya);
9594
});
9695
};
9796

@@ -1184,69 +1183,4 @@ drawing.setTextPointsScale = function(selection, xScale, yScale) {
11841183

11851184
el.attr('transform', transforms.join(' '));
11861185
});
1187-
}
1188-
1189-
// Update spikeline for a given points (When the graph has points, then we will call this per point)
1190-
function updateSpikeLines(gd, sel, px, py, x, y, xAxis, yAxis){
1191-
if (gd === null || gd === undefined) return;
1192-
1193-
var previousDx = 0;
1194-
var previousDy = 0;
1195-
1196-
var transformAttr = sel.attr('transform');
1197-
1198-
if(transformAttr !== null){
1199-
var regexMatch = transformAttr.match(/^translate\((-?\d+(\.\d{1,2})?),(-?\d+(\.\d{1,2})?)\)$/);
1200-
1201-
if(regexMatch !== null && regexMatch.length > 0) {
1202-
previousDy = parseFloat(regexMatch[3]);
1203-
previousDx = parseFloat(regexMatch[1]);
1204-
}
1205-
}
1206-
1207-
var dx = x - previousDx;
1208-
var dy = y - previousDy;
1209-
1210-
drawing.repositionPersistentSpikeLines(gd, px, py, dx, dy, xAxis, yAxis);
1211-
}
1212-
1213-
// Reposition spikeline for a given points (When the graph has points, then we will call this per point)
1214-
drawing.repositionPersistentSpikeLines = function(gd, px, py, dx, dy, xAxis, yAxis){
1215-
if (gd === null || gd === undefined) return;
1216-
1217-
var xSpikes = [];
1218-
var ySpikes = [];
1219-
1220-
var plotId = xAxis._id + yAxis._id;
1221-
if (gd._fullLayout === undefined) return;
1222-
if (px === null || py === null || px === undefined || py === undefined) return;
1223-
1224-
var spikeLines = gd._fullLayout._hoverlayer.selectAll('.spikeline')
1225-
.filter('.' + plotId)
1226-
.filter('[px ="' + px + '"]')
1227-
.filter('[py ="' + py + '"]');
1228-
1229-
var filteredXSpikes = spikeLines.filter('.'+ xAxis._name);
1230-
for(var index = 0; index < filteredXSpikes[0].length; index++){
1231-
xSpikes.push(filteredXSpikes[0][index]);
1232-
}
1233-
1234-
var filteredYSpikes = spikeLines.filter('.'+ yAxis._name);
1235-
for(var index = 0; index < filteredYSpikes[0].length; index++){
1236-
ySpikes.push(filteredYSpikes[0][index]);
1237-
}
1238-
1239-
for(var i = 0; i < ySpikes.length; i++){
1240-
var previousDx = ySpikes[i].dx === undefined ? 0 : ySpikes[i].dx;
1241-
var newDx = previousDx + dx;
1242-
ySpikes[i].setAttribute('transform', "translate(" + (previousDx + dx) + ",0)");
1243-
ySpikes[i].dx = newDx;
1244-
}
1245-
1246-
for(var i = 0; i < xSpikes.length; i++){
1247-
var previousDy = xSpikes[i].dy === undefined ? 0 : xSpikes[i].dy;
1248-
var newDy = previousDy + dy;
1249-
xSpikes[i].setAttribute('transform', "translate(0," + (previousDy + dy) + ")");
1250-
xSpikes[i].dy = newDy;
1251-
}
1252-
}
1186+
};

src/components/fx/click.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010

1111
var Registry = require('../../registry');
1212
var hover = require('./hover').hover;
13-
var toggleSpikeLinesPresistency = require('./hover').toggleSpikeLinesPresistency;
1413

1514
module.exports = function click(gd, evt, subplot) {
1615
var annotationsDone = Registry.getComponentMethod('annotations', 'onClick')(gd, gd._hoverdata);
@@ -29,8 +28,6 @@ module.exports = function click(gd, evt, subplot) {
2928
if(annotationsDone && annotationsDone.then) {
3029
annotationsDone.then(emitClick);
3130
} else emitClick();
32-
33-
toggleSpikeLinesPresistency(gd);
3431

3532
// why do we get a double event without this???
3633
if(evt.stopImmediatePropagation) evt.stopImmediatePropagation();

0 commit comments

Comments
 (0)