chore: lint files
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
<script lang="ts" setup>
|
||||
import { Component, CSSProperties, DefineComponent } from 'vue'
|
||||
import { getEdgeCenter, BezierEdge, EdgeText, Position, EdgeProps, EdgeTextProps, GraphNode } from '@braks/vue-flow'
|
||||
import type { CSSProperties, Component, DefineComponent } from 'vue'
|
||||
import type { EdgeProps, EdgeTextProps, GraphNode } from '@braks/vue-flow'
|
||||
import { BezierEdge, EdgeText, Position, getEdgeCenter } from '@braks/vue-flow'
|
||||
import { createGrid, gridRatio } from './createGrid'
|
||||
import { drawSmoothLinePath } from './drawSvgPath'
|
||||
import { generatePath } from './generatePath'
|
||||
@@ -39,10 +40,6 @@ interface PathFindingEdgeProps extends EdgeProps {
|
||||
targetHandleId?: string
|
||||
}
|
||||
|
||||
const nodePadding = 10
|
||||
const graphPadding = 20
|
||||
const roundCoordinatesTo = gridRatio
|
||||
|
||||
const props = withDefaults(defineProps<PathFindingEdgeProps>(), {
|
||||
selected: false,
|
||||
sourcePosition: Position.Bottom,
|
||||
@@ -52,6 +49,10 @@ const props = withDefaults(defineProps<PathFindingEdgeProps>(), {
|
||||
labelBgStyle: () => ({}),
|
||||
})
|
||||
|
||||
const nodePadding = 10
|
||||
const graphPadding = 20
|
||||
const roundCoordinatesTo = gridRatio
|
||||
|
||||
const centered = computed(() =>
|
||||
getEdgeCenter({
|
||||
...props,
|
||||
@@ -104,12 +105,14 @@ const path = computed(() => {
|
||||
})
|
||||
const attrs: any = useAttrs()
|
||||
</script>
|
||||
|
||||
<script lang="ts">
|
||||
export default {
|
||||
name: 'PathFindingEdge',
|
||||
inheritAttrs: false,
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<BezierEdge v-if="gridPath && gridPath.length <= 2" v-bind="{ ...props, ...attrs }" />
|
||||
<template v-else>
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
import { Grid } from 'pathfinding'
|
||||
import { Position } from '@braks/vue-flow'
|
||||
import { guaranteeWalkablePath, getNextPointFromPosition } from './guaranteeWalkablePath'
|
||||
import type { Position } from '@braks/vue-flow'
|
||||
import { getNextPointFromPosition, guaranteeWalkablePath } from './guaranteeWalkablePath'
|
||||
import { graphToGridPoint } from './pointConversion'
|
||||
import { round } from './utils'
|
||||
import type { NodeBoundingBox, GraphBoundingBox } from './getBoundingBoxes'
|
||||
import type { GraphBoundingBox, NodeBoundingBox } from './getBoundingBoxes'
|
||||
|
||||
export const gridRatio = 10
|
||||
|
||||
export type PointInfo = {
|
||||
export interface PointInfo {
|
||||
x: number
|
||||
y: number
|
||||
position: Position
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/**
|
||||
* Draws a SVG path from a list of points, using straight lines.
|
||||
*/
|
||||
import { XYPosition } from '@braks/vue-flow'
|
||||
import type { XYPosition } from '@braks/vue-flow'
|
||||
|
||||
const getMidPoint = (Ax: number, Ay: number, Bx: number, By: number) => {
|
||||
const Zx = (Ax - Bx) / 2 + Bx
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { AStarFinder, Util, DiagonalMovement, Heuristic } from 'pathfinding'
|
||||
import type { Grid } from 'pathfinding'
|
||||
import { XYPosition } from '@braks/vue-flow'
|
||||
import { AStarFinder, DiagonalMovement, Util } from 'pathfinding'
|
||||
import type { Grid, Heuristic } from 'pathfinding'
|
||||
import type { XYPosition } from '@braks/vue-flow'
|
||||
|
||||
// https://www.npmjs.com/package/pathfinding#advanced-usage
|
||||
declare module 'pathfinding' {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { XYPosition, GraphNode } from '@braks/vue-flow'
|
||||
import { roundUp, roundDown } from './utils'
|
||||
import type { GraphNode, XYPosition } from '@braks/vue-flow'
|
||||
import { roundDown, roundUp } from './utils'
|
||||
|
||||
export type NodeBoundingBox = {
|
||||
export interface NodeBoundingBox {
|
||||
id: string
|
||||
width: number
|
||||
height: number
|
||||
@@ -11,7 +11,7 @@ export type NodeBoundingBox = {
|
||||
bottomRight: XYPosition
|
||||
}
|
||||
|
||||
export type GraphBoundingBox = {
|
||||
export interface GraphBoundingBox {
|
||||
width: number
|
||||
height: number
|
||||
topLeft: XYPosition
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { Grid } from 'pathfinding'
|
||||
import { Position, XYPosition } from '@braks/vue-flow'
|
||||
import type { Position, XYPosition } from '@braks/vue-flow'
|
||||
|
||||
type Direction = 'top' | 'bottom' | 'left' | 'right'
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { XYPosition } from '@braks/vue-flow'
|
||||
import type { XYPosition } from '@braks/vue-flow'
|
||||
|
||||
const gridRatio = 10
|
||||
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
declare module '*.vue' {
|
||||
import { DefineComponent } from 'vue'
|
||||
import type { DefineComponent } from 'vue'
|
||||
// eslint-disable-next-line @typescript-eslint/ban-types
|
||||
const component: DefineComponent<{}, {}, any>
|
||||
export default component
|
||||
|
||||
Reference in New Issue
Block a user