fix(node-resizer): hide resizer when isVisible is false
Signed-off-by: braks <78412429+bcakmakoglu@users.noreply.github.com>
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
<script lang="ts" setup>
|
||||
import { VueFlow } from '@vue-flow/core'
|
||||
import ResizableNode from './ResizableNode.vue'
|
||||
import ResizableNodeSelected from './ResizableNodeSelected.vue'
|
||||
|
||||
const elements = ref([
|
||||
{
|
||||
@@ -39,5 +40,9 @@ const elements = ref([
|
||||
<template #node-resizable="resizableNodeProps">
|
||||
<ResizableNode :label="resizableNodeProps.label" />
|
||||
</template>
|
||||
|
||||
<template #node-resizableSelected="resizableNodeProps">
|
||||
<ResizableNodeSelected :label="resizableNodeProps.label" :selected="resizableNodeProps.selected" />
|
||||
</template>
|
||||
</VueFlow>
|
||||
</template>
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
<script lang="ts" setup>
|
||||
import { Handle, Position } from '@vue-flow/core'
|
||||
import { NodeResizer } from '@vue-flow/node-resizer'
|
||||
|
||||
defineProps(['label', 'selected'])
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<NodeResizer color="#ff0071" :is-visible="selected" :min-width="100" :min-height="30" />
|
||||
|
||||
<Handle type="target" :position="Position.Left" />
|
||||
<div style="padding: 10px">{{ label }}</div>
|
||||
<Handle type="source" :position="Position.Right" />
|
||||
</template>
|
||||
@@ -28,42 +28,44 @@ export default {
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<ResizeControl
|
||||
v-for="c of lineControls"
|
||||
:key="c"
|
||||
:class="lineClassName"
|
||||
:style="lineStyle"
|
||||
:node-id="nodeId"
|
||||
:position="c"
|
||||
:variant="ResizeControlVariant.Line"
|
||||
:keep-aspect-ratio="keepAspectRatio"
|
||||
:color="color"
|
||||
:min-width="minWidth"
|
||||
:min-height="minHeight"
|
||||
:max-width="maxWidth"
|
||||
:max-height="maxHeight"
|
||||
:should-resize="shouldResize"
|
||||
@resize-start="emits('resizeStart', $event)"
|
||||
@resize="emits('resize', $event)"
|
||||
@resize-end="emits('resizeEnd', $event)"
|
||||
/>
|
||||
<template v-if="isVisible">
|
||||
<ResizeControl
|
||||
v-for="c of lineControls"
|
||||
:key="c"
|
||||
:class="lineClassName"
|
||||
:style="lineStyle"
|
||||
:node-id="nodeId"
|
||||
:position="c"
|
||||
:variant="ResizeControlVariant.Line"
|
||||
:keep-aspect-ratio="keepAspectRatio"
|
||||
:color="color"
|
||||
:min-width="minWidth"
|
||||
:min-height="minHeight"
|
||||
:max-width="maxWidth"
|
||||
:max-height="maxHeight"
|
||||
:should-resize="shouldResize"
|
||||
@resize-start="emits('resizeStart', $event)"
|
||||
@resize="emits('resize', $event)"
|
||||
@resize-end="emits('resizeEnd', $event)"
|
||||
/>
|
||||
|
||||
<ResizeControl
|
||||
v-for="c of handleControls"
|
||||
:key="c"
|
||||
:class="lineClassName"
|
||||
:style="lineStyle"
|
||||
:node-id="nodeId"
|
||||
:position="c"
|
||||
:color="color"
|
||||
:min-width="minWidth"
|
||||
:min-height="minHeight"
|
||||
:max-width="maxWidth"
|
||||
:max-height="maxHeight"
|
||||
:should-resize="shouldResize"
|
||||
:keep-aspect-ratio="keepAspectRatio"
|
||||
@resize-start="emits('resizeStart', $event)"
|
||||
@resize="emits('resize', $event)"
|
||||
@resize-end="emits('resizeEnd', $event)"
|
||||
/>
|
||||
<ResizeControl
|
||||
v-for="c of handleControls"
|
||||
:key="c"
|
||||
:class="lineClassName"
|
||||
:style="lineStyle"
|
||||
:node-id="nodeId"
|
||||
:position="c"
|
||||
:color="color"
|
||||
:min-width="minWidth"
|
||||
:min-height="minHeight"
|
||||
:max-width="maxWidth"
|
||||
:max-height="maxHeight"
|
||||
:should-resize="shouldResize"
|
||||
:keep-aspect-ratio="keepAspectRatio"
|
||||
@resize-start="emits('resizeStart', $event)"
|
||||
@resize="emits('resize', $event)"
|
||||
@resize-end="emits('resizeEnd', $event)"
|
||||
/>
|
||||
</template>
|
||||
</template>
|
||||
|
||||
Reference in New Issue
Block a user