hiukim / mind-ar-js

Web Augmented Reality. Image Tracking, Face Tracking. Tensorflow.js
MIT License
2.14k stars 394 forks source link

[feature request] mindar-ui-scanning when target lost #309

Closed marcusx2 closed 1 year ago

marcusx2 commented 1 year ago

I like the mindar-ui-scanning overlay, but it only shows up before the very first time the target is found. If the user moves away from the target and it becomes lost, it doesn't come back. Can an option be added so that I can easily call the overlay when the target is lost? I think it makes sense to always have the scanning overlay when there is no target being tracked to tell the user to look for the target.

marcusx2 commented 1 year ago

As a workaround, I managed to do it like this

var targetLostCallback = function() {
document.querySelector('.mindar-ui-scanning')?.classList.remove('hidden');
};

When the target is found, the ui-scanning is removed automatically, but when the target is lost it runs the callback above to show the ui-scanning overlay again, by removing the 'hidden' class.

I still think this functionality should be built in though, with an option to show when target lost or not. I can't think why the user wouldn't want it to always show when the target is lost though, it makes much more sense to me.

veterinarypathology3d commented 1 year ago

I think it is a good idea, How to run this (scanning ui when target lost), Can you write it to run in code?

marcusx2 commented 1 year ago

As I explained, you can run the code snippet I gave as a callback to the targetLost event. Removing the 'hidden' class from the div with ui scanning makes the ui scanning show up again.

hiukim commented 1 year ago

fixed in v1.2.1