diff --git a/ChangeLog.md b/ChangeLog.md index 8888a998..3971702f 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -1,4 +1,9 @@ # Changelog: +* **02.12.20** + - Fixed a bug within the client entry move mechanic of the channel tree which prevented any client selection + - Selecting clicked client when moving + - When a client has been moved into another client his channel will be used + * **29.11.20** - Added support for the native client to show and broadcast video - By default using a quick select method when sharing the screen diff --git a/shared/js/tree/ChannelTree.tsx b/shared/js/tree/ChannelTree.tsx index ab2651a4..cad2ec65 100644 --- a/shared/js/tree/ChannelTree.tsx +++ b/shared/js/tree/ChannelTree.tsx @@ -134,7 +134,7 @@ export class ChannelTreeEntrySelect { * append := Append these entries to the current selection * remove := Remove these entries from the current selection */ - select(entries: ChannelTreeEntry[], mode: "auto" | "exclusive" | "append" | "remove") { + select(entries: ChannelTreeEntry[], mode: "auto" | "auto-add" | "exclusive" | "append" | "remove") { entries = entries.filter(entry => !!entry); if(mode === "exclusive") { @@ -193,7 +193,7 @@ export class ChannelTreeEntrySelect { if(deleted_entries.length !== 0) { this.handle.events.fire("notify_selection_changed"); } - } else if(mode === "auto") { + } else if(mode === "auto" || mode === "auto-add") { let deleted_entries = []; let new_entries = []; @@ -203,7 +203,7 @@ export class ChannelTreeEntrySelect { if(index === -1) { this.selectedEntries.push(entry); new_entries.push(entry); - } else { + } else if(mode === "auto") { this.selectedEntries.splice(index, 1); deleted_entries.push(entry); } @@ -213,8 +213,9 @@ export class ChannelTreeEntrySelect { if(entries.length !== 0) { const entry = entries[entries.length - 1]; this.selectedEntries.push(entry); - if(!deleted_entries.remove(entry)) + if(!deleted_entries.remove(entry)) { new_entries.push(entry); /* entry wans't selected yet */ + } } } diff --git a/shared/js/ui/tree/Controller.tsx b/shared/js/ui/tree/Controller.tsx index b8baf6fe..220fb5dd 100644 --- a/shared/js/ui/tree/Controller.tsx +++ b/shared/js/ui/tree/Controller.tsx @@ -657,7 +657,9 @@ export function initializeChannelTreeController(events: Registry { + console.error("Select mode: %o", moveSelection); if(!event.ignoreClientMove && moveSelection?.length) { + console.error("X"); return; } @@ -795,17 +797,28 @@ export function initializeChannelTreeController(events: Registry e.currentChannel() !== entry).forEach(e => { channelTree.client.serverConnection.send_command("clientmove", { clid: e.clientId(), - cid: entry.channelId + cid: targetChannel.channelId }); }); + moveSelection = undefined; }); diff --git a/shared/js/ui/tree/Definitions.ts b/shared/js/ui/tree/Definitions.ts index 28dbadae..5edd4be2 100644 --- a/shared/js/ui/tree/Definitions.ts +++ b/shared/js/ui/tree/Definitions.ts @@ -34,7 +34,7 @@ export interface ChannelTreeUIEvents { action_set_collapsed_state: { treeEntryId: number, state: "collapsed" | "expended" }, action_select: { entryIds: number[], - mode: "auto" | "exclusive" | "append" | "remove", + mode: "auto" | "auto-add" | "exclusive" | "append" | "remove", ignoreClientMove: boolean }, action_select_auto: { direction: "next" | "previous" }, diff --git a/shared/js/ui/tree/RendererMove.tsx b/shared/js/ui/tree/RendererMove.tsx index 8a1b7ac1..20c74b5b 100644 --- a/shared/js/ui/tree/RendererMove.tsx +++ b/shared/js/ui/tree/RendererMove.tsx @@ -34,7 +34,7 @@ export class RendererMove extends ReactComponentBase (this.props.moveThreshold || 9)) { + const sourceEntry = this.getEntryFromPoint(this.mouseMove.x, this.mouseMove.y); + if(!sourceEntry) { return; } + + this.props.events.fire("action_select", { entryIds: [ sourceEntry ], mode: "auto-add", ignoreClientMove: true }); + this.mouseMove.fired = true; this.props.events.fire("action_start_entry_move", { current: { x: e.pageX, y: e.pageY }, @@ -286,11 +294,13 @@ export class ChannelTreeView extends ReactComponentBase container.clientWidth) + if (pageX > container.clientWidth) { return undefined; + } const total_offset = container.scrollTop + pageY; return this.state.tree[Math.floor(total_offset / ChannelTreeView.EntryHeight)]?.entryId;