ReactiveX / RxJavaFX

RxJava bindings for JavaFX
Apache License 2.0
519 stars 67 forks source link

Support scene accelerators #85

Open cebaa opened 5 years ago

cebaa commented 5 years ago

A shortcut for this:

Observable.generate(emitter -> {
         scene.getAccelerators().put(new KeyCharacterCombination("c"),
            () -> emitter.onNext(true));
      });
thomasnield commented 5 years ago

Can you put in a PR, thanks!

rcd27 commented 5 years ago

What kind of shortcut do you want to see as result? val keyCharObservable = eventsOf(scene, EventType<KeyCharacterCombination, "c">)?

cebaa commented 5 years ago

@rcd27

Since the signature is:

public ObservableMap<KeyCombination,Runnable> getAccelerators()

so maybe something like this:

val keyCharObservable = withAccelerator(scene, new KeyCharacterCombination("c"))
rcd27 commented 5 years ago

@thomasnield I think I'm able to do that