pressmove give offset

New Here ,
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

67

Likes

Translate

Translate

Report

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

1 Correct Answer

Adobe Community Professional , Jan 24, 2021
kglad Adobe Community Professional , Jan 24, 2021
try   function moveItem (e){e.currentTarget.x = e.stageX/stage.scaleX;e.currentTarget.y = e.stageY/stage.scaleY;} 

Likes

Translate

Translate
Jump to answer Jump to answer
Adobe Community Professional ,
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;

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Slishdf AUTHOR
New Here ,
Jan 24, 2021

Copy link to clipboard

Copied

Excellent!!!  Thanks!!!

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
kglad LATEST
Adobe Community Professional ,
Jan 24, 2021

Copy link to clipboard

Copied

you're welcome.

Likes

Translate

Translate

Report

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