Skip to content
Snippets Groups Projects
Commit a5d1b6b3 authored by François  LAURENT's avatar François LAURENT
Browse files

time slider autofocus on entering viewer or tag selector

parent a0bcdbb1
No related branches found
No related tags found
No related merge requests found
Pipeline #82433 passed
...@@ -34,6 +34,12 @@ const LarvaTagger = (function () { ...@@ -34,6 +34,12 @@ const LarvaTagger = (function () {
}; };
} }
function focusOnTimeSlider(view) {
if (view === undefined)
view = document.getElementById("trackviewer");
view.querySelector("input[type=range]").focus()
}
function discardLarvaEdits(checkbox, observer, label) { function discardLarvaEdits(checkbox, observer, label) {
if (checkbox.checked) { if (checkbox.checked) {
checkbox.checked = false; checkbox.checked = false;
...@@ -74,7 +80,7 @@ const LarvaTagger = (function () { ...@@ -74,7 +80,7 @@ const LarvaTagger = (function () {
const frag = document.createRange().createContextualFragment(html); const frag = document.createRange().createContextualFragment(html);
const newtr = frag.firstChild.firstChild.firstChild; const newtr = frag.firstChild.firstChild.firstChild;
let tbody = table.getElementsByTagName('tbody')[0]; let tbody = table.getElementsByTagName('tbody')[0];
if (tbody == null) { if (tbody === undefined) {
tbody = document.createElement('tbody'); tbody = document.createElement('tbody');
table.appendChild(tbody); table.appendChild(tbody);
} }
...@@ -113,7 +119,7 @@ const LarvaTagger = (function () { ...@@ -113,7 +119,7 @@ const LarvaTagger = (function () {
const option = document.createElement('option'); const option = document.createElement('option');
option.value = String(i); option.value = String(i);
option.text = selectOptions[i]; option.text = selectOptions[i];
if (jlObserver != null) { if (jlObserver !== undefined) {
option.ondblclick = () => { option.ondblclick = () => {
JSServe.update_obs(jlObserver, selectOptions[i]); JSServe.update_obs(jlObserver, selectOptions[i]);
}; };
...@@ -157,6 +163,7 @@ const LarvaTagger = (function () { ...@@ -157,6 +163,7 @@ const LarvaTagger = (function () {
return { return {
toggle, toggle,
timeSlider, timeSlider,
focusOnTimeSlider,
discardLarvaEdits, discardLarvaEdits,
includeLarva, includeLarva,
includeAllLarvae, includeAllLarvae,
......
...@@ -383,6 +383,7 @@ function JSServe.jsrender(session::Session, av::AssayViewer) ...@@ -383,6 +383,7 @@ function JSServe.jsrender(session::Session, av::AssayViewer)
dom = DOM.div(r(session, av.plot), dom = DOM.div(r(session, av.plot),
r(session, av.player); r(session, av.player);
class="flex flex-col", class="flex flex-col",
onmouseenter=js"LarvaTagger.focusOnTimeSlider(this)",
) )
av.dom = dom av.dom = dom
return r(session, dom) return r(session, dom)
...@@ -905,7 +906,8 @@ function JSServe.jsrender(session::Session, ts::TagSelector) ...@@ -905,7 +906,8 @@ function JSServe.jsrender(session::Session, ts::TagSelector)
end end
JSServe.jsrender(session, JSServe.jsrender(session,
DOM.div(elements...; DOM.div(elements...;
class="flex flex-col")) class="flex flex-col",
onmouseenter=js"LarvaTagger.focusOnTimeSlider()"))
end end
function tagselector(controller; function tagselector(controller;
...@@ -940,6 +942,8 @@ function JSServe.jsrender(session::Session, tv::TrackViewer) ...@@ -940,6 +942,8 @@ function JSServe.jsrender(session::Session, tv::TrackViewer)
r(session, tv.tagselector); r(session, tv.tagselector);
class="flex flex-col", class="flex flex-col",
style="display: none;", style="display: none;",
id="trackviewer",
onmouseenter=js"LarvaTagger.focusOnTimeSlider(this)",
) )
tv.dom = dom tv.dom = dom
r(session, dom) r(session, dom)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment