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( $ ){ (function( $ ){
$.NavControl = function(viewer) { $.NavControl = function( viewer ) {
this._group = null; this._group = null;
this._zooming = false; // whether we should be continuously zooming this._zooming = false; // whether we should be continuously zooming
this._zoomFactor = null; // how much we should be continuously zooming by this._zoomFactor = null; // how much we should be continuously zooming by
@ -1230,11 +1230,7 @@ $.NavControl = function(viewer) {
this.config = this._viewer.config; this.config = this._viewer.config;
this.elmt = null; this.elmt = null;
this.initialize();
};
$.NavControl.prototype = {
initialize: function() {
var beginZoomingInHandler = $.delegate(this, this._beginZoomingIn); var beginZoomingInHandler = $.delegate(this, this._beginZoomingIn);
var endZoomingHandler = $.delegate(this, this._endZooming); var endZoomingHandler = $.delegate(this, this._endZooming);
var doSingleZoomInHandler = $.delegate(this, this._doSingleZoomIn); var doSingleZoomInHandler = $.delegate(this, this._doSingleZoomIn);
@ -1295,9 +1291,12 @@ $.NavControl.prototype = {
}); });
this.elmt = this._group.element; 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)); this._viewer.addHandler('open', $.delegate(this, this._lightUp));
}, };
$.NavControl.prototype = {
_resolveUrl: function(url) { _resolveUrl: function(url) {
var prefix = this._viewer.prefixUrl; var prefix = this._viewer.prefixUrl;
return prefix ? prefix + url : url; return prefix ? prefix + url : url;

View File

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