Browse Source

*** empty log message ***

David Rose 25 years ago
parent
commit
a8c25410f2
2 changed files with 17 additions and 6 deletions
  1. 16 6
      panda/src/tform/mouseWatcher.cxx
  2. 1 0
      panda/src/tform/mouseWatcher.h

+ 16 - 6
panda/src/tform/mouseWatcher.cxx

@@ -20,6 +20,7 @@
 TypeHandle MouseWatcher::_type_handle;
 
 TypeHandle MouseWatcher::_xyz_type;
+TypeHandle MouseWatcher::_pixel_xyz_type;
 TypeHandle MouseWatcher::_button_events_type;
 
 ////////////////////////////////////////////////////////////////////
@@ -282,19 +283,26 @@ transmit_data(NodeAttributes &data) {
     }
   }
 
+  bool suppress_below = false;
+
   if (_button_down_region != (MouseWatcherRegion *)NULL) {
     // We're currently holding down a button.  This is the effective
     // region that determines whether we suppress below.
-    if (_button_down_region->get_suppress_below()) {
-      data.clear();
-    }
+    suppress_below = _button_down_region->get_suppress_below();
 
   } else if (_current_region != (MouseWatcherRegion *)NULL) {
     // We're not holding down a button, but we are within a region.
     // Use this region to determine whether we suppress below.
-    if (_current_region->get_suppress_below()) {
-      data.clear();
-    }
+    suppress_below = _current_region->get_suppress_below();
+  }
+
+  if (suppress_below) {
+    // 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.
+
+    data.clear_attribute(_xyz_type);
+    data.clear_attribute(_pixel_xyz_type);
   }
 }
 
@@ -313,6 +321,8 @@ init_type() {
   Vec3DataTransition::init_type();
   register_data_transition(_xyz_type, "XYZ",
 			   Vec3DataTransition::get_class_type());
+  register_data_transition(_pixel_xyz_type, "PixelXYZ",
+			   Vec3DataTransition::get_class_type());
   ButtonEventDataTransition::init_type();
   register_data_transition(_button_events_type, "ButtonEvents",
 			   ButtonEventDataTransition::get_class_type());

+ 1 - 0
panda/src/tform/mouseWatcher.h

@@ -111,6 +111,7 @@ public:
 
   // inputs & outputs 
   static TypeHandle _xyz_type;
+  static TypeHandle _pixel_xyz_type;
   static TypeHandle _button_events_type;