@@ -20,6 +20,9 @@ var popupsIdIndex = 0;
2020 * @param {String } [options.popupContentId] 本次popup对应的唯一内容id
2121 * @param {Boolean } [options.postRender=true] 是否实时渲染
2222 * @param {Boolean } [options.showClose=true] 是否显示关闭按钮
23+ * @param {Object } [options.callback]
24+ * @param {Function } [options.callback.onShow] 显示popup事件的回调
25+ * @param {Function } [options.callback.onHide] 隐藏popup事件的回调
2326 * @param {Element|String } container 外部传入的div的字符串描述方式,一般是文字或者echarts的div;
2427 *
2528 * @example 这里唯一要注意的是我们中地数码的ceisum的右键事件不是放大缩小而是旋转视角
@@ -74,6 +77,12 @@ export default class PopupLayer {
7477 this . camera = map . camera ;
7578 this . isShow = true ;
7679
80+ if ( options . callback ) {
81+ const { onShow, onHide } = options . callback ;
82+ this . onShow = onShow ;
83+ this . onHide = onHide
84+ }
85+
7786 let ScreenSpaceEventHandler = Cesium . ScreenSpaceEventHandler || window [ 'Cesium' ] . ScreenSpaceEventHandler ;
7887
7988 this . handler = new ScreenSpaceEventHandler ( this . scene . canvas ) ;
@@ -215,6 +224,9 @@ export default class PopupLayer {
215224 */
216225 show ( ) {
217226 this . isShow = true ;
227+ if ( this . onShow ) {
228+ this . onShow ( this . isShow ) ;
229+ }
218230 let node = window . document . getElementById ( this . popupId ) ;
219231 if ( node && node . style ) {
220232 node . style . display = 'block' ;
@@ -227,6 +239,9 @@ export default class PopupLayer {
227239 */
228240 hide ( ) {
229241 this . isShow = false ;
242+ if ( this . onHide ) {
243+ this . onHide ( this . isShow ) ;
244+ }
230245 let node = window . document . getElementById ( this . popupId ) ;
231246 if ( node && node . style ) {
232247 node . style . display = 'none' ;
0 commit comments