mardi 27 janvier 2015

Ember animate view changes


I experience an issue with animating the change of a particular view. I have two views which use among other properties the same 'options' parameter. The DrawVisualizationView actually draws a chart with the options, that are obtained from inputs from the OptionsView.


The .hbs file:



<!-- Options Part --!>
<div>
{{view App.OptionsView options=controller.options}}
</div>
<!-- Visualization Part --!>
<div id="visualization">
{{view App.DrawVisualizationView options=controller.options}}
</div>


I use ember-animate to produce some animations between routes and I would like to produce an animation when I change the options and the chart is redrawn. For example, the old one would fade out and the new new would fade in. Both views use VisualizationController and VisualizationRoute, so I don't have any transitions between routes and controllers.


Here is DrawVisualizationView





App.DrawVisualizationView = Ember.View.extend({
willAnimateIn: function() { //ember-animate method
//preparation
},

animateIn: function(done) {
//some animation
},

animateOut: function(done) {
//some animation
},

drawVisualization: function(){
//draw a chart
}.observes('options.@each').on('didInsertElement')

});



The VisualizationController is set up in a way, that every change in options in OptionsView triggers redrawing of a chart through DrawVisualizationView.


willAnimateIn, animateIn and animateOut work only once during the loading of a page.


I tried events like didInsertElement and adding eventManager but none of them are triggered when the DrawVisualizationView is invoked after options changes.


Is there a way to trigger animate actions of the DrawVisualizationView if a particular option is changed?





Aucun commentaire:

Enregistrer un commentaire