Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

convert direction to RTL instead of LTR #14

Open
aqeelhashem opened this issue Sep 24, 2016 · 3 comments
Open

convert direction to RTL instead of LTR #14

aqeelhashem opened this issue Sep 24, 2016 · 3 comments

Comments

@aqeelhashem
Copy link

Hi,
thanks for great plugin, How can convert the direction from LTR to RTL ?

@aqeelhashem aqeelhashem changed the title convert direction to RTL instead of LRT convert direction to RTL instead of LTR Sep 24, 2016
@terenceLuffy
Copy link
Owner

It is an interesting question, I never thought about it before because it is not much people use it this way. This control doesn't support that, however, it is simple too achieve it. All you need is just change one place.

In scrollViewWillEndDragging function, it determine where to stop the scrolling, so you just change the target position in this function to the place you want. Here could be a example, but you might need to adjust a little bit yourself to meet your needs.

open func scrollViewWillEndDragging(_ scrollView: UIScrollView, withVelocity velocity: CGPoint, targetContentOffset: UnsafeMutablePointer<CGPoint>) {
        let targetOffset:CGPoint = targetContentOffset.pointee;
        //move to closest item
        if (targetOffset.x + scrollView.frame.size.width < scrollView.contentSize.width) {
            let closestItemMinX = self.getClosestItemByX(position:targetOffset.x, inScrollView:(scrollView as! ASHorizontalScrollView))
            targetContentOffset.pointee.x =  closestItemMinX + (self.uniformItemSize.width - self.miniAppearPxOfLastItem)
        }
    }

@aqeelhashem
Copy link
Author

thanks terenceLuffy for fast reply,

but that did't change the direction.

I installed your sampleScorllViewInSwift and changed the method (scrollViewWillEndDragging) which you modify it , and it still start objects from left not from the right , and noticed that when finish dragging the objects move to right little bit, and not this what i want.

regards

@terenceLuffy
Copy link
Owner

I missed you last comment, would you explain your requirement with more details?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants