in src/js/modules/choropleth.js [317:443]
ractivate() {
var self = this
Ractive.DEBUG = false;
this.ractive = new Ractive({
events: {
tap: ractiveTap
},
el: '#choloropleth',
data: self.database,
template: template,
})
this.colourizer()
this.createMap()
if (!this.database.isAndroidApp ) {
this.resizer()
this.ractive.observe('currentIndex', function(index) {
self.database.currentIndex = index
self.database.currentKey = self.database.mapping[index].data
self.colourizer()
self.updateMap()
self.keygen()
});
this.ractive.observe('locationIndex', function(index) {
self.database.locationIndex = index
self.reposMap()
});
}
//this.ractive.on( 'view', ( context ) => self.showMap());
if (!this.database.isAndroidApp ) {
this.ractive.observe( 'searchBlock', ( newValue ) => {
if (newValue && newValue.length > 2) {
self.database.displayOverlay = true
self.database.autocompleteArray = autocomplete(newValue, self.database.codes, 'meta')
} else {
self.database.displayOverlay = false
self.database.autocompleteArray = []
}
self.ractive.set(self.database)
});
this.ractive.on( 'keydown', function ( event ) {
if (event.original.keyCode===13) {
if (self.database.autocompleteArray.length > 0) {
self.database.autocompleteArray = []
self.database.searchBlock = ""
self.ractive.set(self.database)
self.ractive.set('displayOverlay', true)
self.relocate(self.database.autocompleteArray[0])
//setTimeout(self.displayMap(), 2000);
}
event.original.preventDefault()
}
});
this.ractive.on('search', (context, data) => {
self.database.autocompleteArray = []
self.database.searchBlock = ""
self.ractive.set(self.database)
self.ractive.set('displayOverlay', true)
self.relocate(data)
//setTimeout(self.displayMap(), 2000);
})
}
}