From dc92b646d0cd0f12868fde370c83e94ca3c7e297 Mon Sep 17 00:00:00 2001 From: streamich Date: Sat, 16 May 2020 14:53:10 +0200 Subject: [PATCH] =?UTF-8?q?fix:=20=F0=9F=90=9B=20revert=20useMeasure=20def?= =?UTF-8?q?aults=20to=20zeros?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/useMeasure.ts | 16 ++++++++-------- tests/useMeasure.test.ts | 12 ++++++------ 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/useMeasure.ts b/src/useMeasure.ts index 57d5c6d3fb..a62d2bbcbc 100644 --- a/src/useMeasure.ts +++ b/src/useMeasure.ts @@ -9,14 +9,14 @@ export type UseMeasureRef = (element: HTMLElement) => void; export type UseMeasureResult = [UseMeasureRef, UseMeasureRect]; const defaultState: UseMeasureRect = { - x: -1, - y: -1, - width: -1, - height: -1, - top: -1, - left: -1, - bottom: -1, - right: -1, + x: 0, + y: 0, + width: 0, + height: 0, + top: 0, + left: 0, + bottom: 0, + right: 0, }; const useMeasure = (): UseMeasureResult => { diff --git a/tests/useMeasure.test.ts b/tests/useMeasure.test.ts index a008e61c68..94c83b6e7c 100644 --- a/tests/useMeasure.test.ts +++ b/tests/useMeasure.test.ts @@ -10,12 +10,12 @@ it('by default, state defaults every value to -1', () => { }); expect(result.current[1]).toMatchObject({ - width: -1, - height: -1, - top: -1, - bottom: -1, - left: -1, - right: -1, + width: 0, + height: 0, + top: 0, + bottom: 0, + left: 0, + right: 0, }); });