How can I disable dragging in one direction with a flickity wrapAround carousel? - flickity

I have a simple 30 item Flickity carousel with wrapAround set to true. Is there away to disable dragging from right to left but leave left to right dragging working?
I can turn it on/off like so:
$carousel.flickity('unbindDrag');
But I don't want it disabled in both directions

Related

iOS Spritekit Scrolling Menu

I am implementing a horizontal scrolling menu for a SpriteKit game and have become stuck as to how to go about this. My strategy was originally to add all of my menu items to the scene and just pan the camera horizontally according to swipes.
The problem with this is that the menu is revolving/circular (last item links to the first, etc) so even if I repeated the menu items infinitely, after swiping constantly one direction, I imagine a coordinate limit would be reached and the app would crash.
My next solution is to add one menu item in my camera view, one to the left, and one to the right. Then upon swiping the correct item would move into my camera view via SKAction and the original item would move away. I would then removechild the farthest node from the camera, and add the next item to the scene in the direction toward which I swiped. This way my x range (in points) would only be -displayWidth to displayWidth. The problem with this is that I would need to animate all of the menu items at the same time, and as they are separate nodes I have not seen a way to synchronize their animation.
Also I need to check the position of elements on the menu items and change their shaders when they reach the border of the screen. SKActions seem to block the SKScene update method so I am ideally trying to avoid SKActions.
Is there any viable strategy that I am missing here?
Since this is only a menu, it is ok to be a little inefficient.
What you do is have your menu cloned 2 times (so you have a total of 3). You place one of the clones to the left, and one to the right.
You then add all 3 of these into a parent SKNode. You should now have one SKNode with the 3 menu items in a long string. Make sure your anchor point is (0.5,0.5)
You then run the animation to pan left or right on the parent SKNode, with the condition that whenever you pass the edge of your original main menu, you jump in the opposite direction the width of the menu.
So let's say our menu is 400 (-199,200) points wide, and our screen is 300 points wide (-149,150). Once the parent point -200 (menu point 200 or right side of menu) aligns with screen point -150, you move the parent point to 200 (so menu point is -200 or left side of menu).
Since you are moving the parent node, all the clones will follow suit, and you only need to run 1 action.
I recommend using UIKit to create such a menu instead of SpriteKit. UICollectionView should be good for such a task.

How to scroll Firemonkey TListBox without capturing focus in its controls?

I have a TListBox with controls in each item, such as TEdit, TComboBox, TSwitch, etc, aligned to the right. There are about 20 items in this list, so it extends beyond the screen, and thus user needs to scroll (by sliding finger) to get to the bottom.
The problem is that even in a quick gesture, if user swipes their finger initially on one of these controls, that control takes focus and the list doesn't scroll. Currently, the only way to scroll up or down is to swipe the finger on the left side of the list, where there aren't any controls. I could disable HitTest or CanFocus, but then that control would never get focus, even when the user wants to actually tap on it.
How can I allow user to swipe up or down on these controls to scroll the list without that control taking focus?
I had the same issue.
To solve that insted using a TListBox I used a TVertScrollBox with a layout inside.
Each control is align to top and, to make it work, I needed a VKVertScrollBox from:
https://github.com/DelphiWorlds/KastriFree/tree/master/Demos/VKVertScrollbox
Doing so you will have a scrollable list of components where you can swipe your finger down and see it moving.
Besides, to avoid the entering and getFocus on each component when swiping you can use a helper on each component to catch the movement by overriding MouseDown, MouseMove and MouseUp and prevent entering overriding doEnter (also overrited) if it is moving (catched on MouseMove method).

How can I transfer a swipe from a UIScrollView to a UIPanGestureRecognizer?

Maybe a bad title, but I did my best.
Here's what I have: A menu on the left side, which can be opened by panning (from a small vertical bar to almost half my view). The designer thought it a good idea to insert a horizontally scrolling menu right there.
I made all this, but when I scroll horizontally in my menu (so not opening or closing the menu), I can't close the menu by swiping the scrollview more to the left, because it bounces (it also does not work when bouncing is off).
Does anyone have an idea how I can trigger my UIPanGestureRecognizer when the UIScrollView is scrolled beyond its right edge? Or any other idea how I can solve this?
The reason I made this title is because I have all the code for opening and closing the menu in my UIPanGestureRecognizer, and I think it's better if I just trigger the recognizer instead of re-writing some code.

Highmaps: how to disable map zoom by mouse scroll

I am able to display a map on a page. However, when I scroll up or down the page with the mouse middle scroll button (Logitech mouse), the map zooms in and out. I hope to disable it.
How can I do it?
There's option for that, see mapNavigation.enableMouseWheelZoom.

iCarousel – Make all items selectable, not just centered one

I'm using the great iOS control iCarousel's Wheel type and I want all of the buttons it contains to be usable / selectable at any time (i.e. I can tap any of them, no matter which one is currently at the top of the wheel). The user can still scroll the wheel as normal, but no matter which button they tap, it should register.
The current behavior seems inconsistent: if I tap one of the buttons directly next to the center one (to its left or right), that button moves into the center slot. Clicking one of the buttons two positions away 'sometimes' causes it to scroll to that letter, sometimes it's ignored. Any other buttons are always ignored.
Is this possible to set up, preferably without hugely modifying the class? I'm by no means an expert, but am learning every day :)
Thanks in advance.
Set carousel.centerItemWhenSelected = NO;
That will disable the behaviour where buttons other than the centre one are scrolled to the centre when you tap them.
As for the reason why some are not responding to taps at all, it is most likely because the frame of your carousel view is too small and the tap events are outside of the frame.
If you set carousel.clipsToBounds = YES; it will crop the carousel views to the frame as well so you'll be able to see exactly what size your carousel actually is.

Resources