Call <Finder> on intent
This commit is contained in:
parent
dec79c9c2d
commit
0af58ccb4f
|
@ -16,6 +16,7 @@ import WptEditDialog from '../wpt/WptEditDialog';
|
|||
|
||||
const [popup, setPopup] = createSignal<Overlay>();
|
||||
const [open, setOpen] = createSignal(false);
|
||||
const [coordinate, setCoordinate] = createSignal<Coordinate>();
|
||||
let popupElement: HTMLElement;
|
||||
|
||||
export const findLocation = (
|
||||
|
@ -37,6 +38,7 @@ export const findLocation = (
|
|||
popup: popup(),
|
||||
popupElement,
|
||||
});
|
||||
setCoordinate(coordinate);
|
||||
popup().setMap(getMap());
|
||||
popup().setPosition(fromLonLat(coordinate));
|
||||
getMap()?.addOverlay(popup());
|
||||
|
@ -54,7 +56,6 @@ const Finder: Component<Props> = (props) => {
|
|||
const [searchString, setSearchString] = createSignal('');
|
||||
const [popupContent, setPopupContent] = createSignal(<></>);
|
||||
const [t, { add, locale, dict }] = useI18n();
|
||||
const [coordinate, setCoordinate] = createSignal<Coordinate>();
|
||||
const searchStringChangeHandler = (event: any) => {
|
||||
setSearchString(event.target.value);
|
||||
};
|
||||
|
|
|
@ -42,7 +42,7 @@ import { debounce } from 'lodash';
|
|||
import { AndroidFullScreen } from '@awesome-cordova-plugins/android-full-screen';
|
||||
import Account from '../account';
|
||||
import { Overlays } from '../overlays/Overlays';
|
||||
import Finder from '../finder';
|
||||
import Finder, { findLocation } from '../finder';
|
||||
|
||||
const [getState, setState] = createSignal({
|
||||
lon: 0,
|
||||
|
@ -92,13 +92,8 @@ const Map: Component = () => {
|
|||
const url = new URL(intent.data);
|
||||
const q = url.search;
|
||||
const [, lat, lon] = q.match(/q=([0-9.-]+),([0-9.-]+)/);
|
||||
const zoom = Math.max(16, getState().zoom);
|
||||
console.log({ caller: 'Intent receiver', intent, url, lat, lon, zoom });
|
||||
navigate(
|
||||
`/map/${getState().provider}/${lon}/${lat}/${zoom}/${
|
||||
getState().rotation
|
||||
}#mark=fromIntent`
|
||||
);
|
||||
console.log({ caller: 'Intent receiver', intent, url, lat, lon });
|
||||
findLocation(navigate, [lon, lat]);
|
||||
});
|
||||
} else {
|
||||
console.log({
|
||||
|
@ -297,7 +292,6 @@ const Map: Component = () => {
|
|||
<Account />
|
||||
<AllGpxes map={getMap} />
|
||||
<Infos />
|
||||
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue