docsforadobe / Types-for-Adobe

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

ScriptUI: Margins class #115

Closed MikeOverbeck closed 9 months ago

MikeOverbeck commented 9 months ago

Following the pattern of other positional elements like Bounds, Dimension, and Point class, this adds a Margins class.

Usage:

const win = new Window('palette', 'testing panel', undefined, {
    resizeable: true,
})
const textGrp = win.add('group')
textGrp.margins = 10 // Margins may be defined by a single number
textGrp.margins = [0, 1, 1, 1] as Margins // otherwise must be asserted as Margins
textGrp.margins = {
    left: 10,
    right: 10,
    top: 10,
    bottom: 10,
} as Margins
;(textGrp.margins as Margins).left = 20 // to use margins props must be asserted as Margins
win.show()