Open GoogleCodeExporter opened 8 years ago
[deleted comment]
[deleted comment]
[deleted comment]
[deleted comment]
[deleted comment]
Hi. I found the bug in the code. You guys have to change
this.valuePosition_ = this.valueToRangePosition_(this.value);
to
this.needleValuePosition_ = this.valueToRangePosition_(this.value_);
in the app.ui.Gauge.prototype.draw_ routine. Notice the underscore after value
in the second line.
Original comment by j...@highvolumeseller.com
on 23 Dec 2012 at 11:21
The monkey patch below appears to work when put before the require.
// monkey patch
goog.ui.Gauge.prototype.value = (goog.bind(function () {
return this.value_;
}, goog.ui.Gauge.prototype))();
goog.ui.Gauge.prototype.valuePosition_ = (function (val) {
goog.ui.Gauge.prototype.needleValuePosition_ = val;
})(goog.ui.Gauge.prototype.value);
// end monkey patch
goog.require('goog.ui.Gauge');
Original comment by j...@highvolumeseller.com
on 24 Dec 2012 at 12:28
goog.require('goog.ui.Gauge') and the code that uses gauges must be put into
separate <script> blocks.
Original comment by pall...@google.com
on 26 Dec 2012 at 8:13
[deleted comment]
In gauge.js, there is no 'value' variable, nor is there a 'valuePosition_'
variable defined. However, both variables are being used and causing an error.
I don't know if its the result of a bad merge or what, but it is broken code.
Again, it should be: this.needleValuePosition_ =
this.valueToRangePosition_(this.value_);
Original comment by j...@highvolumeseller.com
on 26 Dec 2012 at 8:23
Additionally, I do not believe there is a requirement to put the imports in
separate script blocks. I am not doing that, nor is it mentioned anywhere in
the documentation for gauge.
Original comment by j...@highvolumeseller.com
on 26 Dec 2012 at 8:25
Reading this.value in line 790 of
https://code.google.com/searchframe#epIciakqvFc/trunk/closure/goog/ui/gauge.js&l
=790 is indeed a bug.
The fact that modules have to be loaded and used in separate script blocks
isn't specific to goog.ui.Gauge. It's the consequence of JavaScript's
asynchronous nature. But apparently your issue was caused by the typo in
goog.ui.Gauge.prototype.draw_.:
Original comment by pall...@google.com
on 26 Dec 2012 at 8:37
Thanks.
Original comment by j...@highvolumeseller.com
on 26 Dec 2012 at 8:41
Original issue reported on code.google.com by
j...@highvolumeseller.com
on 23 Dec 2012 at 9:05