From d5b2a5562b10d59bafb3fafe7412a2dca283cbca Mon Sep 17 00:00:00 2001 From: hu de yi Date: Thu, 24 Aug 2023 17:14:37 +0800 Subject: [PATCH] fix infowindow Repeat display (#616) * fix infowindow Repeat display * Model add getCoordinates method --- src/Model.ts | 9 +++++++++ src/index.ts | 5 ++++- types/maptalks/index.d.ts | 1 + 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/Model.ts b/src/Model.ts index 141e98e..2aa67cb 100644 --- a/src/Model.ts +++ b/src/Model.ts @@ -29,6 +29,15 @@ class Model extends BaseObject { this.getObject3d().position.copy(position); this.type = 'Model'; } + + + getCoordinates() { + const coordinate = this.options.coordinate; + const altitude = this.options.altitude; + const c = new maptalks.Coordinate(coordinate); + c.z = altitude; + return c; + } } export default Model; diff --git a/src/index.ts b/src/index.ts index c2a9c12..67f2f9b 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1043,6 +1043,7 @@ class ThreeLayer extends maptalks.CanvasLayer { type = type || event.type; const e = this._getEventParams(event); const { coordinate } = (e as any); + const map = this.getMap(); function showInfoWindow(baseObject: BaseObject, eventType?: string) { eventType = eventType || type; const infoWindow = baseObject.getInfoWindow(); @@ -1053,7 +1054,9 @@ class ThreeLayer extends maptalks.CanvasLayer { const infoOptions = infoWindow ? (infoWindow as any).options : {}; const autoOpenOn = infoOptions['autoOpenOn'] || 'click'; if (autoOpenOn === eventType) { - baseObject.openInfoWindow(coordinate); + if (!map.options.supportPluginEvent) { + baseObject.openInfoWindow(coordinate); + } baseObject.fire('showinfowindow', { infoWindow }); } } diff --git a/types/maptalks/index.d.ts b/types/maptalks/index.d.ts index 9b141ec..de4b8a1 100644 --- a/types/maptalks/index.d.ts +++ b/types/maptalks/index.d.ts @@ -51,6 +51,7 @@ declare namespace worker { declare class Coordinate { x: number; y: number; + z?:number; constructor(parameters: any) constructor(x: number, y: number) equals(coordinate: Coordinate): boolean