Reply To: centering scale when options have different lengths

PennController for IBEX Forums Support centering scale when options have different lengths Reply To: centering scale when options have different lengths

#4260
Jeremy
Keymaster

Oh, I see… Well, I’m afraid there is no straightforward adaptive solution. What you can do though is tweak the CSS of the labels to set a fixed width for the left and right labels, so they always both occupy the same space around the scale:

newText("Hello my dear dear friend, how are you doing on this very pleasant day?")
    .print()
,
newImage("bad", "no.png")
,
newImage("good", "ya.png")
,
newText("left label", "Baaaaaaaaaad")
    .settings.before( getImage("bad") )
    .settings.cssContainer({width: "30vw", "text-align": "right"})
,
newText("right label", "Good")
    .settings.after( getImage("good") )
    .settings.cssContainer({width: "30vw", "text-align": "left"})
,
newScale("judgment", 2)
    .settings.before( getText("left label") )
    .settings.after( getText("right label") )
    .settings.center()
    .print()
    .wait()

Of course you should feel free to play with the specific width you use (whether in vw/vh, px, em, etc.)

Jeremy