Remove remaining goog.math

This commit is contained in:
Neil Fraser
2018-06-28 16:27:39 -07:00
committed by Neil Fraser
parent 284b79407e
commit 07d1d86283
3 changed files with 6 additions and 6 deletions

View File

@@ -27,7 +27,6 @@
goog.provide('Blockly.FieldNumber');
goog.require('Blockly.FieldTextInput');
goog.require('goog.math');
/**
@@ -112,7 +111,7 @@ Blockly.FieldNumber.prototype.classValidator = function(text) {
n = Math.round(n / this.precision_) * this.precision_;
}
// Get the value in range.
n = goog.math.clamp(n, this.min_, this.max_);
n = Math.min(Math.max(n, this.min_), this.max_);
return String(n);
};

View File

@@ -29,7 +29,6 @@ goog.provide('Blockly.Trashcan');
goog.require('Blockly.utils');
goog.require('goog.dom');
goog.require('goog.math');
goog.require('goog.math.Rect');
@@ -311,13 +310,14 @@ Blockly.Trashcan.prototype.setOpen_ = function(state) {
*/
Blockly.Trashcan.prototype.animateLid_ = function() {
this.lidOpen_ += this.isOpen ? 0.2 : -0.2;
this.lidOpen_ = goog.math.clamp(this.lidOpen_, 0, 1);
this.lidOpen_ = Math.min(Math.max(this.lidOpen_, 0), 1);
var lidAngle = this.lidOpen_ * 45;
this.svgLid_.setAttribute('transform', 'rotate(' +
(this.workspace_.RTL ? -lidAngle : lidAngle) + ',' +
(this.workspace_.RTL ? 4 : this.WIDTH_ - 4) + ',' +
(this.LID_HEIGHT_ - 2) + ')');
var opacity = goog.math.lerp(0.4, 0.8, this.lidOpen_);
// Linear interpolation between 0.4 and 0.8.
var opacity = 0.4 + this.lidOpen_ * (0.8 - 0.4);
this.svgGroup_.style.opacity = opacity;
if (this.lidOpen_ > 0 && this.lidOpen_ < 1) {
this.lidTask_ = setTimeout(this.animateLid_.bind(this), 20);

View File

@@ -1090,7 +1090,8 @@ Blockly.WorkspaceSvg.prototype.deleteVariableById = function(id) {
* @return {?Blockly.VariableModel} The newly created variable.
* @package
*/
Blockly.WorkspaceSvg.prototype.createVariable = function(name, opt_type, opt_id) {
Blockly.WorkspaceSvg.prototype.createVariable =
function(name, opt_type, opt_id) {
var newVar = Blockly.WorkspaceSvg.superClass_.createVariable.call(
this, name, opt_type, opt_id);
this.refreshToolboxSelection();