|
Back
Midas
Rome
Roody
Rootana
|
Midas DAQ System |
Not logged in |
|
|
05 Nov 2022, Zaher Salman, Suggestion, histories capture 'ruy'
|
08 Feb 2023, Stefan Ritt, Suggestion, histories capture 'ruy'
|
09 Feb 2023, Zaher Salman, Suggestion, histories capture 'ruy'
|
09 Feb 2023, Stefan Ritt, Suggestion, histories capture 'ruy'
|
|
Message ID: 2456
Entry time: 09 Feb 2023
In reply to: 2455
Reply to this: 2457
|
Author: |
Zaher Salman |
Topic: |
Suggestion |
Subject: |
histories capture 'ruy' |
|
|
I agree with you, option 2 is better and works well.
The only problem is that if you are showing multiple histograms in the same window the keyDown even will affect all of the histories in the window.
This may be the intended behaviour, but I think that if we can find a way to have the event affecting only the intended history (focused element for example) it would be better.
Zaher
> > 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 |