Created
September 14, 2015 15:55
-
-
Save odoe/9bb4c55539f305572b21 to your computer and use it in GitHub Desktop.
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
import Model from './Model'; | |
import Component from './components/ViewProxy'; | |
// Controller links Model and view | |
class Controller { | |
constructor(extent) { | |
this.model = new Model({ extent: extent }); | |
this.view = new Component({ | |
position: 'topright', | |
xmin: this.model.extent.xmin, | |
ymin: this.model.extent.ymin, | |
xmax: this.model.extent.xmax, | |
ymax: this.model.extent.ymax | |
}); | |
this.model.watch('extent', (val) => { | |
this.view.update({ | |
xmin: val.xmin, | |
ymin: val.ymin, | |
xmax: val.xmax, | |
ymax: val.ymax | |
}); | |
}); | |
} | |
}; | |
export default Controller; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment