@logicflow/core
Version:
LogicFlow, help you quickly create flowcharts
15 lines (13 loc) • 401 B
text/typescript
import { snapToGrid, getGridOffset } from '../../src/util'
describe('util/geometry', () => {
test('snapToGrid', () => {
const point = 2.5
const grid = 1.5
expect(snapToGrid(point, grid) - 3 < Number.EPSILON).toBeTruthy()
})
test('getGridOffset', () => {
const distance = 3
const grid = 1.5
expect(getGridOffset(distance, grid) - 2 < Number.EPSILON).toBeTruthy()
})
})