@@ -74,7 +74,7 @@ export default class PopupLayer {
7474 this . camera = map . camera ;
7575 this . isShow = true ;
7676
77- let ScreenSpaceEventHandler = Cesium . ScreenSpaceEventHandler || window [ " Cesium" ] . ScreenSpaceEventHandler ;
77+ let ScreenSpaceEventHandler = Cesium . ScreenSpaceEventHandler || window [ ' Cesium' ] . ScreenSpaceEventHandler ;
7878
7979 this . handler = new ScreenSpaceEventHandler ( this . scene . canvas ) ;
8080
@@ -89,9 +89,23 @@ export default class PopupLayer {
8989 this . position . cartesian ||
9090 Cesium . Cartesian3 . fromDegrees ( this . position . longitude , this . position . latitude , this . position . height ) ;
9191
92- let parents = document . getElementsByClassName ( 'cesium-widget' ) ;
93- parent = parents . length > 0 ? parents [ 0 ] : map . container ;
94- this . parent = parent ;
92+ let vc = this . map . container ;
93+ let cesumWidgetContainer = undefined ;
94+ if ( vc . children && vc . children . length > 0 ) {
95+ if ( vc . children [ 0 ] . children && vc . children [ 0 ] . children . length > 0 ) {
96+ if ( vc . children [ 0 ] . children [ 0 ] . children && vc . children [ 0 ] . children [ 0 ] . children . length > 0 ) {
97+ cesumWidgetContainer = vc . children [ 0 ] . children [ 0 ] . children [ 0 ] ;
98+ }
99+ }
100+ }
101+
102+ if ( ! cesumWidgetContainer ) {
103+ let parents = document . getElementsByClassName ( 'cesium-widget' ) ;
104+ parent = parents . length > 0 ? parents [ 0 ] : map . container ;
105+ this . parent = parent ;
106+ } else {
107+ this . parent = cesumWidgetContainer ;
108+ }
95109
96110 // this.initDevicePixelRatio();
97111 this . showClose = options . showClose === undefined ? true : options . showClose ;
0 commit comments