Add the ability to move bookmark groups between namespaces (#803)

Co-authored-by: Martin Robertz <dream-master@gmx.net>
This commit is contained in:
slprimeandMartin Robertz authored and GitHub committed 2025-12-16 23:39:32 +02:00
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;
}