Skip to content

Commit

Permalink
make sure both single and double click work independently on list rows
Browse files Browse the repository at this point in the history
  • Loading branch information
justintucker1 committed Jan 13, 2025
1 parent a207865 commit 0f7a7c0
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
14 changes: 11 additions & 3 deletions webviews/src/views/RokuAutomationView/AutoRunsEditor.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
let confirmMessage: string;
let confirmDone: Callback;
let activeRun: string = null;
let isSingleClick: boolean = true;
intermediary.observeEvent(ViewProviderEvent.onRokuAutomationConfigStepChange, (message) => {
if (message.context.step === -1) {
Expand All @@ -37,7 +38,6 @@
function selectRun(e: MouseEvent) {
const run: string = getRunFromEvent(e);
selectedRun = run;
console.log(`Selected run: ${run}`);
}
function startRun(e: MouseEvent) {
Expand Down Expand Up @@ -344,8 +344,16 @@
}
}}
use:draggable={run.name}
on:click={(e) => {selectRun(e); toggleDropDown();}}
on:dblclick={renameRun}
on:click={(e) => {
isSingleClick = true;
setTimeout(() => {
if (isSingleClick) {
selectRun(e);
toggleDropDown();
}
}, 250);
}}
on:dblclick={(e) => {isSingleClick = false; renameRun(e);}}
title={run.name}
id={run.name === selectedRun ? 'selected-tr' : ''}>
<td>
Expand Down
2 changes: 2 additions & 0 deletions webviews/src/views/RokuAutomationView/dnd.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ export function dropzone(node, options) {
e.preventDefault();
if (!e.dataTransfer) return;
e.dataTransfer.dropEffect = state.dropEffect;
console.log(`*** dragover: ${e.dataTransfer.dropEffect}`);
console.log(`Selected run: ${run}`);
}

function handleDrop(e) {
Expand Down

0 comments on commit 0f7a7c0

Please sign in to comment.