-
Notifications
You must be signed in to change notification settings - Fork 12
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
DragListener bug when computing localPoint when using "applyOffset" option #1014
Comments
@jonathan I ran into this again while converting a MovableDragHandler over in phetsims/gravity-force-lab#191 in I added this TODO in |
Note that in GFL, this is just a DragListener, it isn't being forwarded from anything. |
This bug is blocking phetsims/gravity-force-lab#191 (publication of GFL), so @ariel-phet recommended marking as high priority. |
Steps to reproduce this problem (in projectile-motion):
|
The problem in both of these cases was presumably the core difference in how MovableDragHandler and DragListener handle offsets. I've added an option to use the MovableDragHandler-style offsets (based in the parent coordinate frame, and requiring a locationProperty). The DragListener style I believe is superior for a range of cases (except for where we can't translate/transform one node), so I believe it's best to include both as options. Notably, if we're porting from MovableDragHandler, this option may be helpful to include (if the drag offset seems buggy). Is that worth documenting somewhere (in MovableDragHandler?) @zepumph can you review my changes? I'm available to discuss anything about these. |
This is looking very nice! I added doc directly to that option, since I feel like I wouldn't likely look at MoveableDragHandler if I was converting to use In Projectile Motion I think we are close, but it took the addition of I don't really trust my documentation much. Please review and see if I grasp this bug well enough to have documented it accurately. Otherwise I think we are good to close. |
All of the changes above look great, thanks! |
The title of the issue is my best guess of what this bug is, though I'm not sure. While working on phetsims/projectile-motion#183, @jessegreenberg @jonathanolson and I found that there was a bug with the DragListener in TracerNode.js
Basically when applying the below patch, dragging the tracer out of the toolbox will bring warp the tracerNode to the origin of the screenView (i.e. top left of layout bounds).
We think that this has to do with the following two lines of code in
DragListener.applyParentOffset
Somehow, even though the Tracer's initial position (in model) is 10,10, and the toolbox is far from any origin, after these two lines,
parentPoint
ends up being 0,0 in view coords.Another piece of data is that as we enter these two lines of code,
this._localPoint
has the same values asthis._parentPoint
. I am unable to comment any further on this issue, as I don't have enough knowledge about DragListener to suggest how that may or may not be buggy. Over to you @jonathanolson for when you finish up DragListener work. Tagging @ariel-phet as well to note one more issue for that work load.The text was updated successfully, but these errors were encountered: