Skip to content

Commit

Permalink
clean-up and document PM use of useParentOffset, phetsims/scenery#1014
Browse files Browse the repository at this point in the history
  • Loading branch information
zepumph committed Dec 13, 2019
1 parent 868b0d3 commit ee20b1e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
6 changes: 5 additions & 1 deletion js/common/view/ToolboxPanel.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,11 @@ define( require => {
// When pressed, forwards dragging to the actual tracer Node
tracerIconNode.addInputListener( DragListener.createForwardingListener( event => {
tracer.isActiveProperty.set( true );
tracer.positionProperty.value = transformProperty.value.viewToModelPosition( this.globalToParentPoint( event.pointer.point ) );

// offset when pulling out of the toolbox so that the pointer isn't on top of the tool. Convert to parent point
// because the TracerNode's DragListener is applying its pointer offset in the parent coordinate frame (see https://github.com/phetsims/scenery/issues/1014)
const parentPoint = this.globalToParentPoint( event.pointer.point.plusXY( -200, 0 ) );
tracer.positionProperty.value = transformProperty.value.viewToModelPosition( parentPoint );
tracerNode.dragListener.press( event, tracerNode );
}, { allowTouchSnag: true } ) );

Expand Down
1 change: 0 additions & 1 deletion js/common/view/TracerNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,6 @@ define( require => {
locationProperty: tracer.positionProperty,
transform: transformProperty.get(),
dragBoundsProperty: dragBoundsProperty,
offsetLocation: () => DRAG_OFFSET,
useParentOffset: true,
start: () => self.isUserControlledProperty.set( true ),
end: () => self.isUserControlledProperty.set( false ),
Expand Down

0 comments on commit ee20b1e

Please sign in to comment.