almende / chap-links-library

a web based visualization library for displaying graphs, networks, and timelines
http://almende.github.com/chap-links-library
Apache License 2.0
599 stars 167 forks source link

allow to change the event in the triggered event handlers #288

Closed diegovdev closed 10 years ago

diegovdev commented 10 years ago

Currently if you register an event handler:

links.events.addListener(mytimeline, 'add', modifyEventText);

Changes to the event inside the modifyEventText method are not displayed because in timeline.js the item is retrieved (on line 2938) before calling the handler (on line 2952) and is not updated after the handler and before calling updateData.

This simple PR fixes that :)

josdejong commented 10 years ago

Thanks!

There are three places though where timeline.trigger('add') is triggered, also in the functions repaintNavigation and onDblClick. Could you maybe fix these as well? Would be great.

diegovdev commented 10 years ago

Hi @josdejong,

I checked the triggers on repaintNavigation and onDblClick and they work fine. This bug was present only on 'onMouseUp' method when creating an event using ctrl+mouseselection.

The difference is that on onMouseUp there is a call to this.updateData() (line 2956) after the trigger wich was using values of item retrieved before the trigger. This call is not present on the other 2 creation methods so this fix is all we need =)

Regards...

josdejong commented 10 years ago

Ah indeed, you are right. Thanks!