-
Notifications
You must be signed in to change notification settings - Fork 423
Webcam capture Node #6795
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
Open
Myestery
wants to merge
29
commits into
main
Choose a base branch
from
webcam-capture
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+927
−3
Open
Webcam capture Node #6795
Changes from all commits
Commits
Show all changes
29 commits
Select commit
Hold shift + click to select a range
6f4c335
WIP fix record audio button color token
Myestery 74aadb3
feat: add webcam widget with camera control and dynamic visibility fo…
Myestery 450b8b9
feat: add new webcam widget Vue component.
Myestery 0ac7687
feat: add WidgetSelectToggle and enhance webcam widget with dynamic c…
Myestery 7fc51c6
fix: prevent Vue reactivity from breaking LiteGraph widget private fi…
Myestery a65b063
feat: add live camera preview with stop-on-hover to webcam widget
Myestery e1693dc
feat: add capture button widget to webcam component
Myestery a455c7b
feat: add iconClass option to widget interface
Myestery 48c21f6
feat: enhance WidgetButton component with icon support
Myestery ca335ba
Merge branch 'main' into webcam-capture
Myestery 16b6b5b
Merge remote-tracking branch 'origin/main' into webcam-capture
Myestery 59761eb
feat: Add 'Capture photo' button with icon to webcam widget and updat…
Myestery f9b7e51
feat: enable webcam image capture, display captured image, and manage…
Myestery ad85956
feat: set default width and height values for webcam widgets if not a…
Myestery dc60b54
feat: Implement image widget serialization to support auto-capture on…
Myestery cfbb4c7
fix: preserve widget object identity for proper reactivity in webcam …
Myestery 4b62872
feat: hide capture button when 'On Run' mode is selected in webcam wi…
Myestery 68b6159
feat: add refreshVueWidgets to sync widget changes with Vue state
Myestery cd5f6fd
feat: restart camera when switching to 'On Run' mode in webcam widget
Myestery af8ad95
fix: hide widgets on mount and improve stop button styling
Myestery f8ede78
Merge branch 'main' into webcam-capture
Myestery 335b72b
Fix linting
Myestery f7f0c05
fix(security): properly cleanup MediaStream on camera access failure
Myestery 7b109df
refactor: extract magic numbers into named constants
Myestery 8031a83
fix: prevent race condition in camera initialization
Myestery 51ab154
fix: properly cleanup video event listeners on unmount
Myestery e092986
apply review comments
Myestery 1e384c6
refactor: use vue-i18n for toggle option labels
Myestery 1c37a36
refactor: use instance-specific canvas and video elements
Myestery File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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
2 changes: 1 addition & 1 deletion
2
src/renderer/extensions/vueNodes/widgets/components/WidgetButton.vue
This file contains hidden or 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
98 changes: 98 additions & 0 deletions
98
src/renderer/extensions/vueNodes/widgets/components/WidgetSelectToggle.vue
This file contains hidden or 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,98 @@ | ||
| <script setup lang="ts"> | ||
| import { computed } from 'vue' | ||
|
|
||
| import { t } from '@/i18n' | ||
| import type { SimplifiedWidget } from '@/types/simplifiedWidget' | ||
| import { cn } from '@/utils/tailwindUtil' | ||
| import { | ||
| STANDARD_EXCLUDED_PROPS, | ||
| filterWidgetProps | ||
| } from '@/utils/widgetPropFilter' | ||
|
|
||
| import { WidgetInputBaseClass } from './layout' | ||
| import WidgetLayoutField from './layout/WidgetLayoutField.vue' | ||
|
|
||
| const props = defineProps<{ | ||
| widget: SimplifiedWidget<string | number | boolean> | ||
| }>() | ||
|
|
||
| const modelValue = defineModel<string | number | boolean>({ required: true }) | ||
|
|
||
| const filteredProps = computed(() => | ||
| filterWidgetProps(props.widget.options, STANDARD_EXCLUDED_PROPS) | ||
| ) | ||
|
|
||
| interface ToggleOption { | ||
| label: string | ||
| value: string | number | boolean | ||
| } | ||
|
|
||
| const options = computed<ToggleOption[]>(() => { | ||
| // Get options from widget spec or widget options | ||
| const widgetOptions = props.widget.options?.values || props.widget.spec?.[0] | ||
|
|
||
| if (Array.isArray(widgetOptions)) { | ||
| // If options are strings/numbers, convert to {label, value} format | ||
| return widgetOptions.map((opt) => { | ||
| if ( | ||
| typeof opt === 'object' && | ||
| opt !== null && | ||
| 'label' in opt && | ||
| 'value' in opt | ||
| ) { | ||
| return opt as ToggleOption | ||
| } | ||
| return { label: String(opt), value: opt } | ||
| }) | ||
| } | ||
|
|
||
| // Default options for boolean widgets | ||
| if (typeof modelValue.value === 'boolean') { | ||
| return [ | ||
| { label: t('g.on', 'On'), value: true }, | ||
| { label: t('g.off', 'Off'), value: false } | ||
| ] | ||
| } | ||
|
|
||
| // Fallback default options | ||
| return [ | ||
| { label: t('g.yes', 'Yes'), value: true }, | ||
| { label: t('g.no', 'No'), value: false } | ||
| ] | ||
| }) | ||
|
|
||
| function handleSelect(value: string | number | boolean) { | ||
| modelValue.value = value | ||
| } | ||
| </script> | ||
|
|
||
| <template> | ||
| <WidgetLayoutField :widget> | ||
| <div | ||
| v-bind="filteredProps" | ||
| :class="cn(WidgetInputBaseClass, 'flex gap-0.5 p-0.5 w-full')" | ||
| role="group" | ||
| :aria-label="widget.name" | ||
| > | ||
| <button | ||
| v-for="option in options" | ||
| :key="String(option.value)" | ||
| type="button" | ||
| :class=" | ||
| cn( | ||
| 'flex-1 px-2 py-1 text-xs font-medium rounded transition-all duration-150', | ||
| 'bg-transparent border-none', | ||
| 'focus:outline-none', | ||
| modelValue === option.value | ||
| ? 'bg-interface-menu-component-surface-selected text-base-foreground' | ||
| : 'text-muted-foreground hover:bg-interface-menu-component-surface-hovered' | ||
| ) | ||
| " | ||
| :aria-pressed="modelValue === option.value" | ||
| @click="handleSelect(option.value)" | ||
Myestery marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| > | ||
| {{ option.label }} | ||
| </button> | ||
| </div> | ||
| </WidgetLayoutField> | ||
| </template> | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.