X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FModel%2Fpanelnode.cxx;h=be6889fda55d048d80e0a63044be888fcfbb5d82;hb=461b5fe00baac88933da3c6b89dddf6d832f6a7f;hp=8413da54ca018d677c1934c4badb6fa16dfe9f42;hpb=99cb08ef8756abf0819e89f73c852675c1e4fabd;p=flightgear.git diff --git a/src/Model/panelnode.cxx b/src/Model/panelnode.cxx index 8413da54c..be6889fda 100644 --- a/src/Model/panelnode.cxx +++ b/src/Model/panelnode.cxx @@ -7,13 +7,11 @@ #include -#include - #include #include #include "panelnode.hxx" -SG_USING_STD(vector); +using std::vector; // Static (!) handling for all 3D panels in the program. @@ -104,6 +102,11 @@ FGPanelNode::FGPanelNode(SGPropertyNode* props) m(1,i) *= 1.0/_ymax; } + _lastViewport[0] = 0; + _lastViewport[1] = 0; + _lastViewport[2] = 0; + _lastViewport[3] = 0; + dirtyBound(); // All done. Add us to the list @@ -154,6 +157,11 @@ FGPanelNode::computeBound() const bool FGPanelNode::doMouseAction(int button, int updown, int x, int y) { + if (_lastViewport[2] == 0 || _lastViewport[3] == 0) { + // we haven't been drawn yet, presumably + return false; + } + // Covert the screen coordinates to viewport coordinates in the // range [0:1], then transform to OpenGL "post projection" coords // in [-1:1]. Remember the difference in Y direction!