Many operators use EXEC_DEFAULT which will execute their parameters.
You can use INVOKE_DEFAULT to make any operator invoke its modal method if it has one:
If you want an intelligent split that invokes the correct direction (vertical or horizontal), you can wrap it into a modal operator using mouse x,y threshold.
Edit:
And for menu:
layout.operator_context = "INVOKE_REGION_WIN"
op = layout.operator("screen.area_split", text="Split Y")
op.direction = 'VERTICAL'
op = layout.operator("screen.area_split", text="Split X")
op.direction = 'HORIZONTAL'
You can still choose axis using MMB during modal? The only difference between this operator invoked from a menu and the action zone, is that action zones will always invoke the perpendicular direction.
Or do you want it to choose split direction based on region dimensions?
What part of that code allows the mouse to work? Is it the operator_context? I tested every context option and never could get it to work. Although, I was doing pie menu.
For operators in menus, setting operator_context = *** is exactly the same as adding execution context in bpy.ops.something('***', kwargs). The difference is that operator_context is set for all consecutively placed operators until changed to something else. By default, operators in menus have an implied 'EXEC_REGION_WIN' which always executes an operator with default settings, but this can be overridden.
Iâm using a tweaked version of command_area_join.py from roaoaoâs example script included in PME. The old version doesnât work in 2.8 because Blender introduced exceptions with top and status bar.
the gif you show is not the result of the code you show. you give width and height of the region, so this is linked to the shape of the window, not the position of the mouse inside. but ok for the invokeâŚmaybe I give the exact way to do it later