Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
setOpacity(opacity) {
if (opacity !== this.opacity) {
this.opacity = opacity;
var element = this.rootCanvas;
CommonUtil.modifyDOMElement(element, null, null, null,
null, null, null, opacity);
if (this.map !== null) {
// this.dispatchEvent({type: 'changelayer', value: {layer: this, property: "opacity"}});
this.changed();
}
}
}
setOpacity(opacity) {
if (opacity !== this.opacity) {
this.opacity = opacity;
var element = this.div;
CommonUtil.modifyDOMElement(element, null, null, null,
null, null, null, opacity);
if (this.map !== null) {
/**
* @event mapboxgl.supermap.ThemeLayer#changelayer
* @description 图层属性改变之后触发。
* @property {Object} layer - 图层。
* @property {string} property - 被改变的属性。
*/
mapboxgl.Evented.prototype.fire('changelayer', {layer: this, property: "opacity"});
}
}
}
setOpacity(opacity) {
if (opacity !== this.opacity) {
this.opacity = opacity;
var element = this.div;
CommonUtil.modifyDOMElement(element, null, null, null,
null, null, null, opacity);
if (this.map !== null) {
this.dispatchEvent({type: 'changelayer', value: {layer: this, property: "opacity"}});
}
}
}
this.opacity = options.opacity ? options.opacity : 1;
this.colors = options.colors ? options.colors : ['blue', 'cyan', 'lime', 'yellow', 'red'];
this.useGeoUnit = options.useGeoUnit ? options.useGeoUnit : false;
this.radius = options.radius ? options.radius : 50;
this.featureWeight = options.featureWeight ? options.featureWeight : null;
this.maxWeight = null;
this.minWeight = null;
this.maxWidth = null;
this.maxHeight = null;
//创建热力图绘制面板
this.rootCanvas = document.createElement("canvas");
var mapSize = this.map.getSize();
this.rootCanvas.width = this.maxWidth = parseInt(mapSize[0]);
this.rootCanvas.height = this.maxHeight = parseInt(mapSize[1]);
CommonUtil.modifyDOMElement(this.rootCanvas, null, null, null,
null, null, null, this.opacity);
this.canvasContext = this.rootCanvas.getContext('2d');
}
_createCanvasContainer() {
this.supported = true;
//构建绘图面板
this.mapContainer = this.map.getCanvasContainer();
//热点图要求使用canvas绘制,判断是否支持
this.rootCanvas = document.createElement("canvas");
this.rootCanvas.id = this.id;
var mapCanvas = this.map.getCanvas();
this.rootCanvas.width = this.maxWidth = parseInt(mapCanvas.width);
this.rootCanvas.height = this.maxHeight = parseInt(mapCanvas.height);
CommonUtil.modifyDOMElement(this.rootCanvas, null, null, null,
"absolute", null, null, this.opacity);
this.canvasContext = this.rootCanvas.getContext('2d');
this.mapContainer.appendChild(this.rootCanvas);
}
_updateOpacity: function () {
var me = this;
CommonUtil.modifyDOMElement(me.container, null, null, null, null, null, null, me.options.opacity);
if (me._map !== null) {
/**
* @event L.supermap.ThemeLayer#changelayer
* @description 图层属性改变之后触发。
* @property {Object} layer - 图层。
* @property {string} property - 图层属性。
*/
me._map.fire("changelayer", {
layer: me,
property: "opacity"
});
}
},
setOpacity(opacity) {
if (opacity !== this.opacity) {
this.opacity = opacity;
CommonUtil.modifyDOMElement(this.rootCanvas, null, null, null,
null, null, null, opacity);
if (this.map !== null) {
/**
* @event mapboxgl.supermap.HeatMapLayer#changelayer
* @description 图层属性改变之后触发。
* @property {Object} layer - 图层。
* @property {string} property - 被改变的图层属性。
*/
this.fire('changelayer', {layer: this, property: "opacity"});
}
}
}