brighter-trading/static/controls.js

31 lines
993 B
JavaScript

class Controls {
constructor() {
this.name = 'controls';
}
showAtPos(event, id) {
// Function to display popup output at curser.
// Used in the chart controls to enable/disable indicators.
var el, x, y;
el = document.getElementById(id);
if (window.event) {
x = window.event.clientX + document.documentElement.scrollLeft
+ document.body.scrollLeft;
y = window.event.clientY + document.documentElement.scrollTop +
+ document.body.scrollTop;
}
else {
x = event.clientX + window.scrollX;
y = event.clientY + window.scrollY;
}
// The popup hides on mouse out so the element is moved back a little to
// ensure the mouse is still hovering over it when it gets displayed
y = y - (10);
x = x - (15);
el.style.left = x + "px";
el.style.top = y + "px";
el.style.display = "block";
}
}