Back Midas Rome Roody Rootana
  Midas DAQ System  Not logged in ELOG logo
Entry  05 Nov 2022, Zaher Salman, Suggestion, histories capture 'ruy' 
    Reply  08 Feb 2023, Stefan Ritt, Suggestion, histories capture 'ruy' 
       Reply  09 Feb 2023, Zaher Salman, Suggestion, histories capture 'ruy' 
          Reply  09 Feb 2023, Stefan Ritt, Suggestion, histories capture 'ruy' 
Message ID: 2455     Entry time: 08 Feb 2023     In reply to: 2446     Reply to this: 2456
Author: Stefan Ritt 
Topic: Suggestion 
Subject: histories capture 'ruy' 
> The histories capture key events from 'r' 'u' 'y' and 'Escape' for various functions like rescaling etc. However, this also means that if we include an editable modbvalue and a history in the same custom page then changing the modbvalue to something that includes 'ruy' is not possible.
> 
> In mhistory.js we have
> 
> // Keyboard event handler (has to be on the window!)
> window.addEventListener("keydown", this.keyDown.bind(this));
> 
> I am not sure why it "has to be on the window". For now, I am bypassing this issue by changing the event listener to "keyup" but maybe there is a more elegant solution for this. Adding the event listener to the div element that includes the history does not seem to work.

I could reproduce the problem. I see two options there:

1) We replace 'r' with 'Ctrl-r' etc. 

2) We change the history JS code not to process keyboard inputs if we are currently editing a value.

I added 2) to give it a try. It works fine for me. The additional code is

MhistoryGraph.prototype.keyDown = function (e) {
   // don't consume events if we are editing a value
   if (e.target.tagName === "INPUT")
      return;
   ...
}


Feedback is welcome.

Stefan
ELOG V3.1.4-2e1708b5