Align Currency Number in constant distance to actor based on amount. How?

BigDaveBigDave Member Posts: 2,239
edited June 2015 in Working with GS (Mac)

I'm sure some of you have a nice solution for this so here my question.

I have a currency icon and a display text behaviour next to it.
Now i want depending on the amount move the number next so they remain the same distance to the symbol even tough they go above the decimal etc.

Currency<10 = +12 pixels to the actor

Currency>100 = +24 pixel to the actor

Currency>1000= +36 pixels to the actor

Currency>10000= +48 pixel to the actor
etc.

I could do it by making separate behaviour for each with the conditions above but I would prefer an equation that will follow that behaviour endless.

Any idea?

Comments

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949

    Can you provide a sketch of what this should look like? I'm not clear on what the "actor" has to do with the position of the currency. Are you trying to display the currency amount to the left (or right) of another actor? Have you tried aligning the text left or right?

  • BigDaveBigDave Member Posts: 2,239
    edited June 2015

    hi @tatliang
    I now do align it and this works suprisingly fine.
    But still the position would need to adjust to the amount of numbers displayed here is how it is right now.

    As you see the coin is centred the text aligned on the right side of it.
    But the whole component is not perfectly centred anymore

  • BigDaveBigDave Member Posts: 2,239
    edited June 2015

    So with this approach I basically want to keep the actor centered considering the
    actor size + text length

  • BigDaveBigDave Member Posts: 2,239
    edited June 2015

    -deleted, ignore

  • BigDaveBigDave Member Posts: 2,239
    edited June 2015

    -

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949

    I see, so you want the currency symbol and value to be centered over the "stand" actor. Yes, I think you would need to add an offset pixel value as you suggested. Use a fixed width font.

  • BigDaveBigDave Member Posts: 2,239

    @tatiang Is there a way to get the digits displayed
    like 100 = 3 digits

    From there i could make a solid equation like
    3 digits * -12 Pixel (font size)

  • ArmellineArmelline Member, PRO Posts: 5,421
    edited June 2015

    Yes, just do textLength(number.attribute). That'll give you the number of digits.

    I'll see if I can dig out my left aligned custom font demo though, the easiest way is to just bake it all in to the custom font display.

  • BigDaveBigDave Member Posts: 2,239

    @Armelline @tatiang perfect thanks guys!

Sign In or Register to comment.