Page 1 of 1

dojo placeOnObject & slideToObject limitation

Posted: 21 February 2017, 09:32
by Cowseye
Hi all,

I would like to check if this is an expected behavior:

I have a jstpl created token (A meeple for instance) that needs to be place (or slide) onto another jstpl created token (A randomly placed tile as a holder for meeples). This can be done as part of an onClick event. However, the token flew somewhere else unexpected when this is done during the setup function called during a refresh of the page. I had checked all variables passed for the meeple token to placeOnObject or slideToObject are referring to the correct tile.

Is this normal? What am I missing? Is it not possible to place or slide jstpl objects onto another during setup? I tried to rework my code place on space holder define in game.view.php and that works.

Re: dojo placeOnObject & slideToObject limitation

Posted: 21 February 2017, 10:42
by Andy_K
I suspect that your holder token hasn't finished moving by the time you attempt to slide your meeple token onto it, therefore the animation gets the wrong coordinates and your token goes astray.

You could either chain the animations, put a delay on, or else place the token on an object already defined in the view as you've already discovered.

Re: dojo placeOnObject & slideToObject limitation

Posted: 21 February 2017, 13:20
by Morgalad
also check that both objects have position absolute.

Re: dojo placeOnObject & slideToObject limitation

Posted: 21 February 2017, 17:02
by Cowseye
Thanks! Let me look at the tutorial for the chaining of animation!
All my objects have absolute position.

Re: dojo placeOnObject & slideToObject limitation

Posted: 21 February 2017, 17:08
by Cowseye
A quick edit of my code to use placeOnObject for the jstpl holder works!
Didn't know this may caused problems. Thank you Andy_K and Morgalad for your quick response!

Re: dojo placeOnObject & slideToObject limitation

Posted: 21 February 2017, 17:13
by Morgalad
Cowseye wrote:A quick edit of my code to use placeOnObject for the jstpl holder works!
Didn't know this may caused problems. Thank you Andy_K and Morgalad for your quick response!
YW!

That's why we are here... to help each others... aren't we? ;)