Skip to content

Commit e5ec8c3

Browse files
author
ChenGuanglin
committed
【update】迁徙图线hover样式改为default
review by zhaoq
1 parent 09a236d commit e5ec8c3

File tree

1 file changed

+27
-3
lines changed

1 file changed

+27
-3
lines changed

src/openlayers/mapping/WebMap.js

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1657,6 +1657,8 @@ export class WebMap extends ol.Observable {
16571657
layer.appendTo(this.map);
16581658
// 在这里恢复图层可见性状态
16591659
layer.setVisible(layerInfo.visible);
1660+
// 设置鼠标样式为默认
1661+
layer.setCursor();
16601662
} else {
16611663
layerInfo.opacity != undefined && layer.setOpacity(layerInfo.opacity);
16621664
layer.setVisible(layerInfo.visible);
@@ -2958,7 +2960,13 @@ export class WebMap extends ol.Observable {
29582960
* @returns {ol.layer} 图层
29592961
*/
29602962
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+
// 设置图层可见性
29622970
if (!window.ol3Echarts.prototype.setVisible) {
29632971
window.ol3Echarts.prototype.setVisible = function(visible) {
29642972
if (visible) {
@@ -2975,13 +2983,29 @@ export class WebMap extends ol.Observable {
29752983
}
29762984
};
29772985
}
2986+
// 设置图层层级
29782987
if (!window.ol3Echarts.prototype.setZIndex) {
29792988
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;
29822992
}
29832993
};
29842994
}
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+
}
29853009
let properties = Util.getFeatureProperties(features);
29863010
let lineData = this.createLinesData(layerInfo, properties);
29873011
let pointData = this.createPointsData(lineData, layerInfo, properties);

0 commit comments

Comments
 (0)