-
Notifications
You must be signed in to change notification settings - Fork 448
selection rectangle for vueNodes #7088
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
Changes from all commits
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 |
|---|---|---|
| @@ -0,0 +1,63 @@ | ||
| <template> | ||
| <div | ||
| v-if="isVisible" | ||
| class="pointer-events-none absolute border border-blue-400 bg-blue-500/20" | ||
|
Contributor
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. Optional: Want to use theme tokens instead? |
||
| :style="rectangleStyle" | ||
| /> | ||
| </template> | ||
|
|
||
| <script setup lang="ts"> | ||
| import { useRafFn } from '@vueuse/core' | ||
| import { computed, ref } from 'vue' | ||
| import { useCanvasStore } from '@/renderer/core/canvas/canvasStore' | ||
| const canvasStore = useCanvasStore() | ||
| const selectionRect = ref<{ | ||
|
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. [quality] low Priority Issue: Inline type definition instead of reusing existing types |
||
| x: number | ||
| y: number | ||
| w: number | ||
| h: number | ||
| } | null>(null) | ||
| useRafFn(() => { | ||
DrJKL marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| const canvas = canvasStore.canvas | ||
| if (!canvas) { | ||
| selectionRect.value = null | ||
| return | ||
| } | ||
| const { pointer, dragging_rectangle } = canvas | ||
|
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. [quality] medium Priority Issue: Missing null safety checks for canvas properties access |
||
| if (dragging_rectangle && pointer.eDown && pointer.eMove) { | ||
|
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. [quality] medium Priority Issue: Missing null checks for pointer.eDown and pointer.eMove properties |
||
| const x = pointer.eDown.safeOffsetX | ||
| const y = pointer.eDown.safeOffsetY | ||
| const w = pointer.eMove.safeOffsetX - x | ||
| const h = pointer.eMove.safeOffsetY - y | ||
| selectionRect.value = { x, y, w, h } | ||
| } else { | ||
| selectionRect.value = null | ||
| } | ||
| }) | ||
|
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. [quality] low Priority Issue: Missing explicit cleanup in SelectionRectangle component |
||
| const isVisible = computed(() => selectionRect.value !== null) | ||
| const rectangleStyle = computed(() => { | ||
| const rect = selectionRect.value | ||
| if (!rect) return {} | ||
| const left = rect.w >= 0 ? rect.x : rect.x + rect.w | ||
| const top = rect.h >= 0 ? rect.y : rect.y + rect.h | ||
| const width = Math.abs(rect.w) | ||
| const height = Math.abs(rect.h) | ||
| return { | ||
| left: `${left}px`, | ||
| top: `${top}px`, | ||
| width: `${width}px`, | ||
| height: `${height}px` | ||
| } | ||
| }) | ||
| </script> | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4799,7 +4799,8 @@ export class LGraphCanvas | |
| } | ||
|
|
||
| // Area-selection rectangle | ||
| if (this.dragging_rectangle) { | ||
| // In Vue nodes mode, selection rectangle is rendered in DOM layer | ||
| if (this.dragging_rectangle && !LiteGraph.vueNodesMode) { | ||
|
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. [architecture] medium Priority Issue: Direct dependency on global LiteGraph.vueNodesMode creates tight coupling
Contributor
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. We really need to fix this app-wide... |
||
| const { eDown, eMove } = this.pointer | ||
| ctx.strokeStyle = '#FFF' | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.