forked from LeenkxTeam/LNXSDK
37 lines
1.2 KiB
Python
37 lines
1.2 KiB
Python
from lnx.logicnode.lnx_nodes import *
|
|
|
|
|
|
class WebviewGetDimensionsNode(LnxLogicTreeNode):
|
|
"""Gets the position or size of the given WebView"""
|
|
bl_idname = 'LNWebviewGetDimensionsNode'
|
|
bl_label = 'Webview Get Dimensions'
|
|
lnx_category = 'Krom Runtime'
|
|
lnx_section = 'webview'
|
|
lnx_version = 1
|
|
|
|
def update_sockets(self, context):
|
|
for o in self.outputs:
|
|
self.outputs.remove(o)
|
|
|
|
if self.property0 == 'position':
|
|
self.add_output('LnxIntSocket', 'X')
|
|
self.add_output('LnxIntSocket', 'Y')
|
|
else:
|
|
self.add_output('LnxIntSocket', 'Width')
|
|
self.add_output('LnxIntSocket', 'Height')
|
|
|
|
property0: HaxeEnumProperty(
|
|
'property0',
|
|
items=[('position', 'Position', 'Get X and Y position'),
|
|
('size', 'Size', 'Get width and height')],
|
|
name='Mode', default='position', update=update_sockets)
|
|
|
|
def lnx_init(self, context):
|
|
self.add_input('LnxIntSocket', 'ID')
|
|
|
|
self.add_output('LnxIntSocket', 'X')
|
|
self.add_output('LnxIntSocket', 'Y')
|
|
|
|
def draw_buttons(self, context, layout):
|
|
layout.prop(self, 'property0')
|