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

Feat: add shift scroll and global scroll #143

Merged
merged 1 commit into from
Mar 18, 2024
Merged

Feat: add shift scroll and global scroll #143

merged 1 commit into from
Mar 18, 2024

Conversation

Zyie
Copy link
Member

@Zyie Zyie commented Mar 13, 2024

  • Add globalScroll option, which when set to false only scroll when he pointer is over the top of the scroll box
  • Add shiftScroll option, which when the scrollbox is horizontal forces the user to use the shift + scroll to move the scrollbox, better emulating how scroll boxes work on the browser

@CyberDex CyberDex merged commit 6d7deb4 into dev Mar 18, 2024
3 checks passed
@CyberDex CyberDex deleted the feat/scroll branch March 18, 2024 21:23
@TimAstier
Copy link

TimAstier commented Mar 19, 2024

That will be useful!

@Zyie Maybe a related use-case:
Is there a way to avoid triggering other (global?) wheel events when scrolling within a scrollbox?
I had to add some custom events to get this type of behavior.

Specifically, scrolling in a scrollbox would also trigger the wheel event of pixi-viewport (meaning, zoom in / out).

So I had to do something like:

scrollbox.on('pointerenter', () => {
      this._isScrollboxActive = true;
      this.game.engine.viewport.pauseWheel();
    });
    scrollbox.on('pointerleave', () => {
      this._isScrollboxActive = false;
      this.game.engine.viewport.resumeWheel();
    });
// A little bit hacky, cannot figure out how to avoid scrolling on any global wheel event
      if (this._isScrollboxActive === false) {
        this._scrollbox.scrollTop();
      }

As I understand, the fix from this PR will remove the need for 2).

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

Successfully merging this pull request may close these issues.

3 participants