Skip to content

Commit

Permalink
Math: ensure internal updating flag gets cleared. Fixes #1083
Browse files Browse the repository at this point in the history
  • Loading branch information
Mottie committed Nov 23, 2015
1 parent 06faff7 commit a8d9c2b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
2 changes: 1 addition & 1 deletion dist/js/widgets/widget-math.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 11 additions & 4 deletions js/widgets/widget-math.js
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@
recalculate : function(c, wo, init) {
if ( c && ( !wo.math_isUpdating || init ) ) {

var time, mathAttr, $mathCells;
var undef, time, mathAttr, $mathCells;
if ( c.debug ) {
time = new Date();
}
Expand Down Expand Up @@ -215,14 +215,22 @@
}

// update internal cache
ts.update( c );
ts.update( c, undef, function(){
math.updateComplete( c );
});

if ( c.debug ) {
console.log( 'Math widget update completed' + ts.benchmark( time ) );
}
}
},

updateComplete : function( c ) {
var wo = c.widgetOptions;
if ( wo.math_isUpdating && c.debug && console.groupEnd ) { console.groupEnd(); }
wo.math_isUpdating = false;
},

mathType : function( c, $cells, priority ) {
if ( $cells.length ) {
var formula, result, $el, arry, getAll, $targetCells, index, len,
Expand Down Expand Up @@ -532,8 +540,7 @@
})
.on( update + '.tsmath', function() {
setTimeout( function(){
if ( wo.math_isUpdating && c.debug && console.groupEnd ) { console.groupEnd(); }
wo.math_isUpdating = false;
math.updateComplete( c );
}, 40 );
});
wo.math_isUpdating = false;
Expand Down

0 comments on commit a8d9c2b

Please sign in to comment.