1

Ext.Containerがあり、ユーザーが移動可能なオブジェクトを追加する必要があります。

Ext.Windowがオブジェクトにネストされていないことがの場所でわかります。したがって、他の移動可能なExtオブジェクトに関する私のオプションは何ですか?

よろしく、キャスパー

4

4 に答える 4

7

この問題に戻ると、あなたの提案は途中で私を助けてくれました。パネルExtJSドキュメントでは、 draggableのカスタム実装を行う方法が提案されています。

draggable: {
//  Config option of Ext.Panel.DD class.
//  It's a floating Panel, so do not show a placeholder proxy in the original position.
    insertProxy: false,

//  Called for each mousemove event while dragging the DD object.
    onDrag : function(e){
//      Record the x,y position of the drag proxy so that we can
//      position the Panel at end of drag.
        var pel = this.proxy.getEl();
        this.x = pel.getLeft(true);
        this.y = pel.getTop(true);

//      Keep the Shadow aligned if there is one.
        var s = this.panel.getEl().shadow;
        if (s) {
            s.realign(this.x, this.y, pel.getWidth(), pel.getHeight());
        }
    },

//  Called on the mouseup event.
    endDrag : function(e){
        this.panel.setPosition(this.x, this.y);
    }
}

私のプロジェクトでは、コンテナー要素内にドラッグ可能な要素が必要だったので、何か特別なことをする必要がありました。
なんで? 位置情報の取得はbrowser-window-spaceで行われ、位置の設定はparent-spaceにあるように見えるためです。したがって、最終的なパネル位置を設定する前に位置を変換する必要がありました。

//  Called on the mouseup event.
endDrag: function (e) {
    if (this.panel.ownerCt) {
        var parentPosition = this.panel.ownerCt.getPosition();
        this.panel.setPosition(this.x - parentPosition[0], this.y - parentPosition[1]);
    } else {
        this.panel.setPosition(this.x, this.y);
    }
}

これが他の人に役立つことを願っています。また、ご意見をお寄せいただきありがとうございます:)

于 2010-07-28T07:15:04.330 に答える
3

でパネルを作成するdraggable:true

于 2010-06-24T14:47:25.087 に答える
1

よくわかりませんがfloating、パネルの属性を試すことができるかもしれません。

于 2010-06-24T10:50:20.420 に答える