Skip to content

Commit 02b6f79

Browse files
committed
removed hacky clientX and clientY from scattermaobox events
1 parent 1dee019 commit 02b6f79

File tree

2 files changed

+2
-17
lines changed

2 files changed

+2
-17
lines changed

src/plots/mapbox/mapbox.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -450,14 +450,13 @@ proto.initFx = function(calcData, fullLayout) {
450450

451451
map.on('mousemove', function(evt) {
452452
var bb = self.div.getBoundingClientRect();
453-
454-
evt.target.getBoundingClientRect = function() { return bb; };
455-
456453
var xy = [
457454
evt.originalEvent.offsetX,
458455
evt.originalEvent.offsetY
459456
];
460457

458+
evt.target.getBoundingClientRect = function() { return bb; };
459+
461460
self.xaxis.p2c = function() { return map.unproject(xy).lng; };
462461
self.yaxis.p2c = function() { return map.unproject(xy).lat; };
463462

test/jasmine/tests/scattermapbox_test.js

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -951,7 +951,6 @@ describe('@noCI Test plotly events on a scattermapbox plot:', function() {
951951
click(pointPos[0], pointPos[1]);
952952

953953
var pt = futureData.points[0];
954-
var evt = futureData.event;
955954

956955
expect(Object.keys(pt)).toEqual([
957956
'data', 'fullData', 'curveNumber', 'pointNumber', 'pointIndex', 'lon', 'lat'
@@ -963,9 +962,6 @@ describe('@noCI Test plotly events on a scattermapbox plot:', function() {
963962
expect(pt.lat).toEqual(10, 'points[0].lat');
964963
expect(pt.lon).toEqual(10, 'points[0].lon');
965964
expect(pt.pointNumber).toEqual(0, 'points[0].pointNumber');
966-
967-
expect(evt.clientX).toEqual(pointPos[0], 'event.clientX');
968-
expect(evt.clientY).toEqual(pointPos[1], 'event.clientY');
969965
});
970966
});
971967

@@ -1013,8 +1009,6 @@ describe('@noCI Test plotly events on a scattermapbox plot:', function() {
10131009
// expect(pt.lon).toEqual(10, 'points[0].lon');
10141010
// expect(pt.pointNumber).toEqual(0, 'points[0].pointNumber');
10151011

1016-
// expect(evt.clientX).toEqual(pointPos[0], 'event.clientX');
1017-
// expect(evt.clientY).toEqual(pointPos[1], 'event.clientY');
10181012
// Object.getOwnPropertyNames(clickOpts).forEach(function(opt) {
10191013
// expect(evt[opt]).toEqual(clickOpts[opt], 'event.' + opt);
10201014
// });
@@ -1035,7 +1029,6 @@ describe('@noCI Test plotly events on a scattermapbox plot:', function() {
10351029
mouseEvent('mousemove', pointPos[0], pointPos[1]);
10361030

10371031
var pt = futureData.points[0];
1038-
var evt = futureData.event;
10391032

10401033
expect(Object.keys(pt)).toEqual([
10411034
'data', 'fullData', 'curveNumber', 'pointNumber', 'pointIndex', 'lon', 'lat'
@@ -1047,9 +1040,6 @@ describe('@noCI Test plotly events on a scattermapbox plot:', function() {
10471040
expect(pt.lat).toEqual(10, 'points[0].lat');
10481041
expect(pt.lon).toEqual(10, 'points[0].lon');
10491042
expect(pt.pointNumber).toEqual(0, 'points[0].pointNumber');
1050-
1051-
expect(evt.clientX).toEqual(pointPos[0], 'event.clientX');
1052-
expect(evt.clientY).toEqual(pointPos[1], 'event.clientY');
10531043
});
10541044
});
10551045

@@ -1065,7 +1055,6 @@ describe('@noCI Test plotly events on a scattermapbox plot:', function() {
10651055
it('@gl should contain the correct fields', function(done) {
10661056
move(pointPos[0], pointPos[1], nearPos[0], nearPos[1], HOVERMINTIME + 10).then(function() {
10671057
var pt = futureData.points[0];
1068-
var evt = futureData.event;
10691058

10701059
expect(Object.keys(pt)).toEqual([
10711060
'data', 'fullData', 'curveNumber', 'pointNumber', 'pointIndex', 'lon', 'lat'
@@ -1077,9 +1066,6 @@ describe('@noCI Test plotly events on a scattermapbox plot:', function() {
10771066
expect(pt.lat).toEqual(10, 'points[0].lat');
10781067
expect(pt.lon).toEqual(10, 'points[0].lon');
10791068
expect(pt.pointNumber).toEqual(0, 'points[0].pointNumber');
1080-
1081-
expect(evt.clientX).toEqual(nearPos[0], 'event.clientX');
1082-
expect(evt.clientY).toEqual(nearPos[1], 'event.clientY');
10831069
}).then(done);
10841070
});
10851071
});

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy