Skip to content

Instantly share code, notes, and snippets.

@bjoerntx
Last active April 22, 2022 12:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bjoerntx/325ccc4e93195fc95bee5ce573d97b8f to your computer and use it in GitHub Desktop.
Save bjoerntx/325ccc4e93195fc95bee5ce573d97b8f to your computer and use it in GitHub Desktop.
function drawContextMenu() {
$("#formFieldContextMenu").tooltip("hide");
// get the singleton context menu
_divOvr = document.getElementById("formFieldContextMenu");
// retrieve the field location in the document
var fldPos = _currentField.textField.bounds;
// and calculate the offset location and zoom factor
var x = _textView.offsetLeft + (fldPos.location.x / 15 - _txtViewLoc.x) * _zoom;
var y = _textView.offsetTop + ((fldPos.location.y / 15)
+ (fldPos.size.height / 15) - _txtViewLoc.y) * _zoom;
// set position and size
_divOvr.style.zIndex = _textView.style.zIndex;
_divOvr.style.left = x + "px";
_divOvr.style.top = y + 5 + "px";
_divOvr.style.display = "flex";
// show tooltip once
if (_tooltipShown === false) {
$("#formFieldContextMenu").tooltip("show");
_tooltipShown = true;
}
else
$("#formFieldContextMenu").tooltip("disable");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment