Ejemplo n.º 1
0
 def get_orthogonal(self, point):
   '''
   Return a unit vector orthogonal to self at point.
   
   Cases:
     zero members: default orthogonal
     one member: orthogonal to member
     many members: orthogonal to bounding box???
     
   Note the point is not necessarily outside the morph.
   '''
   if len(self) > 1:
     # print "Orthogonal of a composite morph is orthog to bounding box?????"
     '''
     It might be better to selectively hit only the frame primitive of some composites.
     But is the frame always drawn?
     To hitted member and let user slide between members?
     FIXME Aggregate the orthogonal of all members that intersect the point??
     '''
     # Note both bounds and point are in DCS
     return orthogonal.rect_orthogonal(self.bounds, point)
   elif len(self) == 1:
     return self[0].get_orthogonal(point)
   else:
     return vector.downward_vector() # upright
Ejemplo n.º 2
0
 def get_orthogonal(self, point):
     '''
 Return a unit vector orthogonal to self at point.
 
 Cases:
   zero members: default orthogonal
   one member: orthogonal to member
   many members: orthogonal to bounding box???
   
 Note the point is not necessarily outside the morph.
 '''
     if len(self) > 1:
         # print "Orthogonal of a composite morph is orthog to bounding box?????"
         '''
   It might be better to selectively hit only the frame primitive of some composites.
   But is the frame always drawn?
   To hitted member and let user slide between members?
   FIXME Aggregate the orthogonal of all members that intersect the point??
   '''
         # Note both bounds and point are in DCS
         return orthogonal.rect_orthogonal(self.bounds, point)
     elif len(self) == 1:
         return self[0].get_orthogonal(point)
     else:
         return vector.downward_vector()  # upright
Ejemplo n.º 3
0
 def new_layout_spec(self, event):
     """
 New layout_spec for a Stationed Handle Menu:
   axis vector is vertical
   vector is directed down
   benchmark is an offset from the glyph (so middle item is on glyph)
   opening item is the middle item
 
 Event opens the menu, here the event is a hit at any point.
 """
     # Controlee is a morph, but can be an empty morph (an empty model/document.)
     # Controlee is usually the document, i.e. point is in background.
     axis = vector.downward_vector()  # axis vertical, downward
     benchmark = layout.benchmark_from_hotspot(axis, event)
     # FIXME hardcoded to open at 1, should be the middle of the menu
     self.layout_spec = layout.LayoutSpec(event, benchmark, axis, opening_item=1)
     return self.layout_spec  # for debug
Ejemplo n.º 4
0
 def new_layout_spec(self, event):
     """
 New layout_spec for a Stationed Handle Menu:
   axis vector is vertical
   vector is directed down
   benchmark is an offset from the glyph (so middle item is on glyph)
   opening item is the middle item
 
 Event opens the menu, here the event is a hit at any point.
 """
     # Controlee is a morph, but can be an empty morph (an empty model/document.)
     # Controlee is usually the document, i.e. point is in background.
     axis = vector.downward_vector()  # axis vertical, downward
     benchmark = layout.benchmark_from_hotspot(axis, event)
     # FIXME hardcoded to open at 1, should be the middle of the menu
     self.layout_spec = layout.LayoutSpec(event,
                                          benchmark,
                                          axis,
                                          opening_item=1)
     return self.layout_spec  # for debug