• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Mobile and desktop drag and drop

Participant ,
May 17, 2021 May 17, 2021

Copy link to clipboard

Copied

This Canvas project works beautifully on the desktop, but I need to enable a user to drag and drop the bar on a tablet or mobile device as well. I've seen several related posts, but none of those suggestions are working for me. I have made several substitutions for "pressmove" such as touchstart, touchmove, but doing so breaks the desktop function before I've had a chance to test on tablets.

 

var startDrag = startDragF.bind(this);

this.Bar.addEventListener("pressmove", startDrag);

function startDragF(e){

var p = stage.globalToLocal(e.stageX, e.stageY);

e.currentTarget.y = p.y;

};

 

 

TOPICS
Code , How to

Views

238

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
May 18, 2021 May 18, 2021

Copy link to clipboard

Copied

Wow, that was easy (after you gave me the code that is). Thank you.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Jun 23, 2021 Jun 23, 2021

Copy link to clipboard

Copied

LATEST

I just discovered this doesn't work on touch screen laptops. Just tablets and phones. What's different about laptops? And of course, what's the solution?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines