chore: lint
This commit is contained in:
@@ -78,7 +78,6 @@ export default {
|
||||
<template>
|
||||
<Panel class="vue-flow__controls" :position="position">
|
||||
<slot name="top" />
|
||||
|
||||
<template v-if="showZoom">
|
||||
<slot name="control-zoom-in">
|
||||
<ControlButton class="vue-flow__controls-zoomin" :disabled="maxZoomReached" @click="onZoomInHandler">
|
||||
|
||||
@@ -61,7 +61,9 @@ export default {
|
||||
<text v-bind="$attrs" ref="el" class="vue-flow__edge-text" :y="box.height / 2" dy="0.3em" :style="labelStyle">
|
||||
<slot>
|
||||
<component :is="label" v-if="!isString(label)" />
|
||||
<template v-else> {{ label }} </template>
|
||||
<template v-else>
|
||||
{{ label }}
|
||||
</template>
|
||||
</slot>
|
||||
</text>
|
||||
</g>
|
||||
|
||||
@@ -227,7 +227,7 @@ onMounted(() => {
|
||||
if (
|
||||
event.button === 1 &&
|
||||
event.type === 'mousedown' &&
|
||||
((event.target as HTMLElement)?.closest(`.vue-flow__node`) || (event.target as HTMLElement)?.closest(`.vue-flow__edge`))
|
||||
((event.target as HTMLElement)?.closest('.vue-flow__node') || (event.target as HTMLElement)?.closest('.vue-flow__edge'))
|
||||
) {
|
||||
return true
|
||||
}
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
/**
|
||||
* @deprecated; todo: remove this and use `PanelPositionType` instead
|
||||
*/
|
||||
export enum PanelPosition {
|
||||
TopLeft = 'top-left',
|
||||
TopCenter = 'top-center',
|
||||
@@ -7,6 +10,8 @@ export enum PanelPosition {
|
||||
BottomRight = 'bottom-right',
|
||||
}
|
||||
|
||||
type PanelPositionType = 'top-left' | 'top-center' | 'top-right' | 'bottom-left' | 'bottom-center' | 'bottom-right'
|
||||
|
||||
export interface PanelProps {
|
||||
position: PanelPosition
|
||||
position: PanelPosition | PanelPositionType
|
||||
}
|
||||
|
||||
@@ -40,9 +40,9 @@ const contextNodeId = inject(NodeIdInjection, null)
|
||||
|
||||
const resizeControlRef = ref<HTMLDivElement>()
|
||||
|
||||
const startValues = ref<typeof initStartValues>(initStartValues)
|
||||
let startValues: typeof initStartValues = initStartValues
|
||||
|
||||
const prevValues = ref<typeof initPrevValues>(initPrevValues)
|
||||
let prevValues: typeof initPrevValues = initPrevValues
|
||||
|
||||
const id = computed(() => (typeof props.nodeId === 'string' ? props.nodeId : contextNodeId))
|
||||
|
||||
@@ -67,21 +67,21 @@ watchEffect((onCleanup) => {
|
||||
const node = findNode(id.value!)
|
||||
const { xSnapped, ySnapped } = getPointerPosition(event)
|
||||
|
||||
prevValues.value = {
|
||||
prevValues = {
|
||||
width: node?.dimensions.width ?? 0,
|
||||
height: node?.dimensions.height ?? 0,
|
||||
x: node?.position.x ?? 0,
|
||||
y: node?.position.y ?? 0,
|
||||
}
|
||||
|
||||
startValues.value = {
|
||||
...prevValues.value,
|
||||
startValues = {
|
||||
...prevValues,
|
||||
pointerX: xSnapped,
|
||||
pointerY: ySnapped,
|
||||
aspectRatio: prevValues.value.width / prevValues.value.height,
|
||||
aspectRatio: prevValues.width / prevValues.height,
|
||||
}
|
||||
|
||||
emits('resizeStart', { event, params: prevValues.value })
|
||||
emits('resizeStart', { event, params: prevValues })
|
||||
})
|
||||
.on('drag', (event: ResizeDragEvent) => {
|
||||
const { xSnapped, ySnapped } = getPointerPosition(event)
|
||||
@@ -97,9 +97,9 @@ watchEffect((onCleanup) => {
|
||||
x: startNodeX,
|
||||
y: startNodeY,
|
||||
aspectRatio: startAspectRatio,
|
||||
} = startValues.value
|
||||
} = startValues
|
||||
|
||||
const { x: prevX, y: prevY, width: prevWidth, height: prevHeight } = prevValues.value
|
||||
const { x: prevX, y: prevY, width: prevWidth, height: prevHeight } = prevValues
|
||||
|
||||
const distX = Math.floor(enableX ? xSnapped - startX : 0)
|
||||
const distY = Math.floor(enableY ? ySnapped - startY : 0)
|
||||
@@ -163,8 +163,8 @@ watchEffect((onCleanup) => {
|
||||
|
||||
changes.push(positionChange)
|
||||
|
||||
prevValues.value.x = positionChange.position!.x
|
||||
prevValues.value.y = positionChange.position!.y
|
||||
prevValues.x = positionChange.position!.x
|
||||
prevValues.y = positionChange.position!.y
|
||||
}
|
||||
}
|
||||
|
||||
@@ -182,8 +182,8 @@ watchEffect((onCleanup) => {
|
||||
|
||||
changes.push(dimensionChange)
|
||||
|
||||
prevValues.value.width = width
|
||||
prevValues.value.height = height
|
||||
prevValues.width = width
|
||||
prevValues.height = height
|
||||
}
|
||||
|
||||
if (changes.length === 0) {
|
||||
@@ -191,15 +191,15 @@ watchEffect((onCleanup) => {
|
||||
}
|
||||
|
||||
const direction = getDirection({
|
||||
width: prevValues.value.width,
|
||||
width: prevValues.width,
|
||||
prevWidth,
|
||||
height: prevValues.value.height,
|
||||
height: prevValues.height,
|
||||
prevHeight,
|
||||
invertX,
|
||||
invertY,
|
||||
})
|
||||
|
||||
const nextValues = { ...prevValues.value, direction }
|
||||
const nextValues = { ...prevValues, direction }
|
||||
|
||||
const callResize = props.shouldResize?.(event, nextValues)
|
||||
|
||||
@@ -219,7 +219,7 @@ watchEffect((onCleanup) => {
|
||||
resizing: false,
|
||||
}
|
||||
|
||||
emits('resizeEnd', { event, params: prevValues.value })
|
||||
emits('resizeEnd', { event, params: prevValues })
|
||||
|
||||
triggerEmits.nodesChange([dimensionChange])
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user