omniJS – plans for writable (& copyable) HorizontalTextAlignment?

I notice that:

  • Copy as JavaScript doesn’t yet include horizontal text alignment
  • The API reference lists the HorizontalTextAlignment properties as read-only

Does it look likely that we will be able to set horizontal alignments from omniJS, and pick them up in Copy As JS ?

I have a feeling that there may have been some discussion of plans for text properties, but I haven’t tracked it down or remembered where. Forgive me for amnesia, if that’s right

PS Perhaps I am thinking of this thread:


  1. Setting graphic.textHorizontalAlignment does already work
  2. But the (center | left | right | justify) text alignments are not yet included in the result of Edit > Copy As > JavaScript

[details=For reference – setting a text alignment – click to view code]```Javascript
// Reference to selected shape
shape =[0][0]

-> [object Shape]

// Querying the horizontal alignment of the shape’s text

-> [object HorizontalTextAlignment: 2]

// Checking the textual name of HorizontalTextAlignment 2
shape.textHorizontalAlignment === HorizontalTextAlignment.Right

-> true

// Changing the horizontal text alignment
shape.textHorizontalAlignment = HorizontalTextAlignment.Center

-> [object HorizontalTextAlignment: 1]

// Checking the new alignment
shape.textHorizontalAlignment === HorizontalTextAlignment.Center

-> true

This thread is probably outdated by other comments elsewhere, but for anyone who might stumble across this one before finding the others:

In 7.4, Copy as JavaScript in v7.4 does report the text alignment as long as it’s not using the default alignment (i.e., centered). For example, I just selected a left-aligned shape and Copy as JavaScript reports:

g1.textHorizontalAlignment = HorizontalTextAlignment.Left

That said, there’s a bug in v7.4 for Mac where setting the text on a shape loses track of its alignment setting, so you end up with left-aligned text unless you set the alignment again afterwards. This is fixed on the trunk (for v7.5) as of r292845.

1 Like