Skip to content

Commit a50505a

Browse files
committed
Handle some ts-unused-exports errors
1 parent 7edf2f1 commit a50505a

3 files changed

Lines changed: 8 additions & 41 deletions

File tree

src/draw.ts

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import {
22
combinePatterns,
3-
getBoundariesFromPattern,
43
getScreenSize,
54
mapPatternToViewportSpace,
65
mutateBoundariesFromPattern,
@@ -36,23 +35,6 @@ function getViewportBoundaries(screenSize: Size): Boundaries<ViewportNumber> {
3635
}
3736
}
3837

39-
const isValidPattern = (
40-
patternBoundaries: Boundaries<ViewportNumber>,
41-
viewportBoundaries: Boundaries<ViewportNumber>
42-
): boolean => {
43-
return (
44-
// Pattern fulfills minimum size.
45-
patternBoundaries.xMax - patternBoundaries.xMin >= MIN_PATTERN_SIZE_PX &&
46-
patternBoundaries.yMax - patternBoundaries.yMin >= MIN_PATTERN_SIZE_PX &&
47-
// X and Y ranges overlap with the valid boundaries.
48-
// We will only render patterns if at least one corner is inside the valid boundaries.
49-
patternBoundaries.xMin <= viewportBoundaries.xMax &&
50-
patternBoundaries.xMax >= viewportBoundaries.xMin &&
51-
patternBoundaries.yMin <= viewportBoundaries.yMax &&
52-
patternBoundaries.yMax >= viewportBoundaries.yMin
53-
)
54-
}
55-
5638
const measure = (f: () => void): number => {
5739
const start = performance.now()
5840

src/functions.ts

Lines changed: 5 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -14,32 +14,14 @@ import {
1414
ViewportPoint
1515
} from './types'
1616

17-
export function minPatternNumber<N extends PatternNumber>(a: N, b: N): N {
17+
function minPatternNumber<N extends PatternNumber>(a: N, b: N): N {
1818
return Math.min(a, b) as N
1919
}
2020

21-
export function maxPatternNumber<N extends PatternNumber>(a: N, b: N): N {
21+
function maxPatternNumber<N extends PatternNumber>(a: N, b: N): N {
2222
return Math.max(a, b) as N
2323
}
2424

25-
const getBoundariesFromTwoPoints = <N extends PatternNumber>([x1, y1]: Point<N>, [x2, y2]: Point<N>): Boundaries<N> => {
26-
return {
27-
xMin: minPatternNumber(x1, x2),
28-
xMax: maxPatternNumber(x1, x2),
29-
yMin: minPatternNumber(y1, y2),
30-
yMax: maxPatternNumber(y1, y2),
31-
}
32-
}
33-
34-
export const normalizePattern = <N extends PatternNumber>(pattern: Pattern<N>): Pattern<N> => {
35-
const { xMin, xMax, yMin, yMax } = getBoundariesFromPattern(pattern)
36-
37-
return {
38-
anchor: [xMin, yMin],
39-
target: [xMax, yMax],
40-
}
41-
}
42-
4325
/**
4426
* This function mutates the boundaries object in place.
4527
*
@@ -57,14 +39,14 @@ export function mutateBoundariesFromPattern<N extends PatternNumber>(pattern: Pa
5739
}
5840

5941

60-
export const getBoundariesFromPattern = <N extends PatternNumber>(pattern: Pattern<N>): Boundaries<N>=> {
42+
const getBoundariesFromPattern = <N extends PatternNumber>(pattern: Pattern<N>): Boundaries<N>=> {
6143
const obj: Boundaries<N> = { xMin: 0 as N, xMax: 0 as N, yMin: 0 as N, yMax: 0 as N }
6244
mutateBoundariesFromPattern(pattern, obj)
6345
return obj
6446
}
6547

6648

67-
export const pointIsInBoundaries = <N extends PatternNumber>(point: Point<N>, boundaries: Boundaries<N>): boolean => {
49+
const pointIsInBoundaries = <N extends PatternNumber>(point: Point<N>, boundaries: Boundaries<N>): boolean => {
6850
const { xMin, xMax, yMin, yMax } = boundaries
6951
const [pointX, pointY] = point
7052

@@ -75,7 +57,7 @@ const pointIsInPattern = (point: AbsolutePoint, pattern: AbsolutePattern): boole
7557
return pointIsInBoundaries(point, getBoundariesFromPattern(pattern))
7658
}
7759

78-
export const mapPointToViewportSpace = (
60+
const mapPointToViewportSpace = (
7961
[x, y]: AbsolutePoint,
8062
[viewportWidth, viewportHeight]: Size
8163
): ViewportPoint => {

src/types.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
1+
12
type Brand<T, B extends string> = T & { readonly __brand: B }
23

34

5+
// ts-unused-exports:disable-next-line
46
export type RelativeNumber = Brand<number, 'RelativeNumber'>
7+
// ts-unused-exports:disable-next-line
58
export type AbsoluteNumber = Brand<number, 'AbsoluteNumber'>
69
export type ViewportNumber = Brand<number, 'ViewportNumber'>
710

0 commit comments

Comments
 (0)