mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-04 02:42:49 -04:00
is_mouse_open
This commit is contained in:
parent
71735a5ff4
commit
c760784dbb
@ -21,13 +21,26 @@
|
||||
// Function: MouseWatcher::has_mouse
|
||||
// Access: Published
|
||||
// Description: Returns true if the mouse is anywhere within the
|
||||
// window, false otherwise.
|
||||
// window, false otherwise. Also see is_mouse_open().
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE bool MouseWatcher::
|
||||
has_mouse() const {
|
||||
return _has_mouse;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: MouseWatcher::is_mouse_open
|
||||
// Access: Published
|
||||
// Description: Returns true if the mouse is within the window and
|
||||
// not over some particular MouseWatcherRegion that is
|
||||
// marked to suppress mouse events; that is, that the
|
||||
// mouse is in open space within the window.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE bool MouseWatcher::
|
||||
is_mouse_open() const {
|
||||
return _has_mouse && !_suppressed;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: MouseWatcher::get_mouse
|
||||
// Access: Published
|
||||
|
@ -44,6 +44,7 @@ TypeHandle MouseWatcher::_button_events_type;
|
||||
MouseWatcher::
|
||||
MouseWatcher(const string &name) : DataNode(name) {
|
||||
_has_mouse = false;
|
||||
_suppressed = false;
|
||||
_current_region = (MouseWatcherRegion *)NULL;
|
||||
_button_down_region = (MouseWatcherRegion *)NULL;
|
||||
_button_down = false;
|
||||
@ -526,12 +527,12 @@ transmit_data(NodeAttributes &data) {
|
||||
}
|
||||
}
|
||||
|
||||
bool suppress_below = false;
|
||||
_suppressed = false;
|
||||
if (_current_region != (MouseWatcherRegion *)NULL) {
|
||||
suppress_below = _current_region->get_suppress_below();
|
||||
_suppressed = _current_region->get_suppress_below();
|
||||
}
|
||||
|
||||
if (suppress_below) {
|
||||
if (_suppressed) {
|
||||
// We used to suppress *everything* below, but on reflection we
|
||||
// really only want to suppress the mouse position information.
|
||||
// Button events must still get through.
|
||||
|
@ -65,6 +65,7 @@ PUBLISHED:
|
||||
bool remove_region(MouseWatcherRegion *region);
|
||||
|
||||
INLINE bool has_mouse() const;
|
||||
INLINE bool is_mouse_open() const;
|
||||
INLINE const LPoint2f &get_mouse() const;
|
||||
INLINE float get_mouse_x() const;
|
||||
INLINE float get_mouse_y() const;
|
||||
@ -122,6 +123,7 @@ private:
|
||||
Groups _groups;
|
||||
|
||||
bool _has_mouse;
|
||||
bool _suppressed;
|
||||
LPoint2f _mouse;
|
||||
|
||||
PT(MouseWatcherRegion) _current_region;
|
||||
|
Loading…
x
Reference in New Issue
Block a user