@@ -207,20 +207,10 @@ export default function injectDependencies( Animated, PanResponder ){
207207 this . lastEnd = offset
208208 console . log ( offset )
209209
210- // Set relative boundaries to not to drag after them
211- if ( this . propAreas . boundaries ) {
212- let { minPoint, maxPoint} = this . propAreas . boundaries . influence
213- this . dragBoundaries = {
214- minPoint : { x : minPoint . x - offset . x , y : minPoint . y - offset . y } ,
215- maxPoint : { x : maxPoint . x - offset . x , y : maxPoint . y - offset . y }
216- }
217- }
218- else {
219- this . dragBoundaries = { }
220- }
210+ // Set boundaries to fast access
211+ this . dragBoundaries = this . propAreas . boundaries ? this . propAreas . boundaries . influence : { }
221212
222213 // Prepare the animation
223- let pos = { x : 0 , y : 0 }
224214 this . props . onDrag ( { state : 'start' , x : offset . x , y : offset . y } )
225215 this . dragStartLocation = { x : ev . x , y : ev . y }
226216 this . animator . removeTempBehaviors ( ) ;
@@ -238,9 +228,11 @@ export default function injectDependencies( Animated, PanResponder ){
238228 }
239229
240230 onDragging ( { dx, dy} ) {
241- let animated = this . getAnimated ( )
242- let x = dx + animated . x . _offset
243- let y = dy + animated . y . _offset
231+ let pos = this . getTranslation ( )
232+ let x = dx + pos . x
233+ let y = dy + pos . y
234+
235+ console . log ( this . dragBoundaries . minPoint )
244236
245237 let { minPoint, maxPoint} = this . dragBoundaries
246238 if ( ! this . props . verticalOnly ) {
@@ -267,14 +259,14 @@ export default function injectDependencies( Animated, PanResponder ){
267259 this . dragBehavior = null ;
268260 this . animator . isDragging = false
269261
270- let { animator, horizontalOnly, verticalOnly, dragWithSprings, boundaies } = this
262+ let { animator, horizontalOnly, verticalOnly, dragWithSprings } = this
271263
272264
273265 let velocity = animator . getVelocity ( ) ;
274266 if ( horizontalOnly ) velocity . y = 0 ;
275267 if ( verticalOnly ) velocity . x = 0 ;
276268
277- let toss = dragWithSprings && dragWithSprings . toss || this . props . dragToss ;
269+ let toss = ( dragWithSprings && dragWithSprings . toss ) || this . props . dragToss ;
278270 let { x, y} = this . getTranslation ( )
279271 let projectedCenter = {
280272 x : x + toss * velocity . x ,
@@ -283,7 +275,7 @@ export default function injectDependencies( Animated, PanResponder ){
283275
284276 console . log ( 'pc' , projectedCenter , velocity )
285277 let snapPoint = Utils . findClosest ( projectedCenter , this . props . snapPoints ) ;
286- let targetSnapPointId = snapPoint && snapPoint . id || "" ;
278+ let targetSnapPointId = ( snapPoint && snapPoint . id ) || "" ;
287279
288280 this . props . onDrag ( { state : 'end' , x : x , y : y , targetSnapPointId } )
289281
0 commit comments