forked from organicmaps/organicmaps
moved some methods into base classes, simplified some code.
This commit is contained in:
parent
c71f4daa84
commit
9be4f6f6fb
6 changed files with 24 additions and 15 deletions
|
@ -118,9 +118,4 @@ namespace gui
|
|||
|
||||
r->drawText(desc, pivot(), position(), text(), depth(), false, false);
|
||||
}
|
||||
|
||||
int Button::visualRank() const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -66,7 +66,6 @@ namespace gui
|
|||
yg::OverlayElement * clone(math::Matrix<double, 3, 3> const & m) const;
|
||||
vector<m2::AnyRectD> const & boundRects() const;
|
||||
void draw(yg::gl::OverlayRenderer * r, math::Matrix<double, 3, 3> const & m) const;
|
||||
int visualRank() const;
|
||||
|
||||
/// @}
|
||||
};
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
#include "element.hpp"
|
||||
#include "controller.hpp"
|
||||
|
||||
#include "../yg/overlay_renderer.hpp"
|
||||
|
||||
#include "../base/logging.hpp"
|
||||
|
||||
namespace gui
|
||||
|
@ -67,12 +69,14 @@ namespace gui
|
|||
controller->AddElement(e);
|
||||
}
|
||||
|
||||
void Element::offset(m2::PointD const & offs)
|
||||
void Element::draw(yg::gl::OverlayRenderer *r, const math::Matrix<double, 3, 3> & m) const
|
||||
{
|
||||
shared_ptr<Element> e = m_controller->FindElement(this);
|
||||
Controller * controller = m_controller;
|
||||
controller->RemoveElement(e);
|
||||
OverlayElement::offset(offs);
|
||||
controller->AddElement(e);
|
||||
for (unsigned i = 0; i < boundRects.size(); ++i)
|
||||
r->drawRectangle(boundRects()[i], color(state()), depth());
|
||||
}
|
||||
|
||||
int Element::visualRank() const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,6 +8,14 @@
|
|||
|
||||
#include "../std/map.hpp"
|
||||
|
||||
namespace yg
|
||||
{
|
||||
namespace gl
|
||||
{
|
||||
class OverlayRenderer;
|
||||
}
|
||||
}
|
||||
|
||||
namespace gui
|
||||
{
|
||||
class Controller;
|
||||
|
@ -61,7 +69,10 @@ namespace gui
|
|||
void invalidate();
|
||||
double visualScale() const;
|
||||
|
||||
void offset(m2::PointD const & offs);
|
||||
void setPivot(m2::PointD const & pv);
|
||||
|
||||
void draw(yg::gl::OverlayRenderer * r, math::Matrix<double, 3, 3> const & m) const;
|
||||
|
||||
int visualRank() const;
|
||||
};
|
||||
}
|
||||
|
|
|
@ -48,7 +48,7 @@ namespace yg
|
|||
|
||||
void OverlayElement::offset(m2::PointD const & offs)
|
||||
{
|
||||
m_pivot += offs;
|
||||
setPivot(pivot() + offs);
|
||||
setIsDirtyRect(true);
|
||||
}
|
||||
|
||||
|
|
|
@ -55,7 +55,7 @@ namespace yg
|
|||
m2::PointD const & pivot() const;
|
||||
virtual void setPivot(m2::PointD const & pv);
|
||||
|
||||
virtual void offset(m2::PointD const & offs);
|
||||
void offset(m2::PointD const & offs);
|
||||
|
||||
yg::EPosition position() const;
|
||||
void setPosition(yg::EPosition pos);
|
||||
|
|
Loading…
Add table
Reference in a new issue