瀏覽代碼

Popup menu at button midpoint

Mark Mine 23 年之前
父節點
當前提交
db8f2ba387
共有 1 個文件被更改,包括 3 次插入8 次删除
  1. 3 8
      direct/src/gui/DirectOptionMenu.py

+ 3 - 8
direct/src/gui/DirectOptionMenu.py

@@ -172,14 +172,9 @@ class DirectOptionMenu(DirectButton):
         # Compute bounds
         b = self.getBounds()
         fb = self.popupMenu.getBounds()
-        # Where did the user click his mouse?
-        if (base.mouseWatcherNode.hasMouse()):
-            xPos = base.mouseWatcherNode.getMouseX()
-            self.popupMenu.setX(render2d, xPos)
-        else:
-            # If no mouse watcher, use midpoint of menu button
-            xPos = (b[1] - b[0])/2.0 - fb[0]
-            self.popupMenu.setX(self, xPos)
+        # Position menu at midpoint of button
+        xPos = (b[1] - b[0])/2.0 - fb[0]
+        self.popupMenu.setX(self, xPos)
         # Try to set height to line up selected item with button
         self.popupMenu.setZ(
             self, self.minZ + (self.selectedIndex + 1)*self.maxHeight)