Add isLoaded to Overlays

This commit is contained in:
Atlante45 2014-07-29 13:25:34 -07:00
parent 28d4efbad6
commit 0bad10b09c
3 changed files with 30 additions and 12 deletions

View file

@ -255,10 +255,21 @@ function update(deltaTime){
}
frame++;
}
var locationChanged = false;
if (location.hostname != oldHost) {
print("Changed domain");
for (model in models) {
removeIndicators(models[model]);
}
oldHost = location.hostname;
locationChanged = true;
}
if (MyAvatar.position.x != avatarOldPosition.x &&
MyAvatar.position.y != avatarOldPosition.y &&
MyAvatar.position.z != avatarOldPosition.z) {
if (MyAvatar.position.x != avatarOldPosition.x ||
MyAvatar.position.y != avatarOldPosition.y ||
MyAvatar.position.z != avatarOldPosition.z ||
locationChanged) {
avatarOldPosition = MyAvatar.position;
var SEARCH_RADIUS = 50;
@ -285,14 +296,6 @@ function update(deltaTime){
showIndicators(true);
}
}
if (location.hostname != oldHost) {
print("Changed domain");
for (model in models) {
removeIndicators(models[model]);
}
oldHost = location.hostname;
}
}
var oldHost = location.hostname;

View file

@ -227,11 +227,23 @@ unsigned int Overlays::getOverlayAtPoint(const glm::vec2& point) {
i.previous();
unsigned int thisID = i.key();
Overlay2D* thisOverlay = static_cast<Overlay2D*>(i.value());
if (thisOverlay->getVisible() && thisOverlay->getBounds().contains(point.x, point.y, false)) {
if (thisOverlay->getVisible() && thisOverlay->isLoaded() && thisOverlay->getBounds().contains(point.x, point.y, false)) {
return thisID;
}
}
return 0; // not found
}
bool Overlays::isLoaded(unsigned int id) {
QReadLocker lock(&_lock);
Overlay* overlay = _overlays2D.value(id);
if (!overlay) {
_overlays3D.value(id);
}
if (!overlay) {
return false; // not found
}
return overlay->isLoaded();
}

View file

@ -38,6 +38,9 @@ public slots:
/// returns the top most overlay at the screen point, or 0 if not overlay at that point
unsigned int getOverlayAtPoint(const glm::vec2& point);
/// returns whether the overlay's assets are loaded or not
bool isLoaded(unsigned int id);
private:
QMap<unsigned int, Overlay*> _overlays2D;