Skip to content

Commit

Permalink
[FIX] fix ol v5 #123
Browse files Browse the repository at this point in the history
  • Loading branch information
Viglino committed Jun 27, 2018
1 parent d658b8d commit b8dfba1
Show file tree
Hide file tree
Showing 11 changed files with 25 additions and 14 deletions.
3 changes: 2 additions & 1 deletion src/control/CanvasAttribution.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
*/

import ol from 'ol'
import ol_Observable from 'ol/Observable'
import ol_control_Attribution from 'ol/control/attribution'
import ol_style_Style from 'ol/style/style'
import ol_color from 'ol/color'
Expand Down Expand Up @@ -67,7 +68,7 @@ ol_control_CanvasAttribution.prototype.setStyle = function (style)
*/
ol_control_CanvasAttribution.prototype.setMap = function (map)
{ var oldmap = this.getMap();
if (this._listener) ol.Observable.unByKey(this._listener);
if (this._listener) ol_Observable.unByKey(this._listener);
this._listener = null;

ol_control_ScaleLine.prototype.setMap.call(this, map);
Expand Down
3 changes: 2 additions & 1 deletion src/control/CanvasScaleLine.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
*/

import ol from 'ol'
import ol_Observable from 'ol/Observable'
import ol_control_ScaleLine from 'ol/control/scaleline'
import ol_style_Style from 'ol/style/style'
import ol_color from 'ol/color'
Expand Down Expand Up @@ -39,7 +40,7 @@ ol.inherits(ol_control_CanvasScaleLine, ol_control_ScaleLine);
*/
ol_control_CanvasScaleLine.prototype.setMap = function (map)
{ var oldmap = this.getMap();
if (this._listener) ol.Observable.unByKey(this._listener);
if (this._listener) ol_Observable.unByKey(this._listener);
this._listener = null;

ol_control_ScaleLine.prototype.setMap.call(this, map);
Expand Down
3 changes: 2 additions & 1 deletion src/control/CanvasTitle.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
*/

import ol from 'ol'
import ol_Observable from 'ol/Observable'
import ol_control_Control from 'ol/control/control'
import ol_color from 'ol/color'
import ol_style_Style from 'ol/style/style'
Expand Down Expand Up @@ -50,7 +51,7 @@ ol.inherits(ol_control_CanvasTitle, ol_control_Control);
*/
ol_control_CanvasTitle.prototype.setMap = function (map)
{ var oldmap = this.getMap();
if (this._listener) ol.Observable.unByKey(this._listener);
if (this._listener) ol_Observable.unByKey(this._listener);
this._listener = null;

ol_control_Control.prototype.setMap.call(this, map);
Expand Down
3 changes: 2 additions & 1 deletion src/control/Cloud.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
*/

import ol from 'ol'
import ol_Observable from 'ol/Observable'
import ol_control_Control from 'ol/control/control'

/** ol_control_Cloud adds an old map effect on a canvas renderer.
Expand Down Expand Up @@ -53,7 +54,7 @@ ol.inherits(ol_control_Cloud, ol_control_Control);
* @api stable
*/
ol_control_Cloud.prototype.setMap = function (map) {
if (this._listener) ol.Observable.unByKey(this._listener);
if (this._listener) ol_Observable.unByKey(this._listener);
this._listener = null;

ol_control_Control.prototype.setMap.call(this, map);
Expand Down
3 changes: 2 additions & 1 deletion src/control/Compass.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
*/

import ol from 'ol'
import ol_Observable from 'ol/Observable'
import ol_control_Control from 'ol/control/control'

/**
Expand Down Expand Up @@ -58,7 +59,7 @@ ol.inherits(ol_control_Compass, ol_control_Control);
*/
ol_control_Compass.prototype.setMap = function (map)
{ var oldmap = this.getMap();
if (this._listener) ol.Observable.unByKey(this._listener);
if (this._listener) ol_Observable.unByKey(this._listener);
this._listener = null;

ol_control_Control.prototype.setMap.call(this, map);
Expand Down
3 changes: 2 additions & 1 deletion src/control/Globe.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
*/

import ol from 'ol'
import ol_Observable from 'ol/Observable'
import ol_control_Control from 'ol/control/control'
import ol_Map from 'ol/map'
import ol_Collection from 'ol/collection'
Expand Down Expand Up @@ -103,7 +104,7 @@ ol.inherits(ol_control_Globe, ol_control_Control);
* @param {ol.Map} map The map instance.
*/
ol_control_Globe.prototype.setMap = function(map) {
if (this._listener) ol.Observable.unByKey(this._listener);
if (this._listener) ol_Observable.unByKey(this._listener);
this._listener = null;

ol_control_Control.prototype.setMap.call(this, map);
Expand Down
3 changes: 2 additions & 1 deletion src/control/Graticule.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
*/

import ol from 'ol'
import ol_Observable from 'ol/Observable'
import ol_control_Control from 'ol/control/control'
import ol_proj_Projection from 'ol/proj/projection'
import ol_style_Style from 'ol/style/style'
Expand Down Expand Up @@ -76,7 +77,7 @@ ol.inherits(ol_control_Graticule, ol_control_Control);
*/
ol_control_Graticule.prototype.setMap = function (map) {
var oldmap = this.getMap();
if (this._listener) ol.Observable.unByKey(this._listener);
if (this._listener) ol_Observable.unByKey(this._listener);
this._listener = null;

ol_control_Control.prototype.setMap.call(this, map);
Expand Down
3 changes: 2 additions & 1 deletion src/control/GridReference.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
*/

import ol from 'ol'
import ol_Observable from 'ol/Observable'
import ol_control_Control from 'ol/control/control'
import ol_style_Style from 'ol/style/style'
import ol_style_Stroke from 'ol/style/stroke'
Expand Down Expand Up @@ -183,7 +184,7 @@ ol_control_GridReference.prototype.getReference = function (coords)
*/
ol_control_GridReference.prototype.setMap = function (map)
{ var oldmap = this.getMap();
if (this._listener) ol.Observable.unByKey(this._listener);
if (this._listener) ol_Observable.unByKey(this._listener);
this._listener = null;

ol_control_Control.prototype.setMap.call(this, map);
Expand Down
7 changes: 4 additions & 3 deletions src/control/LayerSwitcher.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
*/

import ol from 'ol'
import ol_Observable from 'ol/Observable'
import ol_control_Control from 'ol/control/control'
import ol_layer_Tile from 'ol/layer/tile'
import ol_layer_Vector from 'ol/layer/vector'
Expand Down Expand Up @@ -130,9 +131,9 @@ ol_control_LayerSwitcher.prototype.setMap = function(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);
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;

Expand Down
3 changes: 2 additions & 1 deletion src/control/Overview.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
*/

import ol from 'ol'
import ol_Observable from 'ol/Observable'
import ol_control_Control from 'ol/control/control'
import ol_geom_Polygon from 'ol/geom/polygon'
import ol_geom_Point from 'ol/geom/point'
Expand Down Expand Up @@ -191,7 +192,7 @@ ol_control_Overview.prototype.setPosition = function(align)
* @param {ol.Map} map The map instance.
*/
ol_control_Overview.prototype.setMap = function(map) {
if (this._listener) ol.Observable.unByKey(this._listener);
if (this._listener) ol_Observable.unByKey(this._listener);
this._listener = null;

ol_control_Control.prototype.setMap.call(this, map);
Expand Down
5 changes: 3 additions & 2 deletions src/control/Permalink.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
*/

import ol from 'ol'
import ol_Observable from 'ol/Observable'
import ol_control_Control from 'ol/control/control'
import ol_proj from 'ol/proj'

Expand Down Expand Up @@ -78,8 +79,8 @@ ol.inherits(ol_control_Permalink, ol_control_Control);
*/
ol_control_Permalink.prototype.setMap = function(map) {
if (this._listener) {
ol.Observable.unByKey(this._listener.change);
ol.Observable.unByKey(this._listener.moveend);
ol_Observable.unByKey(this._listener.change);
ol_Observable.unByKey(this._listener.moveend);
}
this._listener = null;

Expand Down

0 comments on commit b8dfba1

Please sign in to comment.