problems with touch snag
Closed this issue · 9 comments
I was doing some brief testing on my phone and I find swipe to pick up working with pulling the vector out of the box, but once it is dropped it looks like I have to hit it directly to pick it up - which is hard on a phone. Is it possible to add swipe to pick up to the vectors?
Also adding same question re "axis dot" control? It is hard to pick up.
allowTouchSnag: true
is supposed to be the default for the new scenery DragListener
, which is what is used throughout this sim. But I'm having the same difficulty on iPad. I'll have to investigate.
Surprisingly, this is not a problem when dragging vectors out of the toolbox, where DragListener.createForwardingListener
is used.
There are 3 places where DragListener is used in this sim:
- the origin manipulator (uses
new DragListener
) - vectors on the graph (uses
new DragListener
) - vectors in the toolboxes (uses
DragListener.createForwardingListener
)
I verified that every one of the DragListeners in this sim is created with allowTouchSnag: true
.
On my iPad6 + iPadOS 13.1.3, the vectors in the toolbox behave reliably; they can always be snagged. The other cases don't snag almost all of the time, but occasionally do snag. So there's something odd going on here.
@jonathanolson can you please take a look?
@kathy-phet what version of iOS is your phone running?
Reply via Slack: iPhone 7 + iOS 12.4.1
Via Slack:
@kathy-phet notes that touch snag works in 1.0.0-dev.42, but does not work in 1.0.0-dev.43. (I have not confirmed or investigated yet.)
@kathy-phet also confirms that touch snag works from the vector toolbox, but not from the graph.
Looks like it's this PressListener being activated by drags or touches:
// Clicking in the graph clears the active (selected) vector.
// No need to remove, exists for the lifetime of the sim.
this.addInputListener( new PressListener( {
release: () => { graph.activeVectorProperty.value = null; }
} ) );
If it's necessary to have this as a PressListener, it should probably have attach: false
and pressCursor: null
. I'm curious as to why the deselect would be on a release, as a raw { down: ... }
listener might be better here?
I tested setting that listener to attach: false
and touch-snag then seems to work.
Thanks @jonathanolson.
This problem was introduced by #238.
In the above commit, I've converted to a raw 'down' listener. Vector deselection (by clicking on the graph) now occurs on pointer 'down'. This is consistent with vector selection, which also occurs on 'down'.
@arouinfar please review in master or 1.0.0-dev.49. You'll need an iPad or other touch device.
Looks good in dev.49