Skip to content

Commit

Permalink
fix infowindow Repeat display (#616)
Browse files Browse the repository at this point in the history
* fix infowindow Repeat display

* Model add getCoordinates method
  • Loading branch information
deyihu authored Aug 24, 2023
1 parent 676608d commit d5b2a55
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
9 changes: 9 additions & 0 deletions src/Model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
5 changes: 4 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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 });
}
}
Expand Down
1 change: 1 addition & 0 deletions types/maptalks/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit d5b2a55

Please sign in to comment.