Profile picture for user jordanjt95

Hi everyone,

I'm trying to bring objects to the foreground, so I'm using the setZorder() function with 1000000 paramater.

for(var i = 0 ; i < objectList.length ; i++){
      
        objectList[i].setZOrder(1000000);
}

Some objects are brought to the foreground and some aren't.

Does someone have an explanation or a work around ?

cheers

by Nikita Martyanov
Posted on Thu, 02/10/2022 - 15:13

Hi Jordan,

there are two ways to solve the problem:

1) send all the occurrences of the model to the background with setZOrder(0) and then bring some of them to the front with setZOrder(N>0);

2) check all the occurrences on the model with getZOrder and get max ZOrder. Then bring some of the occurrences to the front with setZOrder(max+1).

---

BR, Nikita

 

0
by Jordan Tangy
Badge for 'Question Solver' achievement
Author
Posted on Sun, 02/13/2022 - 13:12

In reply to by billie1989

Hi Nikita, 

Thanks for your answer, 

I also found another solution.

In my script, I'm adding new Objects to a model and straight after an object is created , I apply the function. setZOrder, but still didn't work.

So what I did is that, after that all the objects were created, I create a separate for loop that runs on all the objects and apply setZOrder and it works.

Here is a pseudo code illustrating my solution

This solution didn't work:

for x:
  doSomeThing()
  for y:
     createObject()
     apply setZOrder Function for each object created

This solution worked :
for x:
  doSomeThing()
  for y:
     createObject()

for z:
  ApplySetZOrder()

 

0

Featured achievement

Question Solver
Share your expertise and have your answer accepted as best reply.
Recent Unlocks
  • CR
  • BH
  • Profile picture for user Ivan.Ivanov.softwareag.com
  • Profile picture for user mscheid
  • MS
  • PacMan

Leaderboard

|
icon-arrow-down icon-arrow-cerulean-left icon-arrow-cerulean-right icon-arrow-down icon-arrow-left icon-arrow-right icon-arrow icon-back icon-close icon-comments icon-correct-answer icon-tick icon-download icon-facebook icon-flag icon-google-plus icon-hamburger icon-in icon-info icon-instagram icon-login-true icon-login icon-mail-notification icon-mail icon-mortarboard icon-newsletter icon-notification icon-pinterest icon-plus icon-rss icon-search icon-share icon-shield icon-snapchat icon-star icon-tutorials icon-twitter icon-universities icon-videos icon-views icon-whatsapp icon-xing icon-youtube icon-jobs icon-heart icon-heart2 aris-express bpm-glossary help-intro help-design Process_Mining_Icon help-publishing help-administration help-dashboarding help-archive help-risk icon-knowledge icon-question icon-events icon-message icon-more icon-pencil forum-icon icon-lock