Skip to content

Commit 7d09a95

Browse files
committed
Fix chart apps selecting box bug
1 parent 8a11d12 commit 7d09a95

1 file changed

Lines changed: 12 additions & 6 deletions

File tree

src/matplotlib/plot.js

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -605,19 +605,25 @@ define([
605605
// view button click - view little popup to show variable & details
606606
$(this.wrapSelector('.vp-select-data')).click(function(event) {
607607
var axes = $(this).data('axes');
608+
609+
var btnPos = $(this)[0].getBoundingClientRect();
608610

609611
if($(that.wrapSelector('#vp_varViewBox')).is(":hidden")) {
610612
// refresh variables
611613
that.refreshVariables(function(varList) {
612614
// set position
613615
var boxSize = { width: 280, height: 260 };
614616
var boxPosition = { position: 'fixed', left: event.pageX - 20, top: event.pageY + 20 };
615-
if (event.pageX + boxSize.width > window.innerWidth) {
616-
boxPosition.left = event.pageX - boxSize.width;
617-
}
618-
if (event.pageY + boxSize.height > window.innerHeight) {
619-
boxPosition.top = event.pageY - boxSize.height - 20;
620-
}
617+
// if (event.pageX + boxSize.width > window.innerWidth) {
618+
// boxPosition.left = event.pageX - boxSize.width;
619+
// }
620+
// if (event.pageY + boxSize.height > window.innerHeight) {
621+
// boxPosition.top = event.pageY - boxSize.height - 20;
622+
// }
623+
624+
// set as center
625+
boxPosition.left = 'calc(50% - 140px)'
626+
boxPosition.top = 'calc(50% - 130px)'
621627
$('#vp_varViewBox').css({
622628
...boxPosition
623629
});

0 commit comments

Comments
 (0)