Skip to content

Commit

Permalink
Merge pull request #534 from AlexAThomas/control_scaleRangeHandle
Browse files Browse the repository at this point in the history
Track Scale Range Handler for final destroy()
  • Loading branch information
tmcgee committed Apr 11, 2016
2 parents b6cceeb + 1420dad commit 0322700
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions viewer/js/gis/dijit/LayerControl/controls/_Control.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
define([
'dojo/_base/declare',
'dojo/_base/lang',
//'dojo/_base/array',
'dojo/_base/array',
'dojo/on',
'dojo/topic',
'dojo/dom-construct',
Expand All @@ -16,7 +16,7 @@ define([
], function (
declare,
lang,
//array,
array,
on,
topic,
domConst,
Expand Down Expand Up @@ -194,11 +194,23 @@ define([
_scaleRangeChange: function () {
if (this.layer.minScale !== 0 || this.layer.maxScale !== 0) {
this._checkboxScaleRange();
if (this._scaleRangeHandler) {
var handlerIndex = array.indexOf(this._handlers, this._scaleRangeHandler);
if (handlerIndex !== -1) {
this._handlers[handlerIndex].remove();
this._handlers.splice(handlerIndex, 1);
}
}
this._scaleRangeHandler = this.layer.getMap().on('zoom-end', lang.hitch(this, '_checkboxScaleRange'));
this._handlers.push(this._scaleRangeHandler);
} else {
this._checkboxScaleRange();
if (this._scaleRangeHandler) {
this._scaleRangeHandler.remove();
var handlerIndex2 = array.indexOf(this._handlers, this._scaleRangeHandler);
if (handlerIndex2 !== -1) {
this._handlers[handlerIndex2].remove();
this._handlers.splice(handlerIndex2, 1);
}
this._scaleRangeHandler = null;
}
}
Expand Down

0 comments on commit 0322700

Please sign in to comment.