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

method moveRight doesn't work Or RTL support issues #146

Closed
1 task done
MortezaT opened this issue Jun 19, 2018 · 12 comments
Closed
1 task done

method moveRight doesn't work Or RTL support issues #146

MortezaT opened this issue Jun 19, 2018 · 12 comments

Comments

@MortezaT
Copy link

  • I'm submitting a ...
    • bug report
  • What is the current behavior?
    I got one issue report and one question to ask.
    1- I think currIndex has been set out of array boundary by mistake In function CurrentChildWith (line 274) and it should be set to length - 1 - just like the if statement's condition -. this stops move right
    2- I think there are lots of problems with RTL support since reachesRightBound is emits false in the very beginning and moveLeft works even after reaching left bound but it's not the same on right bound.
@bfwg
Copy link
Owner

bfwg commented Jun 22, 2018

Hi @MortezaT , sorry for the delayed response. Can you give me some reproducing steps and a use case so I can take a closer look? Thanks!

@MortezaT
Copy link
Author

Hi @bfwg, Thanks for the response.
Currently I'm pretty busy with some other stuff, but I'll do it ASAP.

@bfwg
Copy link
Owner

bfwg commented Jun 25, 2018

No problem, take your time.

@MortezaT
Copy link
Author

MortezaT commented Jul 7, 2018

here you can see my implementation. I hope this helps with the problem.

bfwg added a commit that referenced this issue Jul 11, 2018
bfwg added a commit that referenced this issue Jul 11, 2018
* refactor: add dragscroll item and refactor code

* fix: unit tests

* feat: fix unit test and update readme

* docs: update readme

* fix: fix ngc

* refactor: move template to inline

* feat: use inline-block for items

* fix: add sanity check to moveTo

* refactor: refactor build remove js files

* build: update .gitignore and .npmignore

* refactor: resolve issue mention in #146
@bfwg
Copy link
Owner

bfwg commented Jul 11, 2018

Hi @MortezaT , 2.0.0-beta.2 is out, let me know it made your implementation issue worst or better. Thanks!

@MortezaT
Copy link
Author

Neither beta.2 nor beta.3 worked at all.
they both come up with error which suggests that it hasn't been recognized by angular. Here is the error:

 Can't bind to 'scrollbar-hidden' since it isn't a known property of 'div'.

Did I miss something?

@bfwg
Copy link
Owner

bfwg commented Jul 14, 2018

Hi @MortezaT , 2.0.0 uses drag-scroll as the carousel host element instead of div. Also, to mark child elements, we need to use drag-scroll-item directive.

  <drag-scroll>
    <img drag-scroll-item src="some-url" />
    <img drag-scroll-item src="some-url" />
    <img drag-scroll-item src="some-url" />
  </drag-scroll>

More information can be found in the README.md.

Cheers.

@MortezaT
Copy link
Author

Hi @bfwg Thanks.
Is there any documentation for the new version, because It looks like they're way too different.
I can't understand why there is 20px addition to the width and height of .drag-scroll-content.

@bfwg
Copy link
Owner

bfwg commented Jul 16, 2018

To hide the scroll bar, we need to create a new wrapper div and insert the div between the parent div and the carousel div(.drag-scroll-content).

For example:
This is a normal carousel
image

When we try to hide the scrollbar, there is no magic! We simply create a wrapper div, and set the size of that wrapper div as the same as container div but minus its scrollbar width/height. The 20px is the height/weight of the scrollbar in the current browser.

image

Finally, we detach the container div, attach the wrapper div to parent div and insert the container div back to the wrapper div.

image

Since the wrapper's overflow attribute has been set to 'hidden', the scrollbars are no longer shown.
I hope my drawing skill is still up to the game 😛

Let me know if you have more questions, or if the new version is causing you any issues.

Thanks!

@MortezaT
Copy link
Author

MortezaT commented Jul 18, 2018

@bfwg
Thanks. Now with this visual explanation everything is obvious for me and I confess this is a smart idea.
Everything looks fine except the very first time navigation. I have to drag a little bit before ( just a bit not a complete photo) to get navs working.
Meanwhile method moveRight works at the moment and moves scroll to the left (end)

@bfwg
Copy link
Owner

bfwg commented Oct 25, 2018

I am going to close this issue. Please let me know if I need to reopen this. Thanks!

@bfwg bfwg closed this as completed Oct 25, 2018
@nicholasirsyad
Copy link

Dear @bfwg

In my case, when the webapp is opened in different sized windows sometimes the reachesRightBound or the moveRight() method does not work. Sometimes reachesRightBound does not return true when the carousel's already showing the last item.

It depends on the width of the windows too. When I dragged the window, my carousel adjust the width because I set it to width: 100%. But at certain widths, it seems the carousel is stuck - there seems to be an extra padding at the right that moveRight() wouldn't scroll. So the value for reachesRightBound always return false, even though it's already at the right most item.

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

3 participants