-
Notifications
You must be signed in to change notification settings - Fork 318
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
Visualization Preview #10310
Visualization Preview #10310
Changes from 4 commits
202d0ac
d93e9f3
60a42b4
3680621
6310ffd
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,6 +19,7 @@ import NodeWidgetTree, { | |
import SvgIcon from '@/components/SvgIcon.vue' | ||
import { useDoubleClick } from '@/composables/doubleClick' | ||
import { usePointer, useResizeObserver } from '@/composables/events' | ||
import { useKeyboard } from '@/composables/keyboard' | ||
import { injectGraphNavigator } from '@/providers/graphNavigator' | ||
import { injectNodeColors } from '@/providers/graphNodeColors' | ||
import { injectGraphSelection } from '@/providers/graphSelection' | ||
|
@@ -69,7 +70,7 @@ const emit = defineEmits<{ | |
'update:hoverAnim': [progress: number] | ||
'update:visualizationId': [id: Opt<VisualizationIdentifier>] | ||
'update:visualizationRect': [rect: Rect | undefined] | ||
'update:visualizationVisible': [visible: boolean] | ||
'update:visualizationEnabled': [enabled: boolean] | ||
'update:visualizationFullscreen': [fullscreen: boolean] | ||
'update:visualizationWidth': [width: number] | ||
'update:visualizationHeight': [height: number] | ||
|
@@ -220,9 +221,21 @@ function openFullMenu() { | |
} | ||
|
||
const isDocsVisible = ref(false) | ||
const outputHovered = ref(false) | ||
const keyboard = useKeyboard() | ||
const visualizationWidth = computed(() => props.node.vis?.width ?? null) | ||
const visualizationHeight = computed(() => props.node.vis?.height ?? null) | ||
const isVisualizationVisible = computed(() => props.node.vis?.visible ?? false) | ||
const isVisualizationEnabled = computed(() => props.node.vis?.visible ?? false) | ||
const isVisualizationPreviewed = computed(() => keyboard.mod && outputHovered.value) | ||
const isVisualizationVisible = computed( | ||
() => isVisualizationEnabled.value || isVisualizationPreviewed.value, | ||
) | ||
watch(isVisualizationPreviewed, (newVal, oldVal) => { | ||
if (newVal && !oldVal) { | ||
graph.db.moveNodeToTop(nodeId.value) | ||
} | ||
}) | ||
|
||
const isVisualizationFullscreen = computed(() => props.node.vis?.fullscreen ?? false) | ||
|
||
const bgStyleVariables = computed(() => { | ||
|
@@ -384,12 +397,12 @@ const { getNodeColor, getNodeColors } = injectNodeColors() | |
const matchableNodeColors = getNodeColors((node) => node !== nodeId.value) | ||
|
||
const graphSelectionSize = computed(() => | ||
isVisualizationVisible.value && visRect.value ? visRect.value.size : nodeSize.value, | ||
isVisualizationEnabled.value && visRect.value ? visRect.value.size : nodeSize.value, | ||
) | ||
|
||
const nodeRect = computed(() => new Rect(props.node.position, nodeSize.value)) | ||
const nodeOuterRect = computed(() => | ||
isVisualizationVisible.value && visRect.value ? visRect.value : nodeRect.value, | ||
isVisualizationEnabled.value && visRect.value ? visRect.value : nodeRect.value, | ||
) | ||
watchEffect(() => { | ||
if (!nodeOuterRect.value.size.isZero()) { | ||
|
@@ -405,14 +418,13 @@ watchEffect(() => { | |
class="GraphNode" | ||
:style="{ | ||
transform, | ||
minWidth: isVisualizationVisible ? `${visualizationWidth ?? 200}px` : undefined, | ||
minWidth: isVisualizationEnabled ? `${visualizationWidth ?? 200}px` : undefined, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, The previewing is so temporary, that resizing node gave bad feeling. So I decided that the node will be resized only when visualization is actually enabled. |
||
'--node-group-color': color, | ||
...(node.zIndex ? { 'z-index': node.zIndex } : {}), | ||
}" | ||
:class="{ | ||
selected, | ||
selectionVisible, | ||
visualizationVisible: isVisualizationVisible, | ||
['executionState-' + executionState]: true, | ||
}" | ||
:data-node-id="nodeId" | ||
|
@@ -452,11 +464,11 @@ watchEffect(() => { | |
v-model:isRecordingOverridden="isRecordingOverridden" | ||
v-model:isDocsVisible="isDocsVisible" | ||
:isRecordingEnabledGlobally="projectStore.isRecordingEnabled" | ||
:isVisualizationVisible="isVisualizationVisible" | ||
:isVisualizationEnabled="isVisualizationEnabled" | ||
:isFullMenuVisible="menuVisible && menuFull" | ||
:nodeColor="getNodeColor(nodeId)" | ||
:matchableNodeColors="matchableNodeColors" | ||
@update:isVisualizationVisible="emit('update:visualizationVisible', $event)" | ||
@update:isVisualizationEnabled="emit('update:visualizationVisible', $event)" | ||
@startEditing="startEditingNode" | ||
@startEditingComment="editingComment = true" | ||
@openFullMenu="openFullMenu" | ||
|
@@ -479,9 +491,10 @@ watchEffect(() => { | |
:width="visualizationWidth" | ||
:height="visualizationHeight" | ||
:isFocused="isOnlyOneSelected" | ||
:isPreview="isVisualizationPreviewed" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should not be set when |
||
@update:rect="updateVisualizationRect" | ||
@update:id="emit('update:visualizationId', $event)" | ||
@update:visible="emit('update:visualizationVisible', $event)" | ||
@update:enabled="emit('update:visualizationVisible', $event)" | ||
@update:fullscreen="emit('update:visualizationFullscreen', $event)" | ||
@update:width="emit('update:visualizationWidth', $event)" | ||
@update:height="emit('update:visualizationHeight', $event)" | ||
|
@@ -531,6 +544,7 @@ watchEffect(() => { | |
@portClick="(...args) => emit('outputPortClick', ...args)" | ||
@portDoubleClick="(...args) => emit('outputPortDoubleClick', ...args)" | ||
@update:hoverAnim="emit('update:hoverAnim', $event)" | ||
@update:nodeHovered="outputHovered = $event" | ||
/> | ||
</svg> | ||
</div> | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This shouldn't be run when
isVisualizationEnabled
.