docsforadobe / Types-for-Adobe

TypeScript types for Adobe: AfterEffects, Animate, Audition, Illustrator, InDesign, Photoshop, Premiere, ScriptUI.
517 stars 124 forks source link

Alignment, Justify, Orientation, TitleLayout, Window types #114

Closed MikeOverbeck closed 9 months ago

MikeOverbeck commented 9 months ago

This tightens up Alignment, Justify, Orientation, and Window types

This is a modification of https://github.com/aenhancers/Types-for-Adobe/pull/68 with merge conflicts resolved from the latest master, plus an _AlignmentPropertyTitleLayout interface for TitleLayout context.

Some boilerplate testing code :

const win = new Window('palette', 'testing panel', undefined, {
    resizeable: true,
})

win.alignChildren = 'invalidString' // fail
win.alignChildren = 'center'
win.alignChildren = ['fill', 'top', 'left'] // fail
win.alignChildren = ['fill', 'top']
win.alignChildren = [3, 2]

const textGrp = win.add('group')
textGrp.orientation = 'invalidString' // fail
textGrp.orientation = 'row'
const staticText = textGrp.add('statictext', undefined, 'here is some text', {
    truncate: 'none',
})
staticText.justify = 'invalidString' // fail
staticText.justify = 'left'

const tabbedPanel = win.add('tabbedpanel')
tabbedPanel.titleLayout.characters = 20
tabbedPanel.titleLayout.spacing = 5
tabbedPanel.titleLayout.characters = 12
tabbedPanel.titleLayout.justify = 'left'
tabbedPanel.titleLayout.truncate = 'end'
tabbedPanel.titleLayout.alignment = ['fill', 'top'] // fail, 'fill' is not a valid alignment value in this context
tabbedPanel.titleLayout.alignment = ['center', 'top']

win.show()

Relevant doc reference:

Alignment

https://extendscript.docsforadobe.dev/user-interface-tools/control-objects.html?highlight=TitleLayout#alignment

Justify

https://extendscript.docsforadobe.dev/user-interface-tools/control-objects.html?highlight=Justify#justify

Orientation

https://extendscript.docsforadobe.dev/user-interface-tools/window-object.html?highlight=orientation#orientation

TitleLayout

https://extendscript.docsforadobe.dev/user-interface-tools/control-objects.html?highlight=TitleLayout#titlelayout

Window Object Constructor

https://extendscript.docsforadobe.dev/user-interface-tools/window-object.html?highlight=Window#window-object-constructor