Start a new topic

Snap Button

Hello, 


I've successfully added a virtual button that when clicked snaps the AR overlay onto the screen. I used the following bit of code. 

  

   var imgSnap2 = new AR.ImageResource("assets/snapButton.png", {
                    onError: World.onError
                });
                this.buttonSnap2 = new AR.ImageDrawable(imgSnap2, 0.1, {
                    translate: {
                        x: -0.27,
                        y: -0.01
                    },
                    onClick: World.toggleSnapping2
                    

                });

  

I want to replace the virtual button with a physical button on the device I'm using. The physical button is on the trackpad of Epson BT-300 smartglasses. The name of the button is the following. 


KEYCODE_DPAD_DOWN


Is it possible to amend the code above to achieve this? 


thanks 


Alan

1 Comment

Hi Alan,


You would need to handle the onclick event of the physical button in the native part, and then use the ArchitectView.callJavascript() method to use something that is declared in the javascript part as the World.toggleSnapping2 that you mentioned.


Here:  https://www.wikitude.com/external/doc/documentation/latest/Reference/Android%20Architect%20SDK%20API/index.html is the API reference for the native part.


Thank you,


Aitor.

Login or Signup to post a comment