Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make alt key keep dropdown open #9157

Merged
merged 1 commit into from
Feb 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -124,9 +124,9 @@ function toggleDropdownWidget() {
showDropdownWidget.value = !showDropdownWidget.value
}

function onClick(index: number) {
function onClick(index: number, keepOpen: boolean) {
selectedIndex.value = index
showDropdownWidget.value = false
showDropdownWidget.value = keepOpen
}

// When the selected index changes, we update the expression content.
Expand Down Expand Up @@ -181,7 +181,7 @@ export const widgetDefinition = defineWidget(WidgetInput.isAstOrPlaceholder, {
:color="'var(--node-color-primary)'"
:values="tagLabels"
:selectedValue="selectedLabel"
@click="onClick($event)"
@click="onClick"
/>
</div>
</template>
Expand Down
6 changes: 3 additions & 3 deletions app/gui2/src/components/widgets/DropdownWidget.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ enum SortDirection {
}

const props = defineProps<{ color: string; selectedValue: string | undefined; values: string[] }>()
const emit = defineEmits<{ click: [index: number] }>()
const emit = defineEmits<{ click: [index: number, keepOpen: boolean] }>()

const sortDirection = ref<SortDirection>(SortDirection.none)

Expand Down Expand Up @@ -51,11 +51,11 @@ const NEXT_SORT_DIRECTION: Record<SortDirection, SortDirection> = {
<ul class="list" :style="{ background: color }" @wheel.stop>
<template v-for="[value, index] in sortedValuesAndIndices" :key="value">
<li v-if="value === selectedValue">
<div class="selected-item button" @click.stop="emit('click', index)">
<div class="selected-item button" @click.stop="emit('click', index, $event.altKey)">
<span v-text="value"></span>
</div>
</li>
<li v-else class="selectable-item button" @click.stop="emit('click', index)">
<li v-else class="selectable-item button" @click.stop="emit('click', index, $event.altKey)">
<span v-text="value"></span>
</li>
</template>
Expand Down
Loading