本文整理匯總了Python中polygon.Polygon.select方法的典型用法代碼示例。如果您正苦於以下問題:Python Polygon.select方法的具體用法?Python Polygon.select怎麽用?Python Polygon.select使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類polygon.Polygon
的用法示例。
在下文中一共展示了Polygon.select方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: snap
# 需要導入模塊: from polygon import Polygon [as 別名]
# 或者: from polygon.Polygon import select [as 別名]
if snapgrid:
x = snap( x, 50, 10 )
y = snap( y, 50, 10 )
point = Point( x + model.position.x, y + model.position.y, model.position.z )
if leftClick:
if len( objects ) > 0 and objects[ -1 ].is_open():
actions.do( \
( objects[ -1 ].add, [ point ] ), \
( objects[ -1 ].remove, [ point ] ) \
)
else:
actions.do( \
( lambda a: objects.append( a ), [ Polygon( ( 100, 100, ( 200 + model.position.z * 2 ) % 255 ) ).add( point ) ] ), \
( objects.pop, [] ) \
)
elif rightClick and len( objects ) > 0 and objects[ -1 ].is_open():
actions.do( \
( lambda a: objects[ -1 ].add( a ).close(), [ point ] ), \
( lambda a: objects[ -1 ].remove( a ).open(), [ point ] ) \
)
if Mode.VISUAL == mode and leftClick:
selected = False
for polygon in objects:
if not selected and polygon.contains( model, pygame.mouse.get_pos() ):
polygon.select()
selected = True
else:
polygon.deselect()
leftClick, _, rightClick = pygame.mouse.get_pressed()
model.output( screen, mode, objects )