Ext4.1 desktop 实现桌面图标可拖拽

Ext4.1 desktop 实现桌面图标可拖拽:
在 Desktop.js文件中的 initComponent 方法中 加入
me.shortcutsView.on('render', me.onRenderShortcut, me);
onRenderShortcut 方法如下
onRenderShortcut : function(v) {
var me = this;
me.shortcutsView.dragZone = new Ext.dd.DragZone(v.getEl(), {
getDragData: function(e) {
var sourceEl = e.getTarget(v.itemSelector, 10);
if (sourceEl) {
d = sourceEl.cloneNode(true);
d.id = Ext.id();
return {
ddel: d,
sourceEl: sourceEl,
sourceStore: v.store,
draggedRecord: v.getRecord(sourceEl)
}
}
},
getRepairXY: function() {
return this.dragData.repairXY;
},
onMouseUp : function(e){
var currDom = Ext.fly(this.dragData.sourceEl);
var oldXY = currDom.getXY();
var newXY = e.getXY();
var width = currDom.getWidth();
var height = currDom.getHeight();
if(Math.abs(oldXY[0]-newXY[0]) > width || Math.abs(oldXY[1]-newXY[1]) > height){
currDom.setXY(newXY);
Ext.get(this.dragData.sourceEl).frame('#8db2e3', 1);
}

}
});
}
ok 大功告成,现在桌面上的图标可以任意拖拽了.

效果图
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值