@@ -23,6 +23,7 @@ import SdkConfig from '../../../SdkConfig';
2323import { replaceableComponent } from "../../../utils/replaceableComponent" ;
2424import { IBodyProps } from "./IBodyProps" ;
2525import { _t } from '../../../languageHandler' ;
26+ import MemberAvatar from '../avatars/MemberAvatar' ;
2627
2728interface IState {
2829 error : Error ;
@@ -32,7 +33,6 @@ interface IState {
3233export default class MLocationBody extends React . Component < IBodyProps , IState > {
3334 private map : maplibregl . Map ;
3435 private coords : GeolocationCoordinates ;
35- private description : string ;
3636
3737 constructor ( props : IBodyProps ) {
3838 super ( props ) ;
@@ -49,8 +49,6 @@ export default class MLocationBody extends React.Component<IBodyProps, IState> {
4949 this . state = {
5050 error : undefined ,
5151 } ;
52-
53- this . description = loc ?. description ?? content [ 'body' ] ;
5452 }
5553
5654 componentDidMount ( ) {
@@ -65,13 +63,12 @@ export default class MLocationBody extends React.Component<IBodyProps, IState> {
6563 zoom : 13 ,
6664 } ) ;
6765
68- new maplibregl . Popup ( {
69- closeButton : false ,
70- closeOnClick : false ,
71- closeOnMove : false ,
66+ new maplibregl . Marker ( {
67+ element : document . getElementById ( this . getMarkerId ( ) ) ,
68+ anchor : 'bottom' ,
69+ offset : [ 0 , - 1 ] ,
7270 } )
7371 . setLngLat ( coordinates )
74- . setHTML ( this . description )
7572 . addTo ( this . map ) ;
7673
7774 this . map . on ( 'error' , ( e ) => {
@@ -88,6 +85,10 @@ export default class MLocationBody extends React.Component<IBodyProps, IState> {
8885 return `mx_MLocationBody_${ this . props . mxEvent . getId ( ) } ` ;
8986 } ;
9087
88+ private getMarkerId = ( ) => {
89+ return `mx_MLocationBody_marker_${ this . props . mxEvent . getId ( ) } ` ;
90+ } ;
91+
9192 render ( ) {
9293 const error = this . state . error ?
9394 < div className = "mx_EventTile_tileError mx_EventTile_body" >
@@ -97,6 +98,22 @@ export default class MLocationBody extends React.Component<IBodyProps, IState> {
9798 return < div className = "mx_MLocationBody" >
9899 < div id = { this . getBodyId ( ) } className = "mx_MLocationBody_map" />
99100 { error }
101+ < div className = "mx_MLocationBody_marker" id = { this . getMarkerId ( ) } >
102+ < div className = "mx_MLocationBody_markerBorder" >
103+ < MemberAvatar
104+ member = { this . props . mxEvent . sender }
105+ width = { 27 }
106+ height = { 27 }
107+ viewUserOnClick = { false }
108+ />
109+ </ div >
110+ < img
111+ className = "mx_MLocationBody_pointer"
112+ src = { require ( "../../../../res/img/location/pointer.svg" ) }
113+ width = "9"
114+ height = "5"
115+ />
116+ </ div >
100117 </ div > ;
101118 }
102119}
0 commit comments