From ad23ad2386892f36c67c88119aad7eeaf4521aaa Mon Sep 17 00:00:00 2001 From: Andre Henn Date: Tue, 12 Sep 2023 12:28:15 +0200 Subject: [PATCH 1/3] chore: introduce watch build script --- README.md | 9 ++++++ package-lock.json | 77 +++++++++++++++++++++++++++++++++++++++++++++++ package.json | 18 +++++++---- watchBuild.js | 69 ++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 167 insertions(+), 6 deletions(-) create mode 100644 watchBuild.js diff --git a/README.md b/README.md index ac36ae05..9d1204dd 100644 --- a/README.md +++ b/README.md @@ -15,3 +15,12 @@ import { useObjectState } from '@terrestris/react-util'; // or import { useObjectState } from '@terrestris/react-util/dist/hooks/useObjectState/useObjectState'; ``` + +## Development + +`npm run watch:buildto` can be used to inject an updated version of `react-util` into another project, e.g. `react-geo`. +The script will also watch for further changes. + +```sh +npm run watch:buildto ../react-geo/node_modules/@terrestris/react-geo/ +``` diff --git a/package-lock.json b/package-lock.json index 1aba9840..177c417e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -37,6 +37,7 @@ "enzyme": "^3.11.0", "eslint": "^8.14.0", "eslint-plugin-simple-import-sort": "^10.0.0", + "fs-extra": "^11.1.1", "jest": "^29.6.4", "jest-canvas-mock": "^2.5.2", "jest-environment-jsdom": "^29.6.4", @@ -54,6 +55,7 @@ "ts-jest": "^29.1.1", "typescript": "^4.2.4", "use-resize-observer": "^9.1.0", + "watch": "^1.0.2", "whatwg-fetch": "^3.6.18" }, "peerDependencies": { @@ -8415,6 +8417,15 @@ "node": ">=0.10.0" } }, + "node_modules/exec-sh": { + "version": "0.2.2", + "resolved": "https://registry.npmjs.org/exec-sh/-/exec-sh-0.2.2.tgz", + "integrity": "sha512-FIUCJz1RbuS0FKTdaAafAByGS0CPvU3R0MeHxgtl+djzCc//F8HakL8GzmVNZanasTbTAY/3DRFA0KpVqj/eAw==", + "dev": true, + "dependencies": { + "merge": "^1.2.0" + } + }, "node_modules/execa": { "version": "5.1.1", "resolved": "https://registry.npmjs.org/execa/-/execa-5.1.1.tgz", @@ -8695,6 +8706,29 @@ "node": ">= 6" } }, + "node_modules/fs-extra": { + "version": "11.1.1", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-11.1.1.tgz", + "integrity": "sha512-MGIE4HOvQCeUCzmlHs0vXpih4ysz4wg9qiSAu6cd42lVwPbTM1TjV7RusoyQqMmk/95gdQZX72u+YW+c3eEpFQ==", + "dev": true, + "dependencies": { + "graceful-fs": "^4.2.0", + "jsonfile": "^6.0.1", + "universalify": "^2.0.0" + }, + "engines": { + "node": ">=14.14" + } + }, + "node_modules/fs-extra/node_modules/universalify": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.0.tgz", + "integrity": "sha512-hAZsKq7Yy11Zu1DE0OzWjw7nnLZmJZYTDZZyEFHZdUhV8FkH5MCfoU1XMaxXovpyW5nq5scPqq0ZDP9Zyl04oQ==", + "dev": true, + "engines": { + "node": ">= 10.0.0" + } + }, "node_modules/fs-minipass": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/fs-minipass/-/fs-minipass-2.1.0.tgz", @@ -12223,6 +12257,27 @@ "node": ">=6" } }, + "node_modules/jsonfile": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.1.0.tgz", + "integrity": "sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==", + "dev": true, + "dependencies": { + "universalify": "^2.0.0" + }, + "optionalDependencies": { + "graceful-fs": "^4.1.6" + } + }, + "node_modules/jsonfile/node_modules/universalify": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.0.tgz", + "integrity": "sha512-hAZsKq7Yy11Zu1DE0OzWjw7nnLZmJZYTDZZyEFHZdUhV8FkH5MCfoU1XMaxXovpyW5nq5scPqq0ZDP9Zyl04oQ==", + "dev": true, + "engines": { + "node": ">= 10.0.0" + } + }, "node_modules/jspdf": { "version": "2.5.1", "resolved": "https://registry.npmjs.org/jspdf/-/jspdf-2.5.1.tgz", @@ -13142,6 +13197,12 @@ "node": ">=10" } }, + "node_modules/merge": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/merge/-/merge-1.2.1.tgz", + "integrity": "sha512-VjFo4P5Whtj4vsLzsYBu5ayHhoHJ0UqNm7ibvShmbmoz7tGi0vXaoJbGdB+GmDMLUdg8DpQXEIeVDAe8MaABvQ==", + "dev": true + }, "node_modules/merge-stream": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz", @@ -16960,6 +17021,22 @@ "makeerror": "1.0.12" } }, + "node_modules/watch": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/watch/-/watch-1.0.2.tgz", + "integrity": "sha512-1u+Z5n9Jc1E2c7qDO8SinPoZuHj7FgbgU1olSFoyaklduDvvtX7GMMtlE6OC9FTXq4KvNAOfj6Zu4vI1e9bAKA==", + "dev": true, + "dependencies": { + "exec-sh": "^0.2.0", + "minimist": "^1.2.0" + }, + "bin": { + "watch": "cli.js" + }, + "engines": { + "node": ">=0.1.95" + } + }, "node_modules/web-worker": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/web-worker/-/web-worker-1.2.0.tgz", diff --git a/package.json b/package.json index f40e4c8f..7a2decc9 100644 --- a/package.json +++ b/package.json @@ -8,15 +8,19 @@ "dist" ], "scripts": { - "build": "rimraf ./dist/* && tsc -p tsconfig.json", + "build": "npm run clean && npm run build:dist && npm run build:declaration", + "build:declaration": "tsc --emitDeclarationOnly", + "build:dist": "tsc -p tsconfig.json", + "clean": "rimraf ./build/* ./coverage/* ./dist/*", "lint": "eslint -c .eslintrc --ext .tsx,.ts src/", "lint:fix": "eslint -c .eslintrc --ext .tsx,.ts src/ --fix", "prepublishOnly": "npm run lint:test:build", "release": "np --no-yarn && git push https://github.com/terrestris/react-util.git main", + "test": "jest --maxWorkers=4 --coverage", "test-ci": "jest --ci --coverage", "test-watch": "jest --watch", - "test": "jest --maxWorkers=4 --coverage", - "typecheck": "tsc --project tsconfig.json --noEmit" + "typecheck": "tsc --project tsconfig.json --noEmit", + "watch:buildto": "node watchBuild.js" }, "repository": { "type": "git", @@ -33,9 +37,9 @@ }, "homepage": "https://github.com/terrestris/react-util#readme", "peerDependencies": { + "ol": ">=7", "react": ">=17", - "react-dom": ">=17", - "ol": ">=7" + "react-dom": ">=17" }, "dependencies": { "@terrestris/base-util": "^1.0.1", @@ -48,7 +52,6 @@ "@babel/plugin-proposal-optional-chaining": "^7.13.12", "@babel/preset-env": "^7.14.1", "@babel/preset-react": "^7.13.13", - "eslint-plugin-simple-import-sort": "^10.0.0", "@babel/preset-typescript": "^7.13.0", "@cfaester/enzyme-adapter-react-18": "^0.7.1", "@terrestris/eslint-config-typescript": "^3.0.0", @@ -66,6 +69,8 @@ "core-js": "^3.12.0", "enzyme": "^3.11.0", "eslint": "^8.14.0", + "eslint-plugin-simple-import-sort": "^10.0.0", + "fs-extra": "^11.1.1", "jest": "^29.6.4", "jest-canvas-mock": "^2.5.2", "jest-environment-jsdom": "^29.6.4", @@ -83,6 +88,7 @@ "ts-jest": "^29.1.1", "typescript": "^4.2.4", "use-resize-observer": "^9.1.0", + "watch": "^1.0.2", "whatwg-fetch": "^3.6.18" } } diff --git a/watchBuild.js b/watchBuild.js new file mode 100644 index 00000000..c530dfb3 --- /dev/null +++ b/watchBuild.js @@ -0,0 +1,69 @@ +#!/usr/bin/env node +/* eslint-disable no-console */ + +'use strict'; + +const fs = require('fs-extra'); +const path = require('path'); +const watch = require('watch'); +const util = require('util'); +const exec = util.promisify(require('child_process').exec); + +const curDir = process.cwd(); + +if (process.argv.length < 3) { + console.log('please specify target path'); + console.log('for example npm run watch:buildto ../react-geo/node_modules/@terrestris/react-util/'); + process.exit(0); +} + +const sourcePath = path.join(curDir, 'src'); +const distPath = path.join(curDir, 'dist'); +const targetSourcePath = path.join(curDir, process.argv[2], 'src'); +const targetDistPath = path.join(curDir, process.argv[2], 'dist'); + +if (!fs.existsSync(targetSourcePath) || !fs.existsSync(targetDistPath) ) { + throw new Error('target does not exist'); +} + +async function buildAndCopy() { + console.log('run build'); + + try { + const { stdout, stderr} = await exec('npm run build'); + console.log(stdout); + console.log(stderr); + + console.log('copy dist / src'); + await fs.copy(distPath, targetDistPath); + await fs.copy(sourcePath, targetSourcePath); + + console.log('done'); + } catch (error) { + console.log('error'); + const { stdout, stderr } = error; + console.log(stdout); + console.log(stderr); + } +} + +buildAndCopy(); + +let timeout; + +function throttle(callback, time) { + if (!timeout) { + timeout = setTimeout(function () { + timeout = null; + callback(); + }, time); + } +} + +watch.watchTree(sourcePath, function (f, curr, prev) { + if (typeof f === 'object') { + console.log('watching'); + } else { + throttle(buildAndCopy, 1000); + } +}); From db0bc0ded7f209e61ab26dcc2dfb49e5a83ec4dc Mon Sep 17 00:00:00 2001 From: Andre Henn Date: Tue, 12 Sep 2023 12:28:39 +0200 Subject: [PATCH 2/3] feat: introduce useGeoLocation hook --- .../geolocation-marker-heading.png | Bin 0 -> 1705 bytes .../useGeoLocation/geolocation-marker.png | Bin 0 -> 829 bytes .../useGeoLocation/useGeoLocation.spec.ts | 10 + src/hooks/useGeoLocation/useGeoLocation.ts | 188 ++++++++++++++++++ src/index.ts | 6 +- 5 files changed, 202 insertions(+), 2 deletions(-) create mode 100644 src/hooks/useGeoLocation/geolocation-marker-heading.png create mode 100644 src/hooks/useGeoLocation/geolocation-marker.png create mode 100644 src/hooks/useGeoLocation/useGeoLocation.spec.ts create mode 100644 src/hooks/useGeoLocation/useGeoLocation.ts diff --git a/src/hooks/useGeoLocation/geolocation-marker-heading.png b/src/hooks/useGeoLocation/geolocation-marker-heading.png new file mode 100644 index 0000000000000000000000000000000000000000..0790dd54ea46ddd0187dd9dc0e4b00a52a9a1f4e GIT binary patch literal 1705 zcmV;a23GlrP)000McNliru;s*r`CB&hP*L1~y4V zK~!ko?OAPTQ&$*%?#)+|^sY<4($>t%)L_9)nTbV8i<{W}QLuxx;up$r*y8376$JZd zKh&u($o6j#gg_aoFeq;5YQ+}TcKyJKMV(oz*;11y05%6_XCHaP3DFx)h{4&}M*udnXGN^9BAcZ6Rq!1p zfC2#euCA_q#Rfyo`M&4;`M&3TvB6N&)z!5RfS&bHvN7DNIy(gb3;?Q4CR1%B8k-sm z#6+&( zH7)!1f94nq^8KDDK7OYhSKl+y@vUX3C{%NgXX4PQc<$XA)24-mh3&Y5Ad6zc}?*XuZjeRB7C7#KfLIB3j&dwI; zrBkAq92y$xXliOY2w*pW-AzqR2Zx4+I#QyTl=^jccD4X8G8?K@P%r!HB(^gSY?P$>LkHVJWAAoLUAuPm zF=yuiz-qM?0>H?~NK__D7rVQ=8w>_R!fLgC10cqPYbp~Zo+%-PY(don5C8~8MMXtU zr}G1|*}S#9ynKURuQvifEEbyz1OnqOm+O8@OUt*RP$&c-0w4@v0l*(DIEcCW<&-S+ z76Vud;O+MI_G5E%bK@k#qL`*dF)hDEb8~a!?d|Qy0KCP<7BgGQT>6lj%}OPJn%>^t zE9rDPNkrtHPf*)UH(BftNpoq0G?zxmVt+_&H{Il(PY@ANI-O4T_V!)@P{V8p%x2Ek zAr1Sg!sW}CYY!Ya@HxkE%CCQ(M$`3i^iM|NjV2)yAQIq>CNbiR!G3=RB|0T6m3qFq zy1G`U(~b1>^!SmCnK}Sc&5kU~D$LA6_cXx8xgU{Wa#Q0nSf*@3PbaWh%r4+~| zA$3(%)m8ww*zd(ca`_Q=A(_U-elGxk*-+=2kOF|xU@&X~fS;bnR%}2T!)z!s_3KOt z@y*T6rCP1FG_ok-Nie=*15bi+L>5J8wc66==H}8&-zif<;9xiwi%qH(9JUyBD>ksjsDoO;Ar^~G4h{~6Gc7=7N=O8d zoSmKh1ppe>3M)1sjbS#DnaZ9_38ermx?HY)061S)i8aFV7y31V8t3aO0RYT~Bu;at zwgo2pi~WAT-Dot{{_r$}JnpD0vRwwQR)uZx&%{YHFyWqT(X}vjC!Oam|VJ zkqYs=&*yuvckkYP=2D$z&&Jm=Fd0Q);pHEDbD0+3?>D3V4FSnyGSb%8);cye=4XmK zk?AaD0u@Ue$^fjl+wI5W@pyoUD3KD$@nD8d-g489YmaEhwMTUFmYW<8W+;&oiHIm3 zj|c2_`*8s4nGHR&nKLM4in|=Z`uh6%x`~O28}tvDn3%XxUteFx$dt>Jwj!54w6ug( zz|^ zp$~i@2|TZS^9?*-O+?T%O#_moRQdozB?ajGsTk-0ZIwvfcK`uIMC2f-D%@TMFD&*#Y)cI_kxO0u2RafKlL-<2cimN~Kt<)x1`#)eu#!R;y8~)x1ij zQgj?=8aSnTGRiQLuS=;_Wq>hY!gbvn&1UnH9H>^*kyg|>_(+<~<|o&6ZvYdjH>0c+ z>a#8N)(Ow^9>sASiHOwvJ-M^|Mb18bFUEs6Vmx>wXP>^8JIi0B=I@D!NF2wJ=XsA5 zKB}yAvf2T_a$WcQ+}zw_P1B6|weMVe{t>Slu=z707KjBle@48n|Ki!&7DosBm>wO} zbGh7wbUOWdb#?Wd+W%MsY`}6HC%eAB{@k|h@%gpy+45Kr^Ca_CIHIVhf{ztG&FP?;MLclYc#2(M;Qi?(gCedC}d6390}Vo?;7Eu;dhOY zupMKX=18GX$O4-F&#wP09gtF~)Cj|H%QSS(WX(e(XR;=yp%aGTR;g5K0HUJ?%J%m5 z2Y^e*tV6>|k22aoM^_iS)oS%E!2OG392rP;jUE|DasT2N0Ls_}+WT-mpI`8Of5Wl* zC|=HW4HqxxaI8Lj-`~jR^9u=_%w8=B0xZk=I5RVIZF+Q2Kc4C5Wi?=@Eq`6}b+@b(sDJzP{T|T4;%800000NkvXX Hu0mjfcPoHH literal 0 HcmV?d00001 diff --git a/src/hooks/useGeoLocation/useGeoLocation.spec.ts b/src/hooks/useGeoLocation/useGeoLocation.spec.ts new file mode 100644 index 00000000..f4f169ca --- /dev/null +++ b/src/hooks/useGeoLocation/useGeoLocation.spec.ts @@ -0,0 +1,10 @@ +// @ts-ignore +import { useGeoLocation } from './useGeoLocation'; + +jest.mock('react'); + +describe('basic test', () => { + it('is defined', () => { + expect(useGeoLocation).toBeDefined(); + }); +}); diff --git a/src/hooks/useGeoLocation/useGeoLocation.ts b/src/hooks/useGeoLocation/useGeoLocation.ts new file mode 100644 index 00000000..87a46ff6 --- /dev/null +++ b/src/hooks/useGeoLocation/useGeoLocation.ts @@ -0,0 +1,188 @@ +import MathUtil from '@terrestris/base-util/dist/MathUtil/MathUtil'; +import _isNil from 'lodash/isNil'; +import BaseEvent from 'ol/events/Event'; +import OlFeature from 'ol/Feature'; +import OlGeolocation from 'ol/Geolocation'; +import OlGeometry from 'ol/geom/Geometry'; +import OlGeomLineString from 'ol/geom/LineString'; +import OlGeomPoint from 'ol/geom/Point'; +import OlLayerVector from 'ol/layer/Vector'; +import RenderFeature from 'ol/render/Feature'; +import OlSourceVector from 'ol/source/Vector'; +import OlStyleIcon from 'ol/style/Icon'; +import OlStyleStyle from 'ol/style/Style'; +import {useEffect, useMemo, useState} from 'react'; + +import useMap from '../useMap'; +import {useOlLayer} from '../useOlLayer'; +import mapMarker from './geolocation-marker.png'; +import mapMarkerHeading from './geolocation-marker-heading.png'; + +export type UseGeoLocationArgs = { + active: boolean; + enableTracking?: boolean; + follow?: boolean; + onError?: () => void; + onGeoLocationChange?: (actualGeoLocation: GeoLocation) => void; + showMarker?: boolean; + trackingOptions?: PositionOptions; +}; + +export type GeoLocation = { + accuracy: number; + heading: number; + position: number[]; + speed: number; +}; + +export type GeoLocationType = { + actualPosition: GeoLocation; + trackedLine: OlGeomLineString; +}; + +/** + * This hook allows to debounce a setState. + */ +export const useGeoLocation = ({ + active, + enableTracking = false, + follow = false, + onError = () => {}, + onGeoLocationChange = () => {}, + showMarker = false, + trackingOptions = { + enableHighAccuracy: true, + maximumAge: 10000, + timeout: 600000 + } +}: UseGeoLocationArgs): GeoLocationType | undefined => { + + const map = useMap(); + + const [actualPosition, setActualPosition] = useState(); + + const trackedLine = useMemo(() => new OlGeomLineString([], 'XYZM'), []); + const markerFeature = useMemo(() => new OlFeature(), []); + + useOlLayer(() => new OlLayerVector({ + properties: { + name: 'react-geo_geolocationlayer', + }, + source: new OlSourceVector({ + features: [markerFeature] + }), + style: (feature: OlFeature | RenderFeature) => { + const heading = feature.get('heading'); + const src = heading !== 0 ? mapMarkerHeading : mapMarker; + const rotation = heading !== 0 ? heading * Math.PI / 180 : 0; + + return [new OlStyleStyle({ + image: new OlStyleIcon({ + rotation, + src + }) + })]; + } + }), [], showMarker); + + /** + * Callback of the interactions on change event. + */ + const onLocationChanged = (geoLocationEvent: BaseEvent) => { + const ac = geoLocationEvent.target as OlGeolocation; + + const position = ac.getPosition() ?? [0, 0]; + const accuracy = ac.getAccuracy(); + let heading = ac.getHeading() || 0; + const speed = ac.getSpeed() || 0; + + const x = position[0]; + const y = position[1]; + const fCoords = trackedLine.getCoordinates(); + const previous = fCoords[fCoords.length - 1]; + const prevHeading = previous && previous[2]; + if (prevHeading) { + let headingDiff = heading - MathUtil.mod(prevHeading); + + // force the rotation change to be less than 180° + if (Math.abs(headingDiff) > Math.PI) { + const sign = (headingDiff >= 0) ? 1 : -1; + headingDiff = -sign * (2 * Math.PI - Math.abs(headingDiff)); + } + heading = prevHeading + headingDiff; + } + trackedLine.appendCoordinate([x, y, heading, Date.now()]); + + // only keep the 20 last coordinates + trackedLine.setCoordinates(trackedLine.getCoordinates().slice(-20)); + + const actualGeoLocation: GeoLocation = { + position, + accuracy, + heading, + speed + }; + setActualPosition(actualGeoLocation); + onGeoLocationChange(actualGeoLocation); + }; + + // Geolocation Control + const olGeoLocation = useMemo(() => active ? new OlGeolocation({ + projection: map?.getView().getProjection() + }) : undefined, [active, map]); + + // re-centers the view by putting the given coordinates at 3/4 from the top or + // the screen + const getCenterWithHeading = (position: [number, number], rotation: number, resolution: number) => { + const size = map?.getSize() ?? [0, 0]; + const height = size[1]; + + return [ + position[0] - Math.sin(rotation) * height * resolution / 4, + position[1] + Math.cos(rotation) * height * resolution / 4 + ]; + }; + + useEffect(() => { + olGeoLocation?.on('change', onLocationChanged); + olGeoLocation?.on('error', onError); + + return () => { + olGeoLocation?.un('change', onLocationChanged); + olGeoLocation?.un('error', onError); + }; + }, [olGeoLocation, onError]); + + useEffect(() => { + olGeoLocation?.setTracking(enableTracking); + }, [enableTracking]); + + useEffect(() => { + olGeoLocation?.setTrackingOptions(trackingOptions); + }, [trackingOptions]); + + useEffect(() => { + const deltaMean = 500; // the geolocation sampling period mean in ms + // use sampling period to get a smooth transition + let m = Date.now() - deltaMean * 1.5; + m = Math.max(m, 0); + + // interpolate position along positions LineString + const c = trackedLine.getCoordinateAtM(m, true); + if (!_isNil(c)) { + if (follow) { + map?.getView().setCenter(getCenterWithHeading([c[0], c[1]], -c[2], map?.getView().getResolution() ?? 0)); + map?.getView().setRotation(-c[2]); + } + if (showMarker) { + const pointGeometry = new OlGeomPoint([c[0], c[1]]); + markerFeature.setGeometry(pointGeometry); + } + } + }, [actualPosition, showMarker, follow, map]); + + return { + actualPosition, + trackedLine + }; +}; diff --git a/src/index.ts b/src/index.ts index ef8fe2a7..8437eecf 100644 --- a/src/index.ts +++ b/src/index.ts @@ -2,6 +2,7 @@ import BackgroundLayerChooser from './BackgroundLayerChooser/BackgroundLayerChoo import BackgroundLayerPreview from './BackgroundLayerPreview/BackgroundLayerPreview'; import onDropAware from './HigherOrderComponent/DropTargetMap/DropTargetMap'; import timeLayerAware from './HigherOrderComponent/TimeLayerAware/TimeLayerAware'; +import {GeoLocation, useGeoLocation } from './hooks/useGeoLocation/useGeoLocation'; import useMap from './hooks/useMap'; import FloatingMapLogo from './Map/FloatingMapLogo/FloatingMapLogo'; import MapComponent from './Map/MapComponent/MapComponent'; @@ -17,12 +18,13 @@ export { ClickAwayListener, DigitizeUtil, FloatingMapLogo, + GeoLocation, InkmapPrintSpec, isWmsLayer, MapComponent, onDropAware, PrintUtil, timeLayerAware, + useGeoLocation, useMap, - WmsLayer -}; + WmsLayer}; From 76d1b4654b6e3cb8d9693c7b7270962a0ae8f0ea Mon Sep 17 00:00:00 2001 From: Andre Henn Date: Tue, 12 Sep 2023 12:32:32 +0200 Subject: [PATCH 3/3] chore: :lipstick: --- src/hooks/useGeoLocation/useGeoLocation.spec.ts | 1 - src/hooks/useGeoLocation/useGeoLocation.ts | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/hooks/useGeoLocation/useGeoLocation.spec.ts b/src/hooks/useGeoLocation/useGeoLocation.spec.ts index f4f169ca..4fe3e482 100644 --- a/src/hooks/useGeoLocation/useGeoLocation.spec.ts +++ b/src/hooks/useGeoLocation/useGeoLocation.spec.ts @@ -1,4 +1,3 @@ -// @ts-ignore import { useGeoLocation } from './useGeoLocation'; jest.mock('react'); diff --git a/src/hooks/useGeoLocation/useGeoLocation.ts b/src/hooks/useGeoLocation/useGeoLocation.ts index 87a46ff6..63c03e51 100644 --- a/src/hooks/useGeoLocation/useGeoLocation.ts +++ b/src/hooks/useGeoLocation/useGeoLocation.ts @@ -86,8 +86,8 @@ export const useGeoLocation = ({ }), [], showMarker); /** - * Callback of the interactions on change event. - */ + * Callback of the interactions on change event. + */ const onLocationChanged = (geoLocationEvent: BaseEvent) => { const ac = geoLocationEvent.target as OlGeolocation;