Skip to main content
1-Visitor
February 24, 2019
Question

Invisible widgets, fire 'userpick' event

  • February 24, 2019
  • 2 replies
  • 2792 views

 

I was working on a view that has multiple images and labels in stack of each others (above each others), when I click on an image, I expect only the visible widgets to fire the click event, and it was the case until I upgrade vuforia this morning to 8.4.0.4300. Now, any item in the view is firing the click event! which causes a huge mess!

 

Note: this issue raise in preview page, in 3D view

2 replies

21-Topaz I
February 25, 2019

Hi @nqwifly ,

I did observe in the past similar behavior on 3d components which are not visible.  Therefore I also could expect in some cases similar behavior also for 2d components but  did not tested for 2 d components. So, need to clarify:

- is this first coming with the mention version or after some changes and  you did notice this problem on the new version

- is the issue only in preview ... or we have it on a end device

-what is code which causes the issue (means did you use javascript to define click lister – if yes then what is the code and/ or do you use the widget click event from UI - if this will fire for a hidden component (visible = false) -> I think it should be definitely wrong)

-what is the exact behavior.   So e.g. when you click on area where are many images and only one is visible. It will be ok if you have the click event only for the visible widget

But we could have a workaround for the case when the event fires for   all widget which contain the area of the click position. In this case we can check the property e.g.  visible of the widget and execute a particular event only for the visible widget

I think here an example (the simples possible) will be helpful more precisely to determine the issue

nqwifly1-VisitorAuthor
1-Visitor
February 26, 2019

Hi @RolandRaytchev

- is this first coming with the mention version or after some changes and  you did notice this problem on the new version

yes I'm pretty sure the upgrade cause the issue, because my colleague works on the same project with earlier version and has no issue.

 

- is the issue only in preview ... or we have it on a end device

Only on preview. On HoloLens everything works fine.

 

-what is code which causes the issue (means did you use javascript to define click lister – if yes then what is the code and/ or do you use the widget click event from UI - if this will fire for a hidden component (visible = false) -> I think it should be definitely wrong)

 

The event itself from the UI (from click even on the bottom, I link Javascript function to it). Most of the widgets visibility set to false [unchecked] though it fires the 'userpick' event

 

-what is the exact behavior.

The linked function does some behaviour like changing the visibility of other widgets

 

As this issue is currently only shown in preview, I can bear the testing on the actual device (which is time consuming). I'm expecting a solution from Vuforia development team rather than the workarounds. This issue raised just now, and I see no reason holding them back from resolving it (:

21-Topaz I
February 27, 2019

Hi @nqwifly,

 

thank you for the very detailed description.  So now every think was clear. So , I started to test the issue but had some difficulties. So, have some widgets:

 

2019-02-27_11-39-34.gif

 

As shown in the picture I defined a function which does some printing in the console and called it from the click event of the widgets / setup the click event in the UI

When tested it in preview:

 

2019-02-27_11-37-21.gif

 

I was able to see the printing for an userclick on the widget area when the widgets are visible.

After making the widget invisible I was not able to emit a click events for the hidden widgets clicking on the area where I will suppose the their position-> this was the case  for 2d tested elements. The only possible click event was possible for the 3D elements like Modelitems and 3dImages (this behavior I know also in the older releases) :

 

2019-02-27_12-06-42.gif

 

So, to summarize - I was no able to reproduce the issue yet. What is different in your case? What should I change in my test to be able to reproduce your problem?

21-Topaz I
February 25, 2019

Ok I see here you mentione the "userpick"... so I used in the past some costruct for 3d components like:

angular.forEach( //==== for each 3d model block
 // this will call the function below for each 3d model 
 $element.find('twx-dt-model'), function(value, key) { //for each 3d model block function
 //===============
 angular.element(value).scope().$on('userpick',function(event,target,parent,edata) {
 // start the $on() listener 'userpick' + function definition

 console.log('target');console.warn(target);
 console.log('edata');console.warn(edata);
 var pathid = JSON.parse(edata).occurrence;
	 $scope.currentSelection = target + "-" + pathid;
}) })

In this case I could expect that this customized userpick , could start also  for invisible elements . For 3d componets in the sample code above  it will fire. In this case then simple check the visibility property and exit if the element is not visible