Jump to content
Search Community

how to be able to drag X/Y using 2 fingers via trackpad/ scroll event

Ivan Mocs test
Moderator Tag

Go to solution Solved by GreenSock,

Recommended Posts

I'm not quite sure what you're trying to do, but here's a fork that shows the "wheel" events triggering the onChangeY() callback on the Observer when you wheel while over the box: 

See the Pen RwdvdVL?editors=1010 by GreenSock (@GreenSock) on CodePen

 

If you're trying to sense touchmove events, you can use type "touch", but if you're trying to do multi-touch detection and gestures, that's not really what Observer is for. 

Link to comment
Share on other sites

7 minutes ago, GreenSock said:

I'm not quite sure what you're trying to do, but here's a fork that shows the "wheel" events triggering the onChangeY() callback on the Observer when you wheel while over the box: 

 

 

 

If you're trying to sense touchmove events, you can use type "touch", but if you're trying to do multi-touch detection and gestures, that's not really what Observer is for. 

maybe like on this site, can be swiped with a trackpad : https://amie.so/recap

Link to comment
Share on other sites

4 minutes ago, GreenSock said:

Maybe this will help: 

 

 

 

yep, like this! but the movement is inverted, when I swipe left, the object moves right, likewise when up, the object moves down,

 

I changed + to - in this code and it seems to fix the mistake

 

const myObserver = Observer.create({
  type: "wheel",
  wheelSpeed: 10,
  onChange(self) {
    xTo(getter("x") - self.deltaX);
    yTo(getter("y") - self.deltaY);
  }

});

 

a suggestion from me, maybe you can create a new option for draggables like the one at https://ilyashubin.github.io/scrollbooster/

which is emulateScroll

 

Thank you btw
 

Link to comment
Share on other sites

9 minutes ago, Ivan Mocs said:

 

yep, like this! but the movement is inverted, when I swipe left, the object moves right, likewise when up, the object moves down,

 

I changed + to - in this code and it seems to fix the mistake

 

const myObserver = Observer.create({
  type: "wheel",
  wheelSpeed: 10,
  onChange(self) {
    xTo(getter("x") - self.deltaX);
    yTo(getter("y") - self.deltaY);
  }

});

 

a suggestion from me, maybe you can create a new option for draggables like the one at https://ilyashubin.github.io/scrollbooster/

which is emulateScroll

 

Thank you btw
 

and this can lead to new problems, such as shifting without knowing the bounds.

image 21.jpg

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...