Skip to content

Commit e50cffb

Browse files
fixed tool tip positioning
1 parent e44c0b0 commit e50cffb

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

js/widgets/main_plot.js

+5-8
Original file line numberDiff line numberDiff line change
@@ -585,7 +585,6 @@ $(function() {
585585
// Change axes input text boxes
586586
$("#axes-input").axes_input("change_axis_limits", this.xmin, this.xmax, this.ymin, this.ymax, false)
587587
}
588-
// $("#nucleosome-slider").nucleosome_slider("update_all");
589588
$("#reference-axes-pane").reference_axes("update_all");
590589
},
591590

@@ -785,11 +784,8 @@ $(function() {
785784
this._elements.tooltip
786785
.style("display", null)
787786
.style("position", "absolute")
788-
.style("top", ev.clientY)
789-
.style("left", ev.clientX)
790787
.style("pointer-events", "none");
791-
// .attr("transform", "translate(" + this.xscale(mouse_x_scaled) + " " + mouse_y + ")");
792-
788+
793789
// Create tooltip border and text
794790
let tooltip_border = this._elements.tooltip.selectAll("path")
795791
.data([null])
@@ -817,10 +813,11 @@ $(function() {
817813
let {y, width: w, height: h} = tooltip_text.node().getBBox();
818814
tooltip_text.attr("transform", "translate(" + 2 + " " + (15 - y) + ")");
819815
// Update tooltip border
820-
tooltip_border.attr("d", "M" + (w + 4) + " 5 H " + (w + 20) / 2 + " l -5 -5 l-5 5 H 0 V " + (h + 20) + " H " + (w + 4) + " z")
816+
tooltip_border.attr("d", "M" + (w + 4) + " 5 H " + (w + 20) / 2 + " l -5 -5 l-5 5 H 0 V " + (h + 20) + " H " + (w + 4) + " z");
817+
({y, width: w, height: h} = tooltip_border.node().getBBox());
821818
this._elements.tooltip
822-
.style("top", ev.clientY + 0.7 * h)
823-
.style("left", ev.clientX - ((w + 8) / 2) * 0.57)
819+
.style("top", ev.clientY + 30)
820+
.style("left", ev.clientX - (w - 80) / 1.4)
824821
} else {
825822
this._elements.tooltip.style("display", "none")
826823
}

0 commit comments

Comments
 (0)