How to get Notify of Input Mouse Released when using GameplayCueNotify_Looping - unreal-engine4

I have been working on a project based on Lyra Framework and am currently trying to implement a Weapon Ability: Charge_Ability - like Halo energy pistol. Here is my issue:
In the GCNL, I am attempting to Bind the OnReleased Mouse Click Event to the OnLoopingStart. Doing so, I expect the OnReleased Mouse Click Event to be fired when the input broadcast its message so I can release my “Charge Ability Bolt Fx”.
However, when running debug printString, the OnLoopingStart is never called. Only the OnRecurring Event is fire.
How can I properly register the OnRelease Event from the GCNL to retrieve input released from mouse click?
Thanks!

Related

How to make a button trigger an event (Timer)?

I am working on a fire evacuation project and would like to trigger an event after clicking a button. Basically I want to begin the fire evacuation process manually using the button feature but would like to trigger a timer for about 60 seconds to give the pedestrians time to evacuate using the event feature.
I have tried to make pedestrians stop the evacuation process by manually clicking another button but would like to use an event trigger timer instead as this will be a better way to conduct my simulation. I cannot seem to trigger an event once the button is clicked. I've tried changing the trigger type but not sure where to go from there. Is there any code that is required or another step that is required?
Even though a dynamic event is fine in your application, you can also use a user control event:
And then in your button you can use the following code:
event.restart(60,SECOND); //you can choose any timeout here
or
event.restart(); // this will use the configuration, which in this case I set up to 60 seconds
The difference between a dynamic event and a user controlled event is that if you click the button again:
With the dynamic event, you will generate another instance of the event, meaning that if you click the button at t=0 seconds, and t=30 seconds, you will generate 2 events at t=60 seconds and t=90 seconds
With the user control event, you will restart the same event. if you click the button at t=0 seconds, and t=30 seconds, you will generate a unique event at t=90 seconds.
So depending on which one you prefer... you can choose. I would prefer the user control in case you click the button 2 times... or if you regret clicking it so fast... I don't know
Use the Dynamic Event for this.
Set it up by pulling it from the AnyLogic Agent Library to the Workspace and give it a name (here: MyDynamicEvent).
Add the code you want to have executed when the timer runs off in the Action field
Set one (or several) timed instance for this event by using the code create_MyDynamicEvent(60,SECOND);. Note: The syntax of this statement is always create_ followed by the actual name you gave your DynamicEvent type.

how to properly fire Leaflet MarkerCluster clusterclick event

I would like to simulate a click to a MarkerClusterGroup. I am trying to fire the clusterclick event on a MarkerCluster using the method below:
clusterGroup.fire('clusterclick');
but I get:
Uncaught TypeError: Cannot read property 'zoomToBounds' of undefined
First you should realize that the "clusterclick" event is normally triggered by clicking on an individual cluster, not on the entire group. That event calls a specific behaviour that depends on the actual clicked cluster (typically, it zooms on the bounds of the markers contained within that cluster).
Therefore you are just missing an event data object that specifies which cluster is simulated to have been clicked on. It should be the 2nd argument of fire() method.
Another possibility would be to fire a "click" event directly on a selected cluster. That would automatically fire the "clusterclick" event on the group, with the correct event data object.

How to debug custom DOM events?

Is it possible to see (debug) custom events being fired from DOM elements in the browser?
Let's say I want to see which specific element of the Bootstrap Collapse fires the show.bs.collapse event, can I somehow see it for instance in Chrome dev tools?
First off, Monitor Events will handle this for normal JS events. However, Bootstrap events are jQuery events, so vanilla JS event listeners don't listen for them.
To listen to jQuery events run the following code snippet in your console:
jQuery('body').bind("show.bs.collapse", function(e){console.log(e);});
Replace "shown.bs.collapse" with whatever event you want. When they are logged, just check the target element for the event to know what fired it.
Now, for the other way around, to see what is listening to events. Within the elements panel, if you go to the event listener tab and uncheck "ancestors", then you will see only the directly bound event listeners on an element. This way you know what is listening for the event so you can inspect what should be done when it is fired. This matters, since you may find 'body' isn't getting the event, since it could have bubbling cancelled. So if the above snippet isn't working, you need to check for bubble cancelling in the element listening for the event.
Firefox offers out of the box, listeners for jQuery events, https://developer.mozilla.org/en-US/docs/Tools/Page_Inspector/How_to/Examine_event_listeners
But you can extend it: http://flailingmonkey.com/view-jquery-and-jquery-live-events-in-firefox-devtools/
You can use Visual Event 2 bookmarklet. Great tool used to inspect which events are attached to a specific DOM elements.

How to use touch event to instead of click event on mobile website

It seems that click event have delay on website on iphone, but the touchstart or touchend could response correctly, but how to use the only touchstart, touchend and touchmove to simulate click event? or even simulate the long press event on a website on iphone?
I think I can't bind the click handler directly to the touchstart or touchend event, one situation is that when the user press on the screen , fire the touchstart event , but if he don't want a click event, how can he cancel it, either I can't bind the handler to the touchend event.
So how can I simulate the click event with touchstart and touchend event?Is there conflict or something should I mentioned?Is there some post or article talk about how can I achieve this?
I just made a chrome extension for this purpose. It translate mousedown, mousemove, mouseup events to touchstart, touchmove, touchend. It actually simulate iphone5.
https://chrome.google.com/webstore/detail/touchphone-simulator/jijkpkhmnpbecppjhicgegndbbgfnngf
I use phantom-limbs.js. If you want more functions like gesture(which i excluded in my extension), visit brian's github.
https://github.com/brian-c/phantom-limb

DispatcherTimer blocks the UI from being updated?

I have two Buttons in the View, one for recording some sound, one plays the recording when recording is done. When recording is done, I set the VM property of recording_done to 1, which is used for CanPlay(), which enables the Play button. Everything works fine so far.
I added a timer to auto stop the recording after two seconds. after some trials and errors, I settled with a DispatcherTimer. My problem is the UI (Play button) does not gets enabled until I clicked the WPF window (somewhere/anywhere on the windows). Clearly the debug msg says the recording_done is set to 1. That should trigger the UI update, but it does not, until I clicked on the windows.
I tried both ways, 1. Recording button bind to Command in ViewModel, there I start the timer and stop the timer. 2. put the recording button handler and timer code in the view's code behind. similar problems.
Any suggestion? Is this a threading/UI update issue? Thanks.
If your play button is bound to a command, and the CanExecute() of the command is bound indirectly to the recording_done property or field, it won't update until the CanExecuteChanged event on the ICommand is raised, or until WPF decided to requery the commands. I suspect this is the problem - you need to have the ICommand raise CanExecuteChanged.