-
Notifications
You must be signed in to change notification settings - Fork 323
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Context menu, copy button, multi-component actions (#11690)
Context menu, copy button, multi-component actions https://github.com/user-attachments/assets/14243102-3848-43fc-82bb-a48648536985 - The 'More' menu can now be opened under the mouse, through the context menu action (right click/control-click on Mac/menu button on keyboard). - Add copy-components button to menu. - The menu can now be opened while multiple components are selected; if the clicked component was among the selected components, the selection will be preserved. Some menu actions--currently *copy* and *delete*, apply to all selected components. These actions will change their displayed labels when multiple components are selected. If a single-component action is executed, the component it was applied to will become the sole selection. Fixes #11633, #11634 (cherry picked from commit 0b6b1f0)
- Loading branch information
1 parent
fbe9e65
commit e82ce10
Showing
41 changed files
with
1,031 additions
and
422 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
<script setup lang="ts"> | ||
import MenuButton from '@/components/MenuButton.vue' | ||
import SvgIcon from '@/components/SvgIcon.vue' | ||
import { | ||
injectComponentAndSelectionButtons, | ||
type ComponentAndSelectionButtons, | ||
} from '@/providers/selectionButtons' | ||
const { button: buttonName } = defineProps<{ button: keyof ComponentAndSelectionButtons }>() | ||
const { buttons } = injectComponentAndSelectionButtons() | ||
const button = buttons[buttonName] | ||
</script> | ||
|
||
<template> | ||
<MenuButton | ||
:data-testid="button.testid" | ||
:disabled="button.disabled" | ||
class="ComponentButton" | ||
v-bind="button.state != null ? { modelValue: button.state } : {}" | ||
@update:modelValue="button.state != null && (button.state = $event)" | ||
@click="button.action" | ||
> | ||
<SvgIcon :name="button.icon" class="rowIcon" /> | ||
<span v-text="button.description" /> | ||
<span v-if="button.shortcut" class="shortcutHint" v-text="button.shortcut" /> | ||
</MenuButton> | ||
</template> | ||
|
||
<style scoped> | ||
.ComponentButton { | ||
display: flex; | ||
align-items: center; | ||
justify-content: left; | ||
padding-left: 8px; | ||
padding-right: 8px; | ||
} | ||
.rowIcon { | ||
display: inline-block; | ||
margin-right: 8px; | ||
} | ||
.shortcutHint { | ||
margin-left: auto; | ||
padding-left: 2em; | ||
opacity: 0.8; | ||
} | ||
</style> |
41 changes: 41 additions & 0 deletions
41
app/gui/src/project-view/components/ComponentContextMenu.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<script setup lang="ts"> | ||
import ComponentButton from '@/components/ComponentButton.vue' | ||
import MenuPanel from '@/components/MenuPanel.vue' | ||
import { type ComponentButtons } from '@/providers/componentButtons' | ||
import { type SelectionButtons } from '@/providers/selectionButtons' | ||
const emit = defineEmits<{ close: [] }>() | ||
const componentButtons: (keyof ComponentButtons)[] = [ | ||
'toggleDocPanel', | ||
'toggleVisualization', | ||
'createNewNode', | ||
'editingComment', | ||
'recompute', | ||
'pickColor', | ||
'enterNode', | ||
'startEditing', | ||
] | ||
const selectionButtons: (keyof SelectionButtons)[] = ['copy', 'deleteSelected'] | ||
const buttons = [...componentButtons, ...selectionButtons] | ||
</script> | ||
|
||
<template> | ||
<MenuPanel class="ComponentContextMenu" @contextmenu.stop.prevent="emit('close')"> | ||
<ComponentButton | ||
v-for="button in buttons" | ||
:key="button" | ||
:button="button" | ||
@click.stop="emit('close')" | ||
/> | ||
</MenuPanel> | ||
</template> | ||
|
||
<style scoped> | ||
.MenuPanel { | ||
margin-top: 2px; | ||
padding: 4px; | ||
background: var(--dropdown-opened-background, var(--color-app-bg)); | ||
backdrop-filter: var(--dropdown-opened-backdrop-filter, var(--blur-app-bg)); | ||
} | ||
</style> |
Oops, something went wrong.