@@ -1657,6 +1657,8 @@ export class WebMap extends ol.Observable {
1657
1657
layer . appendTo ( this . map ) ;
1658
1658
// 在这里恢复图层可见性状态
1659
1659
layer . setVisible ( layerInfo . visible ) ;
1660
+ // 设置鼠标样式为默认
1661
+ layer . setCursor ( ) ;
1660
1662
} else {
1661
1663
layerInfo . opacity != undefined && layer . setOpacity ( layerInfo . opacity ) ;
1662
1664
layer . setVisible ( layerInfo . visible ) ;
@@ -2958,7 +2960,13 @@ export class WebMap extends ol.Observable {
2958
2960
* @returns {ol.layer } 图层
2959
2961
*/
2960
2962
createMigrationLayer ( layerInfo , features ) {
2961
- // 给ol3Echarts上添加设置图层可见性和设置图层层级的方法
2963
+ // 获取图层外包DOM
2964
+ if ( ! window . ol3Echarts . prototype . getContainer ) {
2965
+ window . ol3Echarts . prototype . getContainer = function ( ) {
2966
+ return this . $container ;
2967
+ } ;
2968
+ }
2969
+ // 设置图层可见性
2962
2970
if ( ! window . ol3Echarts . prototype . setVisible ) {
2963
2971
window . ol3Echarts . prototype . setVisible = function ( visible ) {
2964
2972
if ( visible ) {
@@ -2975,13 +2983,29 @@ export class WebMap extends ol.Observable {
2975
2983
}
2976
2984
} ;
2977
2985
}
2986
+ // 设置图层层级
2978
2987
if ( ! window . ol3Echarts . prototype . setZIndex ) {
2979
2988
window . ol3Echarts . prototype . setZIndex = function ( zIndex ) {
2980
- if ( this . $container ) {
2981
- this . $container . style . zIndex = zIndex ;
2989
+ let container = this . getContainer ( ) ;
2990
+ if ( container ) {
2991
+ container . style . zIndex = zIndex ;
2982
2992
}
2983
2993
} ;
2984
2994
}
2995
+ /**
2996
+ * 设置鼠标样式
2997
+ * .cursor-default > div {
2998
+ * cursor: default !important;
2999
+ * }
3000
+ */
3001
+ if ( ! window . ol3Echarts . prototype . setCursor ) {
3002
+ window . ol3Echarts . prototype . setCursor = function ( cursor = 'default' ) {
3003
+ let container = this . getContainer ( ) ;
3004
+ if ( container && cursor === 'default' ) {
3005
+ container . classList . add ( 'cursor-default' ) ;
3006
+ }
3007
+ }
3008
+ }
2985
3009
let properties = Util . getFeatureProperties ( features ) ;
2986
3010
let lineData = this . createLinesData ( layerInfo , properties ) ;
2987
3011
let pointData = this . createPointsData ( lineData , layerInfo , properties ) ;
0 commit comments