How to prevent Scroll Box from consuming touch event in Unreal? - unreal-engine4

I am working on a UI system for a mobile game in Unreal. I have functionality already in place that basically reads in if the player has swiped by basically getting the player's initial touch location and then checking if the player moves their finger a certain pixel distance and then it changes between pages.
I am trying to add a scroll box to the page as I find that not all of my content will fit on the screen. However, now that I have added it to my Widget, my swiping function no longer works. I am assuming this is because the scroll box is consuming the touch event. Is there a way to make it so that the scrolling does not consume the input event?

I had the same problem but unfortunately, I couldn't find how to continue to read touch events.
As a workaround, I created my own scrollbox, so that I could read the finger location while I'm scrolling.

Related

Continuously scrolling UI Unity

So I am working working on something in unity (2d game). I have a list of button (UI) on my scene and I want to implement a scrolling mechanism. What is the best way to go about it? Currently , I can scroll through horizontally because I have added a "scroll rect" to the the canvas holding the buttons as I start the game. However when I try to scroll back (horizontally, it goes beyond the Buttons. Is there a way to make the scrolling continuous such that as I scroll, from the first UI element when I get to the last one and I keep scrolling, it continues with the first element. or what should I do. please let me Know If i should clarify.
In the Scroll rect you can set the movement type. I don't think the kind of "infinite scroll" you are asking for is available.
For your case, I think that the Use Elastic or Clamped mode to force the content to remain within the bounds of the Scroll Rect should do the work.
In the case of the infinite scroll specifically needed, you would need to ask for that explicitely and show your attempt for more specific help.

Dealing with Popup in Corona game engine

I have a screen in Corona to display a puzzle, and once user guess the correct answer, I'm going to display a simple pop up on the screen to do the congratulation a long with close button to dismiss the popup, now I need for a simple work around to disable any control or behaviour on the original screen while displaying the popup, how can I do that?
I think you need to do this by stop or pause transitions, timers and animations etc. before you go to scene with pop up.
You can add transparent rectangle from transparent image file (not just rectangle, as it will not be touchable).
Size of this rectangle must be the size of all screen.
Position of rectangle - under your popup (or better make it as part of your popup).
Add listeners to this rectangle on touch and tap that will just return false - so it will prevent any clicks under it.
That will save you from pausing / disabling buttons, that you don't want to disable/pause.

Detecting if is zoom-in or zoom-out with leaflet

How can I know when the user is zooming in or zooming out? I want to start an animation if the user zooms after some level. Is it possible to know this when the event zoomstart is triggered?
How can I know when the user is zooming in or zooming out?
At every zoom level, calculate how much map.getZoom() has changed.
Is it possible to know this when the event zoomstart is triggered?
No.
Consider the following scenario: A user, using a touchscreen (phone/tablet).
The user puts two fingers down on the screen. Half a frame after, one of the fingers moves a couple of pixels towards the center, triggering a pinch-zoom with a tiny change in the zoom level.
Your code catches the zoomstart and zoom events that happen inmediately after. "I know!" - your code says - "The user is zooming out!".
And then the user starts moving their fingers wider and wider, zooming in. And your code gets confused.
But the user changes their mind, and then starts zooming out for whatever reason. And then in again. And then out again. And then they lift the fingers and the zoom snaps to a zoom level.
This is why you can not know what the final zoom level is going to be when you listen to a zoomstart or zoom event in Leaflet.

How to know if the user has reached the edges of Webview?

I'm trying to develop an app based on the idea of the Twitter for iPad, with sliding panels (for this, I'm using stackscrollView https://github.com/Reefaq/StackScrollView).
I have a UIWebview inside a UIScrollView, what I need is a way to find if the user has "reached the edge" of the UIWebView. I mean, I want user being able to pan around the web view, zoom in/out. But, I would like to find a way to get noticed when some of the edges of the web view has been reached. When that happens, I don't want the webView to bounce (that's simple, bounce = FALSE), instead, I want that starting from this point, the ScrollView start to respond to the touch (Even with the finger of the user inside the webView).
Basically: I wanna to the same thing that Twitter for iPad does when it opens a panel to show a site: allow us to zoom in/out, panning around, and, when the edge is reached, the panel is swiped.
I think the way to go is using scrollView property of the UIWebview, but I don't know exactly how.
Any idea?

Handling touch events on UIImageViews

I have a UIImageView, above which I have multiple markers. All the markers are movable, i.e. when I touch a marker, I can move it all around the screen.
Problem: if I touch a marker, and I begin to move it to another place, if I cross another marker, the old marker is left in place of the new one, and I continue to move the new one. And I want to evade this somehow.
Thanks for the answer.
What are your markers? If they are UIView instances then I would suggest watching for touch events on them instead of the image view and then deal with the Z order while dragging.
I would also pay attention to touch up vs. touch moved to help with the issue of your stops and starts.
If they are not UIView instances then the issue sounds like it is with your touch down vs moved. i.e. you should keep track of what marker was touched on the down event and then ignore any events that hit another marker that are not down events until you get an up.
If these suggestions are not helpful then describing how you built your view structure would help.
Z-Order
When you receive a touch down event on a marker I would move it to the top of the z order of views within the parent. Then will allow it to visually slide over the other markers.