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

pressmove give offset

Community Beginner ,
Jan 23, 2021 Jan 23, 2021

Copy link to clipboard

Copied

I'm trying to do a simple drag and drop using "pressmove."  The problem I'm having is that the object being dragged is only centered on the mouse pointer when it is a 0, 0 on the stage.  The further right I go, the more the object lags behind the cursor (object X  < cursor X).  The more down I go, the more the object lags in the Y direction.  So, it is perfect in the upper left-hand corner and totally off (~100 px) in both dimensions in the lower right corner.  What the heck?

 

var a17 = new lib.A17();
answer1Array.push(a17);
a17.addEventListener("pressmove", moveItem);


function moveItem (e){
e.currentTarget.x = e.stageX;
e.currentTarget.y = e.stageY;

Views

222

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

correct answers 1 Correct answer

Community Expert , Jan 24, 2021 Jan 24, 2021

try

 

function moveItem (e){
e.currentTarget.x = e.stageX/stage.scaleX;
e.currentTarget.y = e.stageY/stage.scaleY;

Votes

Translate

Translate
Community Expert ,
Jan 24, 2021 Jan 24, 2021

Copy link to clipboard

Copied

try

 

function moveItem (e){
e.currentTarget.x = e.stageX/stage.scaleX;
e.currentTarget.y = e.stageY/stage.scaleY;

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
Community Beginner ,
Jan 24, 2021 Jan 24, 2021

Copy link to clipboard

Copied

Excellent!!!  Thanks!!!

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
Community Expert ,
Jan 24, 2021 Jan 24, 2021

Copy link to clipboard

Copied

LATEST

you're welcome.

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