Start a new topic

onSnappedToScreen breaks my code. Please advise me why.

onSnappedToScreen breaks my code. Please advise me why.


Hello Andreas! 

We are experiencing a similar situation. What I have noticed is that onSnapToScreen function does not get called when used with enabledOnExitFieldOfVision.

I have tested it with Wikitude code from Examples folder(SnapToScreen). If World.trackable.snapToScreen.enabled = true is called, then onSnapToScreen function will get called. But if enabledOnExitFieldOfVision is set to true and World.trackable.snapToScreen.enabled is set to false then onSnapToScreen function does not get called. I am using snap to screen feature with video drawables. When user scans target image video starts to play and video drawable is positioned on top of target image. As soon as user takes camera view away from target image we need video drawable to snap to screen and continue playing. We used to use enabledOnExitFieldOfVision and when set to true, video drawable would snap to screen. It looks like it does not work anymore. 

Here is code from Wikitude Examples folder which does not trigger an alert when World.trackable.snapToScreen.enabled is set to false: 

snapToScreen: {

snapContainer: document.getElementById('snapContainer'),

                enabledOnExitFieldOfVision:true,

                onSnappedToScreen:   function myOnSnappedToScreen()

                                       {

                                                  alert("YES");

                                      }

}

Andreas, may I ask you to check this and let us know if this is an issue in SDK or we are not using API correctly? 

Thank you!

Sergey

 

 

 

 

Hi Sergey,
I did some tests and came to the same conclusion. The onSnappedToScreen function is not called when only using the enabledOnExitFieldOfVision property. We will fix this in the next version which will be released beginning 2015.

Best regards

Andreas

Thank you very much Andreas! We are very much looking forward to this fix as this feature is in a high demand by many customers. 

Sergey
Login or Signup to post a comment