diff --git a/src/controls/MMapRouteControl/MMapWaypointInput/index.ts b/src/controls/MMapRouteControl/MMapWaypointInput/index.ts index bde3bf5..ee233dc 100644 --- a/src/controls/MMapRouteControl/MMapWaypointInput/index.ts +++ b/src/controls/MMapRouteControl/MMapWaypointInput/index.ts @@ -216,7 +216,10 @@ export class MMapWaypointInput extends mappable.MMapComplexEntity { this._isInputFocused = true; - this._suggestComponent.update({suggestNavigationAction: undefined}); + this._suggestComponent.update({ + searchInputValue: this.getValue(), + suggestNavigationAction: undefined + }); this._addDirectChild(this._suggestComponent); this._updateIndicatorStatus('focus'); }; diff --git a/src/controls/MMapRouteControl/index.ts b/src/controls/MMapRouteControl/index.ts index 760bb86..9371072 100644 --- a/src/controls/MMapRouteControl/index.ts +++ b/src/controls/MMapRouteControl/index.ts @@ -254,6 +254,7 @@ class MMapCommonRouteControl extends mappable.MMapComplexEntity { this._waypointInputFromElement.update({waypoint: null}); this._waypointInputToElement.update({waypoint: null}); + this._clearInfo(); + }; + + private _clearInfo = () => { this._routeInfoElement.replaceChildren(); if (this._routeInfoElement.parentElement === this._rootElement) { this._rootElement.removeChild(this._routeInfoElement); } - }; + } private _changeOrder = () => { const [fromOld, toOld] = this._waypoints; @@ -336,7 +341,6 @@ class MMapCommonRouteControl extends mappable.MMapComplexEntity { } private _updateSuggestList = async (searchInputValue: MMapSuggestProps['searchInputValue']) => { + this._removeSuggestItems(); + const suggestResult = (await this._props.suggest?.({text: searchInputValue, map: this.root})) ?? (await mappable.suggest({text: searchInputValue})); - this._removeSuggestItems(); - this._addSuggestItems(suggestResult, this._props.onSuggestClick); this._getSuggestElements().at(0)?.classList.add(ACTIVE_CLASS);