mirror of
https://github.com/GTNewHorizons/NotEnoughItems.git
synced 2026-11-11 16:07:38 +00:00
Add the ability to move bookmark groups between namespaces (#803)
Co-authored-by: Martin Robertz <dream-master@gmx.net>
This commit is contained in:
1 parent
2ba0773401
commit
24e46bb43e
2 files changed
+20
-1
No files matched your search
@@ -996,7 +996,7 @@ public class BookmarkPanel extends PanelWidget<BookmarkGrid> {
|
||||
@Override
|
||||
public boolean onMouseWheel(int shift, int mousex, int mousey) {
|
||||
|
||||
if (!inEditingState() && new Rectangle4i(
|
||||
if ((!inEditingState() || this.sortableGroup != null) && new Rectangle4i(
|
||||
namespacePrev.x,
|
||||
namespacePrev.y,
|
||||
namespaceNext.x + namespaceNext.w - namespacePrev.x,
|
||||
|
||||
@@ -771,6 +771,25 @@ public class BookmarkGrid extends ItemsGrid<BookmarksGridSlot, BookmarkGrid.Book
|
||||
int absoluteSlotIndex = absoluteRowIndex * this.columns;
|
||||
int overGroupId = getRowGroupId(overRowIndex);
|
||||
|
||||
// move group to same grid
|
||||
if (this != sortableGroup.grid) {
|
||||
final BookmarkGroup sourceGroup = sortableGroup.grid.getGroup(sortableGroup.groupId);
|
||||
final List<BookmarkItem> itemsToMove = sortableGroup.getBookmarkItems();
|
||||
|
||||
sortableGroup.grid.removeGroup(sortableGroup.groupId);
|
||||
|
||||
final int groupId = this.addGroup(sourceGroup);
|
||||
for (BookmarkItem item : itemsToMove) {
|
||||
item.groupId = groupId;
|
||||
this.bookmarkItems.add(item);
|
||||
}
|
||||
|
||||
sortableGroup.grid = this;
|
||||
sortableGroup.groupId = groupId;
|
||||
this.onItemsChanged();
|
||||
this.getMask();// force generate grid
|
||||
}
|
||||
|
||||
if (sortableGroup.groupId == overGroupId) {
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user