From 12f67828950f3ac174d1be3b7f86c25390287d8c Mon Sep 17 00:00:00 2001 From: Matthew Kalinin Date: Wed, 17 Apr 2024 16:49:51 +0300 Subject: [PATCH] remove close callback from popup content --- src/markers/MMapBalloonMarker/index.ts | 10 +++------- src/markers/MMapDefaultPopupMarker/index.ts | 6 +++--- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/src/markers/MMapBalloonMarker/index.ts b/src/markers/MMapBalloonMarker/index.ts index ac4c96e..15438da 100644 --- a/src/markers/MMapBalloonMarker/index.ts +++ b/src/markers/MMapBalloonMarker/index.ts @@ -12,7 +12,7 @@ export type MMapBalloonPositionProps = | `${VerticalPosition} ${HorizontalPosition}` | `${HorizontalPosition} ${VerticalPosition}`; -export type MMapBalloonContentProps = (close: () => void) => HTMLElement; +export type MMapBalloonContentProps = () => HTMLElement; export type MMapBalloonMarkerProps = MMapMarkerProps & { /** @@ -91,7 +91,7 @@ export class MMapBalloonMarker extends mappable.MMapComplexEntity { - this._togglePopup(false); - }; } diff --git a/src/markers/MMapDefaultPopupMarker/index.ts b/src/markers/MMapDefaultPopupMarker/index.ts index a183a66..878bb1e 100644 --- a/src/markers/MMapDefaultPopupMarker/index.ts +++ b/src/markers/MMapDefaultPopupMarker/index.ts @@ -65,7 +65,7 @@ export class MMapDefaultPopupMarker extends mappable.MMapComplexEntity this.__createDefaultPopup(close)}); + this._balloon.update({content: () => this.__createDefaultPopup()}); } this._balloon.update(this._props); @@ -76,7 +76,7 @@ export class MMapDefaultPopupMarker extends mappable.MMapComplexEntity { + private __createDefaultPopup: MMapBalloonContentProps = () => { const {title, description, action} = this._props; this._element = document.createElement('mappable'); this._element.classList.add('mappable--default-popup'); @@ -95,7 +95,7 @@ export class MMapDefaultPopupMarker extends mappable.MMapComplexEntity close()); + closeButton.addEventListener('click', () => this._balloon.update({show: false})); popupHeaderElement.appendChild(closeButton); if (description) {