We use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it.

[Dictionaries] Changing property order

Home Forums Puzzles [Dictionaries] Changing property order

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #34370
    matthew
    Customer

    Hey guys,

    I am working on a stackable product configurator, built with differently sized segments. I am basing it on a premise that whenever I delete a segment that is not the last in the stack (eg. right in the middle), I need to move every object above the deleted object one level below. I used a dictionary to setup the stack, that goes like this:

    Artboard-1

    Here’s an example of a stack order created by random clicks (objects inside are cloned from within the scene):

    Artboard-1-copy

    Now after I delete an object in level 3 which in hereby example is “Blue3” I want all the objects in higher levels to move down one level, so now the order would be: { Level_0: “Yellow2”, Level_1: “Yellow3”, Level_2: “Blue2″, Level_3:”Yellow_4”, Level_4: “Yellow_5”, Level_5: “Blue4”, Level_6: null }

    How do I achieve this?

    #34404
    matthew
    Customer

    Hello, did anyone come up with an idea?

    #34452

    Hi,

    the order in a Dictionary (JavaScript’s Object type) is not guaranteed and cannot be controlled. You might use a List (JavaScript’s Array type) instead which allows for inserting items in desired positions.

    Chief 3D Verger | LinkedIn | Twitter

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.