From d101f19e40d98c2f4c7f9f212e2048bc86b23a11 Mon Sep 17 00:00:00 2001 From: ZappoMan Date: Sun, 16 Feb 2014 13:39:01 -0800 Subject: [PATCH] removed bounds properties from Overlay so it only lives in Overlay2D --- interface/src/ui/Overlay.cpp | 36 ----------------------------------- interface/src/ui/Overlay.h | 11 ----------- interface/src/ui/Overlays.cpp | 2 +- 3 files changed, 1 insertion(+), 48 deletions(-) diff --git a/interface/src/ui/Overlay.cpp b/interface/src/ui/Overlay.cpp index c6b3902fd6..40da2253f4 100644 --- a/interface/src/ui/Overlay.cpp +++ b/interface/src/ui/Overlay.cpp @@ -33,42 +33,6 @@ Overlay::~Overlay() { } void Overlay::setProperties(const QScriptValue& properties) { - QScriptValue bounds = properties.property("bounds"); - if (bounds.isValid()) { - QRect boundsRect; - boundsRect.setX(bounds.property("x").toVariant().toInt()); - boundsRect.setY(bounds.property("y").toVariant().toInt()); - boundsRect.setWidth(bounds.property("width").toVariant().toInt()); - boundsRect.setHeight(bounds.property("height").toVariant().toInt()); - setBounds(boundsRect); - } else { - QRect oldBounds = getBounds(); - QRect newBounds = oldBounds; - - if (properties.property("x").isValid()) { - newBounds.setX(properties.property("x").toVariant().toInt()); - } else { - newBounds.setX(oldBounds.x()); - } - if (properties.property("y").isValid()) { - newBounds.setY(properties.property("y").toVariant().toInt()); - } else { - newBounds.setY(oldBounds.y()); - } - if (properties.property("width").isValid()) { - newBounds.setWidth(properties.property("width").toVariant().toInt()); - } else { - newBounds.setWidth(oldBounds.width()); - } - if (properties.property("height").isValid()) { - newBounds.setHeight(properties.property("height").toVariant().toInt()); - } else { - newBounds.setHeight(oldBounds.height()); - } - setBounds(newBounds); - //qDebug() << "set bounds to " << getBounds(); - } - QScriptValue color = properties.property("color"); if (color.isValid()) { QScriptValue red = color.property("red"); diff --git a/interface/src/ui/Overlay.h b/interface/src/ui/Overlay.h index 4f1cdc9edb..df898ec741 100644 --- a/interface/src/ui/Overlay.h +++ b/interface/src/ui/Overlay.h @@ -32,21 +32,11 @@ public: // getters bool getVisible() const { return _visible; } - int getX() const { return _bounds.x(); } - int getY() const { return _bounds.y(); } - int getWidth() const { return _bounds.width(); } - int getHeight() const { return _bounds.height(); } - const QRect& getBounds() const { return _bounds; } const xColor& getColor() const { return _color; } float getAlpha() const { return _alpha; } // setters void setVisible(bool visible) { _visible = visible; } - void setX(int x) { _bounds.setX(x); } - void setY(int y) { _bounds.setY(y); } - void setWidth(int width) { _bounds.setWidth(width); } - void setHeight(int height) { _bounds.setHeight(height); } - void setBounds(const QRect& bounds) { _bounds = bounds; } void setColor(const xColor& color) { _color = color; } void setAlpha(float alpha) { _alpha = alpha; } @@ -54,7 +44,6 @@ public: protected: QGLWidget* _parent; - QRect _bounds; // where on the screen to draw float _alpha; xColor _color; bool _visible; // should the overlay be drawn at all diff --git a/interface/src/ui/Overlays.cpp b/interface/src/ui/Overlays.cpp index 453367ca61..c35c4fc5ec 100644 --- a/interface/src/ui/Overlays.cpp +++ b/interface/src/ui/Overlays.cpp @@ -118,7 +118,7 @@ unsigned int Overlays::getOverlayAtPoint(const glm::vec2& point) { while (i.hasPrevious()) { i.previous(); unsigned int thisID = i.key(); - Overlay* thisOverlay = i.value(); + Overlay2D* thisOverlay = static_cast(i.value()); if (thisOverlay->getVisible() && thisOverlay->getBounds().contains(point.x, point.y, false)) { return thisID; }