733ba7b804e84d7b60ccad1f137398ecd52db983
chmalee
Tue Apr 23 18:15:09 2024 -0700
Add a general highlight trackDb variable(s), working like trackDb filters, except put a color behind the item, refs #24507
diff --git src/hg/js/hgTracks.js src/hg/js/hgTracks.js
index 72896e0..5fe1052 100644
--- src/hg/js/hgTracks.js
+++ src/hg/js/hgTracks.js
@@ -990,32 +990,30 @@
$(form).attr('method','get');
},
restoreFromBackButton: function()
// Re-enabling vis dropdowns is necessary because initForAjax() disables them on submit.
{
$('select.normalText,select.hiddenText').attr('disabled',false);
}
};
////////////////////////////////////////////////////////////
// dragSelect is also known as dragZoom or shift-dragZoom //
////////////////////////////////////////////////////////////
var dragSelect = {
- //hlColorDefault: '#aaedff', // default highlight color, if nothing specified
- //hlColor : '#aaedff', // current highlight color
hlColor : '#aac6ff', // current highlight color
hlColorDefault: '#aac6ff', // default highlight color, if nothing specified
areaSelector: null, // formerly "imgAreaSelect". jQuery element used for imgAreaSelect
originalCursor: null,
startTime: null,
escPressed : false, // flag is set when user presses Escape
selectStart: function (img, selection)
{
initVars();
dragSelect.escPressed = false;
if (rightClick.menu) {
rightClick.menu.hide();
}
var now = new Date();
@@ -1153,70 +1151,48 @@
newPosition.replace("virt:", "multi:");
// if the user hit Escape just before, do not show this dialo
if (dragSelect.startTime===null)
return;
var dragSelectDialog = $("#dragSelectDialog")[0];
if (!dragSelectDialog) {
$("body").append("
" +
"
"+
"
Hold Shift+drag to show this dialog" +
"
Hold Alt+drag (Windows) or Option+drag (Mac) to add a highlight" +
"
Hold Ctrl+drag (Windows) or Cmd+drag (Mac) to zoom" +
"
To cancel, press Esc anytime during the drag" +
"
Using the keyboard, highlight the current position with h then m" +
"
Clear all highlights with View - Clear Highlights or h then c" +
"
To merely save the color for the next keyboard or right-click > Highlight operations, click 'Save Color' below" +
- "
" +
- "" +
+ "");
+ makeHighlightPicker("hlColor", document.getElementById("dragSelectDialog"), null);
+ document.body.append("" +
"Don't show this again and always zoom with shift. " +
"Re-enable via 'View - Configure Browser' (c then f)"+
"Selected chromosome position: ");
dragSelectDialog = $("#dragSelectDialog")[0];
// reset value
- $('#hlReset').click(function() {
- var hlDefault = dragSelect.hlColorDefault;
- $('#hlColorInput').val(hlDefault);
- $("#hlColorPicker").spectrum("set", hlDefault);
- dragSelect.saveHlColor(hlDefault);
- });
// allow to click checkbox by clicking on the label
$('#hlNotShowAgainMsg').click(function() { $('#disableDragHighlight').click();});
// click "add highlight" when enter is pressed in color input box
$("#hlColorInput").keyup(function(event){
if(event.keyCode == 13){
$(".ui-dialog-buttonset button:nth-child(3)").click();
}
});
- // activate the color picker
- var opt = {
- hideAfterPaletteSelect : true,
- color : $('#hlColorInput').val(),
- showPalette: true,
- showInput: true,
- preferredFormat: "hex",
- change: function() { var color = $("#hlColorPicker").spectrum("get"); $('#hlColorInput').val(color); },
- };
- $("#hlColorPicker").spectrum(opt);
- // update the color picker if you change the input box
- $("#hlColorInput").change(function(){ $("#hlColorPicker").spectrum("set", $('#hlColorInput').val()); });
}
- $("#hlColorPicker").spectrum("set", $('#hlColorInput').val());
-
if (hgTracks.windows) {
var i,len;
var newerPosition = newPosition;
if (hgTracks.virtualSingleChrom && (newPosition.search("multi:")===0)) {
newerPosition = genomePos.disguisePosition(newPosition);
}
var str = newerPosition + " \n";
var str2 = " \n";
str2 += "
\n";
var pos = parsePosition(newPosition);
var start = pos.start - 1;
var end = pos.end;
var selectedRegions = 0;
for (i=0,len=hgTracks.windows.length; i < len; ++i) {
var w = hgTracks.windows[i];