Page 1 of 1

removeFromZone and slideToObject not working during js setup?

Posted: 17 August 2020, 22:26
by CuriousTerran
During the game, I am able to use functions like removeFromZone and slideToObject in the notifications to move elements around without issues. However, when I try to implement removeFromZone and slideToObject inside the initial js setup, the elements do not move to the other elements. For instance a call in the setup like zone_obj.removeFromZone(<zone_id>, false, <other_id>);
will result in <zone_id> element staying in the zone parent, but overlapping with the other markers. Calling this.slideToObject().play() or trying to directly place element with this.placeOnObjectPos(), do not work in the js setup function either.
So, I am stumped. In the js setup I can create stock, zone, etc. objects add objects to them without problems. I have triple checked the id s of elements are correct and found the elements with I want to move and their location in the chrome debugging element review.

Any ideas about moving items in the js setup as opposed to other states of the game? Thank you for any suggestions.

Re: removeFromZone and slideToObject not working during js setup?

Posted: 18 August 2020, 08:40
by Quinarbre
I think I have stumbled upon the same kind of issue : setup occurs before history is loaded, and that latter step messes a bit some coordinates, making slideToObject or placeOnObject ineffective.

One workaround is to create (in your template) a specific div on the target location precisely where you want the objects to be placed (that div will be correctly placed by your css), and then have your objects appear in that div.

Re: removeFromZone and slideToObject not working during js setup?

Posted: 18 August 2020, 15:23
by CuriousTerran
Thank you for that suggestion. I will give that a try.