Created
March 22, 2013 04:28
-
-
Save dbouwman/5218940 to your computer and use it in GitHub Desktop.
onMapLoaded handler in Router. I do this so that we wait until the map is ready, and THEN dispatch events telling is how to re-hydrate it's state
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
onMapLoaded:function(){ | |
//ok, now that we have a map we can link up some events | |
Viewer.vent.on('FireLayer:ConfigChanged',this.setYear); | |
//and if we have values passed in on the url, raise events | |
if(this.urlValues){ | |
Viewer.vent.trigger('FireLayer:ConfigChanged', this.urlValues.yearData); | |
Viewer.vent.trigger('Map:ShowPerimeters',this.urlValues.yearData); | |
Viewer.vent.trigger('Navbar:ChangeItemName',this.urlValues.yearData.model.name); | |
Viewer.vent.trigger('Map:CenterAtLatLongAndZoom', { | |
x:this.urlValues.x, | |
y:this.urlValues.y, | |
l:this.urlValues.l | |
}); | |
}else{ | |
//do the defaults - this is essentially what starts the app | |
//with the active fires | |
Viewer.vent.trigger('FireLayer:ConfigChanged', this.active); | |
Viewer.vent.trigger('Map:ShowPerimeters',this.active); | |
Viewer.vent.trigger('Navbar:ChangeItemName',this.active.model.name); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment