Skip to content
This repository has been archived by the owner on Jul 7, 2019. It is now read-only.

Commit

Permalink
Fix appGroup position in appList after drag
Browse files Browse the repository at this point in the history
  • Loading branch information
zqq90 committed Dec 17, 2016
1 parent 2aeb4e5 commit fe9a028
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/appGroup.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ AppGroup.prototype = {
_onDragEnd: function () {
this.rightClickMenu.close(false)
this.hoverMenu.close(false)
this.appList._fixAppGroupIndexAfterDrag(this);
this._applet._clearDragPlaceholder()
},

Expand Down
20 changes: 19 additions & 1 deletion src/appList.js
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,25 @@ AppList.prototype = {
}
return result
},


_fixAppGroupIndexAfterDrag: function (appGroup) {
let originPos = _.findIndex(this.appList, {appGroup: appGroup});
var pos = _.findIndex(this.manager_container.get_children(), appGroup.actor);
if (originPos === pos
|| originPos < 0
|| pos < 0) {
return;
}
if (pos > originPos) {
// TBD: if drag to a right position, exclude postion hold by origin
pos -= 1;
}
// originPos -> pos
let data = this.appList[originPos];
_.pullAt(this.appList, originPos);
this.appList.splice(pos, 0, data);
},

_windowRemoved: function (metaWorkspace, metaWindow, app=null) {

// When a window is closed, we need to check if the app it belongs
Expand Down

0 comments on commit fe9a028

Please sign in to comment.