Переглянути джерело

adding ability to have highlighted menu items also change scale in addition to color

Chris Brunner 19 роки тому
батько
коміт
3224887a2b
1 змінених файлів з 6 додано та 0 видалено
  1. 6 0
      direct/src/gui/DirectOptionMenu.py

+ 6 - 0
direct/src/gui/DirectOptionMenu.py

@@ -21,6 +21,8 @@ class DirectOptionMenu(DirectButton):
             ('popupMarkerBorder', (.1, .1), None),
             ('popupMarkerBorder', (.1, .1), None),
             # Background color to use to highlight popup menu items
             # Background color to use to highlight popup menu items
             ('highlightColor', (.5, .5, .5, 1), None),
             ('highlightColor', (.5, .5, .5, 1), None),
+            # Extra scale to use on highlight popup menu items
+            ('highlightScale', (1, 1), None),
             # Alignment to use for text on popup menu button
             # Alignment to use for text on popup menu button
             # Changing this breaks button layout
             # Changing this breaks button layout
             ('text_align',  TextNode.ALeft, None),
             ('text_align',  TextNode.ALeft, None),
@@ -216,11 +218,15 @@ class DirectOptionMenu(DirectButton):
     def _highlightItem(self, item, index):
     def _highlightItem(self, item, index):
         """ Set frame color of highlighted item, record index """
         """ Set frame color of highlighted item, record index """
         item['frameColor'] = self['highlightColor']
         item['frameColor'] = self['highlightColor']
+        item['frameSize'] = (self['highlightScale'][0]*self.minX, self['highlightScale'][0]*self.maxX, self['highlightScale'][1]*self.minZ, self['highlightScale'][1]*self.maxZ)
+        item['text_scale'] = self['highlightScale']
         self.highlightedIndex = index
         self.highlightedIndex = index
 
 
     def _unhighlightItem(self, item, frameColor):
     def _unhighlightItem(self, item, frameColor):
         """ Clear frame color, clear highlightedIndex """
         """ Clear frame color, clear highlightedIndex """
         item['frameColor'] = frameColor
         item['frameColor'] = frameColor
+        item['frameSize'] = (self.minX, self.maxX, self.minZ, self.maxZ)
+        item['text_scale'] = (1,1)        
         self.highlightedIndex = None
         self.highlightedIndex = None
 
 
     def selectHighlightedIndex(self, event = None):
     def selectHighlightedIndex(self, event = None):