omniJS – a use case, and a user-interaction question

Use case
An alternative auto-layout function for tree diagrams which:

  1. Provides the classic ‘Tidy’ or Reingold Tilford layout of org-charts etc, as an alternative to the built-in Graphviz ‘dot’ layout, in which parents are not necessarily centred over children, and
  2. Automatically switches magnets between North-South and East-West for vertical ⇄ horizontal tree direction toggling.
Graphviz 'dot' layout

'Tidy' (Reingold-Tilford) layout


Auto-layout Top Down ⇄ Left Right toggle without magnet adjustment

Direction toggle + magnet adjustment combined

Layout options
Similar to those of the built-in auto-layout:

  1. Tree direction options - top down, bottom up, left right, right left
  2. Gap options - vertical gap size between layers, horizontal gap size between siblings

omniJS user interaction question

How should we best specify direction and gap options for a platform-independent (iOS + macOS) version of an omniJS script that does this ?

(on MacOS a workable hack would be a conversation between omniJS and JavaScript for Automation (JXA), to borrow the latter’s UI widgets, but the options are less obvious for iOS, and it would be good to have a genuinely ‘write-once’ approach to user interaction in both iOS and macOS …)




(Perhaps this is not the perfect example of the general issue, because an omniJS script could read and use the settings for the built-in Auto-layout here, but the question is really about any script that allows the user to make a choice of some kind)

PS I think I may have mentioned before that this seems like a good iOS model, which would also work well on the macOS side:

http://1writerapp.com/docs/js/ui

http://1writerapp.com/docs/js

(and in fact, now I think about it, scripting iOS Omnigraffle from http://1writerapp.com/ might be an appealing option for some purposes, although list choice and text entry dialogs in OmniGraffle itself would be better in most cases)