From b2daa49bc9fbb2c1bbdb33c3ada67eb310204faf Mon Sep 17 00:00:00 2001 From: naoki Date: Tue, 30 Jul 2024 13:59:10 +0900 Subject: [PATCH] =?UTF-8?q?getSource=E3=81=AE=E4=BB=95=E6=A7=98=E5=A4=89?= =?UTF-8?q?=E6=9B=B4=E3=81=AB=E3=82=88=E3=82=8A=E3=82=AF=E3=83=A9=E3=82=B9?= =?UTF-8?q?=E3=82=BF=E3=83=AA=E3=83=B3=E3=82=B0=E3=82=AF=E3=83=AA=E3=83=83?= =?UTF-8?q?=E3=82=AF=E6=99=82=E3=81=AE=E3=82=BA=E3=83=BC=E3=83=A0=E3=81=8C?= =?UTF-8?q?=E5=8A=B9=E3=81=8B=E3=81=AA=E3=81=8F=E3=81=AA=E3=81=A3=E3=81=A6?= =?UTF-8?q?=E3=81=84=E3=81=9F=E3=81=AE=E3=81=A7=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/lib/simplestyle.ts | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/src/lib/simplestyle.ts b/src/lib/simplestyle.ts index bcb1895..19c369e 100644 --- a/src/lib/simplestyle.ts +++ b/src/lib/simplestyle.ts @@ -304,17 +304,14 @@ export class SimpleStyle { }, }); - this.map.on('click', `${this.options.id}-clusters`, (e) => { + this.map.on('click', `${this.options.id}-clusters`, async (e) => { const features = this.map.queryRenderedFeatures(e.point, { layers: [`${this.options.id}-clusters`] }); const clusterId = features[0].properties.cluster_id; - this.map.getSource(`${this.options.id}-points`).getClusterExpansionZoom(clusterId, (err, zoom) => { - if (err) - return; - - this.map.easeTo({ - center: features[0].geometry.coordinates, - zoom: zoom, - }); + const zoom = await this.map.getSource(`${this.options.id}-points`).getClusterExpansionZoom(clusterId); + + this.map.easeTo({ + center: features[0].geometry.coordinates, + zoom: zoom, }); });