From 9a0881b96a729b2dcdc55645b293f61276551fa6 Mon Sep 17 00:00:00 2001 From: jmoenig Date: Tue, 1 Oct 2013 15:50:53 +0200 Subject: smooth numerical values displayed in watchers --- history.txt | 4 ++++ objects.js | 11 +++++++---- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/history.txt b/history.txt index 446505f..93860b5 100755 --- a/history.txt +++ b/history.txt @@ -1929,3 +1929,7 @@ ______ 130930 ------ * Blocks: fixed #186 (can't duplicate blocks with anchored comments) + +131001 +------ +* Objects: smooth numerical values displayed in watchers diff --git a/objects.js b/objects.js index 13867d7..86a1d38 100644 --- a/objects.js +++ b/objects.js @@ -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(); -- cgit v1.3.1