Is there a ***onEnd*** callback function for slideTemporaryObject ?

Game development with Board Game Arena Studio
Post Reply
User avatar
bidulpik
Posts: 79
Joined: 17 November 2011, 09:02

Is there a ***onEnd*** callback function for slideTemporaryObject ?

Post by bidulpik »

Hi,
i'm looking for a

onEnd callback function for slideTemporaryObject ?

Like for the dojo/anim function :

onEnd
A callback function which will be executed synchronously when the animation ends.
(https://dojotoolkit.org/reference-guide ... ation.html)

Any idea ?
User avatar
Tisaac
Posts: 2743
Joined: 26 August 2014, 21:28

Re: Is there a ***onEnd*** callback function for slideTemporaryObject ?

Post by Tisaac »

Just use this kind of wrapper :

Code: Select all

    slideTemporary(template, data, container, sourceId, targetId, duration, delay = 0) {
    	return new Promise((resolve, reject) => {
    		var animation = this.slideTemporaryObject(this.format_block(template, data), container, sourceId, targetId, duration, delay);
    		setTimeout(() => {
    			resolve();
    		}, duration + delay)
    	});
    },
(using promises instead of callback)
User avatar
Volker78
Posts: 66
Joined: 29 April 2020, 21:37

Re: Is there a ***onEnd*** callback function for slideTemporaryObject ?

Post by Volker78 »

A look at the source reveals:

Code: Select all

 slideTemporaryObject: function(_a79, _a7a, from, to, _a7b, _a7c) {
                        var obj = dojo.place(_a79, _a7a);
                        dojo.style(obj, "position", "absolute");
                        dojo.style(obj, "left", "0px");
                        dojo.style(obj, "top", "0px");
                        this.placeOnObject(obj, from);
                        var anim = this.slideToObject(obj, to, _a7b, _a7c);
                        var _a7d = function(node) {
                            dojo.destroy(node);
                        };
                        dojo.connect(anim, "onEnd", _a7d);
                        anim.play();
                        return anim;
                    },
So a dojo animation object seems to be returned..
Post Reply

Return to “Developers”