dimanche 25 mai 2014

How to know when a draggable is ready to receive setOffset()

I have a container with a draggable declared like this:


Code:



Ext.define("App.view.FaderControl", {
extend: 'Ext.Container',
xtype: 'fadercontrol',
config: {
...
items: [
{
xtype: 'container',
...
},
{
xtype: 'container',
cls: 'fader-knob',
width: 50,
height: 80,
draggable: {
direction: 'vertical'
},
zIndex: 10
}
],
listeners: {
painted: 'updateSizes'
}
}

If in that updateSizes method I try to set its initial position (from a dynamic data source) like this,


Code:



var drag = me.down('container[cls=fader-knob]').getDraggable();
drag.setOffset(0, some_val);

I find that the draggable does not change its position. setInitialOffset() doesn't do anything either.

In fact, there appears to be a random amount of "loading" time after the component is painted and before the draggable starts responding to setOffset(). I have quite a few of these things so the delay is in the order of 0.5-1 second on my iPad 3 using the home-screen browser. Is there some sort of event I can hook in to know when it's ready to be updated? The draggable itself only has the drag* events. Thanks.





Aucun commentaire:

Enregistrer un commentaire