diff options
| author | jmoenig <jens@moenig.org> | 2013-10-01 15:50:53 +0200 |
|---|---|---|
| committer | jmoenig <jens@moenig.org> | 2013-10-01 15:50:53 +0200 |
| commit | 9a0881b96a729b2dcdc55645b293f61276551fa6 (patch) | |
| tree | ddfbefe2492ea9939207331bc779315747a4245a /objects.js | |
| parent | dc709c2e1282e2056d74d3a9ba77e21b50d463f4 (diff) | |
| download | snap-yow-9a0881b96a729b2dcdc55645b293f61276551fa6.tar.gz snap-yow-9a0881b96a729b2dcdc55645b293f61276551fa6.zip | |
smooth numerical values displayed in watchers
Diffstat (limited to 'objects.js')
| -rw-r--r-- | objects.js | 11 |
1 files changed, 7 insertions, 4 deletions
@@ -124,7 +124,7 @@ PrototypeHatBlockMorph*/ // Global stuff //////////////////////////////////////////////////////// -modules.objects = '2013-September-19'; +modules.objects = '2013-October-01'; var SpriteMorph; var StageMorph; @@ -5986,13 +5986,16 @@ WatcherMorph.prototype.update = function () { } else { newValue = this.target[this.getter](); } + num = parseFloat(newValue); + if (!isNaN(num)) { + newValue = Math.round(newValue * 1000000000) / 1000000000; + } if (newValue !== this.currentValue) { this.changed(); this.cellMorph.contents = newValue; this.cellMorph.drawNew(); - num = parseFloat(newValue); - if (!isNaN(num)) { - this.sliderMorph.value = num; + if (!isNaN(newValue)) { + this.sliderMorph.value = newValue; this.sliderMorph.drawNew(); } this.fixLayout(); |
