38 lines
		
	
	
		
			1.4 KiB
		
	
	
	
		
			Python
		
	
	
	
	
	
			
		
		
	
	
			38 lines
		
	
	
		
			1.4 KiB
		
	
	
	
		
			Python
		
	
	
	
	
	
from lnx.logicnode.lnx_nodes import *
 | 
						|
 | 
						|
class TouchInRegionNode(LnxLogicTreeNode):
 | 
						|
    """Detect touch in specific region.
 | 
						|
 | 
						|
    @input Center X/Y: The position of the center in pixels.
 | 
						|
    @input Width: Width of the region in pixels.
 | 
						|
    @input Height: Height of the region in pixels.
 | 
						|
    @input Angle: Rotation angle in radians. Rotation is clockwise.
 | 
						|
 | 
						|
    @output On Enter: Activated after the cursor enters the region.
 | 
						|
    @output On Exit: Activated after the cursor exits the region.
 | 
						|
    @output Is Inside: True if inside the region. False otherwise.
 | 
						|
    """
 | 
						|
    bl_idname = 'LNTouchInRegionNode'
 | 
						|
    bl_label = 'Touch In Region'
 | 
						|
    lnx_section = 'surface'
 | 
						|
    lnx_version = 1
 | 
						|
 | 
						|
    property0: HaxeEnumProperty(
 | 
						|
        'property0',
 | 
						|
        items = [('rectangle', 'Rectangle', 'Rectangular region'),
 | 
						|
                 ('ellipse', 'Ellipse', 'Elliptical or Circular region')],
 | 
						|
        name='', default='rectangle')
 | 
						|
 | 
						|
    def lnx_init(self, context):
 | 
						|
        self.add_input('LnxFloatSocket', 'Center X')
 | 
						|
        self.add_input('LnxFloatSocket', 'Center Y')
 | 
						|
        self.add_input('LnxFloatSocket', 'Width')
 | 
						|
        self.add_input('LnxFloatSocket', 'Height')
 | 
						|
        self.add_input('LnxFloatSocket', 'Angle')
 | 
						|
        self.add_output('LnxNodeSocketAction', 'On Enter')
 | 
						|
        self.add_output('LnxNodeSocketAction', 'On Exit')
 | 
						|
        self.add_output('LnxBoolSocket', 'Is Inside')
 | 
						|
 | 
						|
    def draw_buttons(self, context, layout):
 | 
						|
        layout.prop(self, 'property0')
 |