NPellet / visualizer

Other
42 stars 24 forks source link

window.event is not defined on first click in spectra displayer #1059

Open lpatiny opened 7 years ago

lpatiny commented 7 years ago

I need with track information to know if shift is pressed or not.

The problem is that for an unknown reason the first time I click on the spectrum the window.event is not defined. After the first time it is ok.

Any way to solve this problem ? @targos

https://www.lactame.com/visualizer/src/index.html?config=../testcase/config/default.json&viewURL=../testcase/data/jcampViewer/view.json&dataURL=../testcase/data/jcampViewer/data.json

targos commented 7 years ago

I suggest you don't use window.event: https://developer.mozilla.org/en-US/docs/Web/API/Window/event

targos commented 7 years ago

Tracking the mouse is a real time event and you should use an action for it. Just configure the spectra displayer to send the event object

lpatiny commented 7 years ago

So in this case I would get a track hover that creates a variable and then an action with the event. In a code executor I listen to the action and make an API.getData('trackhover') to get the point. right ?

targos commented 7 years ago

You can also send the track data as an action before the event and cache it