mirror of
https://github.com/google/blockly.git
synced 2026-01-08 17:40:09 +01:00
Removing Blockly.utils.getScale_() and usage. (#1821)
The function only returns 1 for the two cases it was used on, making the scale multiplication a no-op.
This commit is contained in:
committed by
GitHub
parent
5bb9088765
commit
42e229fb4c
@@ -210,9 +210,8 @@ Blockly.utils.getInjectionDivXY_ = function(element) {
|
|||||||
var y = 0;
|
var y = 0;
|
||||||
while (element) {
|
while (element) {
|
||||||
var xy = Blockly.utils.getRelativeXY(element);
|
var xy = Blockly.utils.getRelativeXY(element);
|
||||||
var scale = Blockly.utils.getScale_(element);
|
x = x + xy.x;
|
||||||
x = (x * scale) + xy.x;
|
y = y + xy.y;
|
||||||
y = (y * scale) + xy.y;
|
|
||||||
var classes = element.getAttribute('class') || '';
|
var classes = element.getAttribute('class') || '';
|
||||||
if ((' ' + classes + ' ').indexOf(' injectionDiv ') != -1) {
|
if ((' ' + classes + ' ').indexOf(' injectionDiv ') != -1) {
|
||||||
break;
|
break;
|
||||||
@@ -222,25 +221,6 @@ Blockly.utils.getInjectionDivXY_ = function(element) {
|
|||||||
return new goog.math.Coordinate(x, y);
|
return new goog.math.Coordinate(x, y);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
|
||||||
* Return the scale of this element.
|
|
||||||
* @param {!Element} element The element to find the coordinates of.
|
|
||||||
* @return {!number} number represending the scale applied to the element.
|
|
||||||
* @private
|
|
||||||
*/
|
|
||||||
Blockly.utils.getScale_ = function(element) {
|
|
||||||
var scale = 1;
|
|
||||||
var transform = element.getAttribute('transform');
|
|
||||||
if (transform) {
|
|
||||||
var transformComponents =
|
|
||||||
transform.match(Blockly.utils.getScale_.REGEXP_);
|
|
||||||
if (transformComponents && transformComponents[0]) {
|
|
||||||
scale = parseFloat(transformComponents[0]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return scale;
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Static regex to pull the x,y values out of an SVG translate() directive.
|
* Static regex to pull the x,y values out of an SVG translate() directive.
|
||||||
* Note that Firefox and IE (9,10) return 'translate(12)' instead of
|
* Note that Firefox and IE (9,10) return 'translate(12)' instead of
|
||||||
@@ -253,15 +233,6 @@ Blockly.utils.getScale_ = function(element) {
|
|||||||
Blockly.utils.getRelativeXY.XY_REGEX_ =
|
Blockly.utils.getRelativeXY.XY_REGEX_ =
|
||||||
/translate\(\s*([-+\d.e]+)([ ,]\s*([-+\d.e]+)\s*\))?/;
|
/translate\(\s*([-+\d.e]+)([ ,]\s*([-+\d.e]+)\s*\))?/;
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Static regex to pull the scale values out of a transform style property.
|
|
||||||
* Accounts for same exceptions as XY_REGEXP_.
|
|
||||||
* @type {!RegExp}
|
|
||||||
* @private
|
|
||||||
*/
|
|
||||||
Blockly.utils.getScale_REGEXP_ = /scale\(\s*([-+\d.e]+)\s*\)/;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Static regex to pull the x,y,z values out of a translate3d() style property.
|
* Static regex to pull the x,y,z values out of a translate3d() style property.
|
||||||
* Accounts for same exceptions as XY_REGEXP_.
|
* Accounts for same exceptions as XY_REGEXP_.
|
||||||
|
|||||||
Reference in New Issue
Block a user