Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
ol_control_LayerSwitcher.prototype.setMap = function(map) {
ol_control_Control.prototype.setMap.call(this, map);
this.drawPanel();
if (this._listener) {
if (this._listener) ol_Observable_unByKey(this._listener.change);
if (this._listener) ol_Observable_unByKey(this._listener.moveend);
if (this._listener) ol_Observable_unByKey(this._listener.size);
}
this._listener = null;
// Get change (new layer added or removed)
if (map) {
this._listener = {
change: map.getLayerGroup().on('change', this.drawPanel.bind(this)),
moveend: map.on('moveend', this.viewChange.bind(this)),
size: map.on('change:size', this.overflow.bind(this))
}
}
};
function animate(event)
{ var frameState = event.frameState;
var ratio = frameState.pixelRatio;
var elapsed = frameState.time - start;
if (elapsed > duration) ol_Observable_unByKey(listenerKey);
else
{ var elapsedRatio = elapsed / duration;
var p0 = this.getPixelFromCoordinate([extent[0],extent[1]]);
var p1 = this.getPixelFromCoordinate([extent[2],extent[3]]);
var context = event.context;
context.save();
context.scale(ratio,ratio);
context.beginPath();
// var e = easing(elapsedRatio)
context.globalAlpha = easing(1 - elapsedRatio);
context.lineWidth = width;
context.strokeStyle = color;
context.rect(p0[0], p0[1], p1[0]-p0[0], p1[1]-p0[1]);
context.stroke();
context.restore();
private deactivateModifyInteraction() {
if (this.olModifyInteractionIsActive === false) {
return;
}
this.olModifyInteractionIsActive = false;
unByKey(this.onModifyStartKey);
unByKey(this.onModifyEndKey);
if (this.olMap !== undefined) {
this.olMap.removeInteraction(this.olModifyInteraction);
}
}
private onDrawEnd(event: OlDrawEvent) {
if (this.onDrawKey !== undefined) {
unByKey(this.onDrawKey);
}
this.olOuterGeometry = undefined;
const linearRingCoordinates = event.feature.getGeometry().getLinearRing().getCoordinates();
this.updateLinearRingOfOlGeometry(linearRingCoordinates);
this.clearOlLinearRingsSource();
this.end$.next(this.getOlGeometry());
this.unsubscribeToKeyDown();
}
setMap (map) {
let onMapChangeMobile = () => {
if (map.get('mobile')) {
this.centerOnPopup_ = false
} else {
this.centerOnPopup_ = this.centerOnPopupInitial_
}
}
if (this.getMap()) {
this.getMap().un('change:mobile', onMapChangeMobile)
unByKey(this.listenerKey_)
}
this.map_ = map
if (map) {
this.utilitySource_ = new VectorSource()
this.utilityLayer_ = new VectorLayer({
visible: false,
source: this.utilitySource_
})
map.addLayer(this.utilityLayer_)
this.layers_ = []
let interaction = new MapEventInteraction({ type: 'singleclick' })
interaction.on('mapevent', e => this.handleClickEvent(e))
function terminateDraw() {
setTimeout(() => {
mapUiEvents.trigger('enable-click-zoom');
}, 500);
sketch = null;
measureTooltipElement = null;
store.dispatch(toggleMeasureActive(false));
map.removeInteraction(draw);
OlObservableUnByKey(drawChangeListener);
OlObservableUnByKey(rightClickListener);
OlObservableUnByKey(twoFingerTouchListener);
}
componentWillUnmount() {
unByKey(this.olListenerKeys);
}
ol_Game.prototype.setMap = function(map) {
if (this._listener) ol_Observable.unByKey(this._listener);
this._listener = null;
this.map = map;
if (this.map) {
this._listener = this.map.on ("postcompose", this.anim_.bind(this));
}
};
this._listener.forEach(function(l) {
ol_Observable_unByKey(l);
}.bind(this));
}