removed initialize anti pattern from constructor in favor of doing initialization in constructor in navcontrol.js

This commit is contained in:
thatcher 2011-12-22 19:30:52 -05:00
parent 114a26b1a9
commit b061a4d830
2 changed files with 128 additions and 130 deletions

View File

@ -1221,7 +1221,7 @@ $.Utils = new $.Utils();
(function( $ ){
$.NavControl = function(viewer) {
$.NavControl = function( viewer ) {
this._group = null;
this._zooming = false; // whether we should be continuously zooming
this._zoomFactor = null; // how much we should be continuously zooming by
@ -1230,11 +1230,7 @@ $.NavControl = function(viewer) {
this.config = this._viewer.config;
this.elmt = null;
this.initialize();
};
$.NavControl.prototype = {
initialize: function() {
var beginZoomingInHandler = $.delegate(this, this._beginZoomingIn);
var endZoomingHandler = $.delegate(this, this._endZooming);
var doSingleZoomInHandler = $.delegate(this, this._doSingleZoomIn);
@ -1295,9 +1291,12 @@ $.NavControl.prototype = {
});
this.elmt = this._group.element;
this.elmt[$.SIGNAL] = true; // hack to get our controls to fade
this.elmt[ $.SIGNAL ] = true; // hack to get our controls to fade
this._viewer.addHandler('open', $.delegate(this, this._lightUp));
},
};
$.NavControl.prototype = {
_resolveUrl: function(url) {
var prefix = this._viewer.prefixUrl;
return prefix ? prefix + url : url;

View File

@ -1,7 +1,7 @@
(function( $ ){
$.NavControl = function(viewer) {
$.NavControl = function( viewer ) {
this._group = null;
this._zooming = false; // whether we should be continuously zooming
this._zoomFactor = null; // how much we should be continuously zooming by
@ -10,11 +10,7 @@ $.NavControl = function(viewer) {
this.config = this._viewer.config;
this.elmt = null;
this.initialize();
};
$.NavControl.prototype = {
initialize: function() {
var beginZoomingInHandler = $.delegate(this, this._beginZoomingIn);
var endZoomingHandler = $.delegate(this, this._endZooming);
var doSingleZoomInHandler = $.delegate(this, this._doSingleZoomIn);
@ -75,9 +71,12 @@ $.NavControl.prototype = {
});
this.elmt = this._group.element;
this.elmt[$.SIGNAL] = true; // hack to get our controls to fade
this.elmt[ $.SIGNAL ] = true; // hack to get our controls to fade
this._viewer.addHandler('open', $.delegate(this, this._lightUp));
},
};
$.NavControl.prototype = {
_resolveUrl: function(url) {
var prefix = this._viewer.prefixUrl;
return prefix ? prefix + url : url;