Start a new topic
Solved

isVisible() not detecting visibility on-screen

Hello everyone, 


I'm currently trying to get isVisible to return the correct value, and to test it, I'm displaying the bool in a popup when the marker is selected on the screen. But isVisible() returns false, even though it's obviously on-screen (it has to be for it to be clicked!).


This is the snippet of code that I have:


var text = marker.markerObject.isVisible().toString();
$("#poi-detail-title").html(text);
$("#poi-detail-description").html(marker.poiData.description);

Am I using it incorrectly? It prints "false" in the popup.


Many thanks!



Hi Hanna,



your code is correct. I'm afraid the SDK is simply behaving incorrectly. Thank you for bringing this to our attention.


I do have a workaround available for you though.


If you set the onEnterFieldOfVision and onExitFieldOfVision callback functions of the AR.GeoObject of the Marker 'class' in the marker.js file, the visibility flag should be updated properly.


   

this.markerObject = new AR.GeoObject(markerLocation, {
	drawables: {
		cam: [this.markerDrawable_idle, this.markerDrawable_selected, this.titleLabel, this.descriptionLabel],
		indicator: this.directionIndicatorDrawable,
		radar: this.radardrawables
	},
	onEnterFieldOfVision: function() {},
	onExitFieldOfVision: function() {}
});

   

The callback functions may be empty; their presence simply circumvents this internal SDK limitation.



- Daniel


Hi Daniel,


Thanks for your input--much appreciated.  Unfortunately, this seems to not have fixed it. isVisible still returns false. My markerObject is like so:


this.markerObject = new AR.GeoObject(markerLocation, {
drawables: {
cam: [this.markerDrawable_idle, this.markerDrawable_selected, this.titleLabel, this.descriptionLabel],
indicator: this.directionIndicatorDrawable,
radar: this.radardrawables
},
onEnterFieldOfVision: function() {},
onExitFieldOfVision: function() {}
});


and my isVisible call is this:


var text = marker.markerObject.isVisible().toString();
// update panel values
$("#poi-detail-title").html(marker.poiData.title);
$("#poi-detail-description").html(text);

I've also attached the full files if you'd like to take a look--is there something I'm missing/misusing?the snippet directly above is unmoved from the original example, located in onMarkerSelected.


Essentially what I'm trying to make happen is, if you enter an actionArea and the marker is visible on-screen, a dialog drops down. I was thinking of alternatively having this happen all within OnEnterFieldOfVision, but I need to check if it's within the action area, as well, and I'm not sure how that could work within that function.


Many thanks!

js
js
(15.4 KB)

Hello Hanna,



I must say I'm surprised that it did not work for you. 


I ran the code at the time and ran it again now; successfully both times. I'd like you, if possible, to run the Wikitude sample app, try with the "Native Detail Screen" sample and report back to me whether that works or not.


It should be as simple as copying the two code snippets you provided to their respective locations in the sample.



Kind regards

Daniel

Hello Daniel,


I replaced all of my files with those in the sample, and I added the callback functions to the markerObject. I then replaced marker.poiData.description with marker.markerObject.isVisible().toString() in the popup. I even set an alert popup with the same, and it's still returning false.


I'm not sure what to do from here. Could it be I need to update the SDK? The version I have is from early March, I believe. I'll try updating to the newest release to see if that has anything to do with it, but until then, I don't suppose you have any more ideas/tricks up your sleeve?

I'm also unsure whether I'm replacing all of the files I'm supposed to to run the sample. It works, aside from isVisible(), but I've only been replacing the assets folder. Should I be replacing anything outside of that?


*Update*

I've just downloaded the latest SDK, but after replacing wikitudesdk.aar, I'm now getting a watermark that says "License Key Missing," even though I don't believe anything else has been changed, certainly not the license key--it hasn't been touched. I think I'll make a new topic for that, but this means I won't be able to test anything until that's fixed.

Good morning Hanna,



which version of the SDK are you using exactly? I'd like to try it and check whether I can get the same results you are reporting.


I've also only tested using iOS up until now. I would not expect that to make a difference, as the relevant code is all C++ and therefore identical for both platforms, but I'll check just in case.



- Daniel

Hi Daniel,


I believe it was 6.0.1, if I'm not mistaken.


Thank you for sticking with it and helping me, I really appreciate it.

Hello again,



using the workaround of supplying the empty callbacks worked on Android as well; using version 6.1.0 (slightly advanced state, but the changes should be unrelated and save me from switching all the branches locally).


Just to be sure, I'd like you to run the world I attached to this post and see what happens.


I'll try the 6.0.1 version.



- Daniel

zip

I just tried 6.0.1 on Android, same result for me. Now I'm excited to see what happens when you run the sample I sent.


I wouldn't expect it to make a difference, but are you using the JavaScript SDK directly or one of the extensions?



- Daniel

Hi Daniel,


Same result, as in, same result that I had? If so, then oh, excellent, I'm not going crazy! :'D I am using the JavaScript SDK, yes. And I will definitely run your sample when I get 6.1.0 up and running! I've actually found that the AR view runs fine with 6.0.1's wikitudesdk.aar, but it's when I replace it with that of the newer version's that the overlay appears. 


I'll report back once that's sorted out and I get to run it.

Hi Hanna,



I meant same result as in "the result I have been getting consistently". It worked for me in every case we've been going over.


Sorry about the ambiguous phrasing. :)



Kind regards

Daniel



Hi Daniel,


Darn it! Okay, I will be running your sample today and let you know what happens!

Hello again!


It appears it is now working. Don't know why, don't know how, maybe I changed a minor tidbit without knowing it which did something--who knows. BUT the important thing is that it is working, and I can't thank you enough for sticking with me. Your help was SO appreciated.  Thanks so much!!

Good morning Hanna,



you are very welcome. Happy to hear it's working now.



- Daniel

Login or Signup to post a comment