Move Blockly.utils.dom.SvgElementType to Blockly.utils.Svg (#4285)

* Move SVGElementType to its own file shaving off 2.7KB
This commit is contained in:
Sam El-Husseini
2020-09-16 14:42:58 -07:00
committed by GitHub
parent f6688d0339
commit db40e44b7c
41 changed files with 381 additions and 323 deletions

View File

@@ -166,7 +166,7 @@ suite('Checkbox Fields', function() {
suite('Check Character', function() {
function assertCharacter(field, char) {
field.fieldGroup_ = Blockly.utils.dom.createSvgElement(
Blockly.utils.dom.SvgElementType.G, {}, null);
Blockly.utils.Svg.G, {}, null);
field.sourceBlock_ = {
RTL: false,
rendered: true,

View File

@@ -98,7 +98,7 @@ suite('Label Serializable Fields', function() {
suite('Customizations', function() {
function assertHasClass(labelField, cssClass) {
labelField.fieldGroup_ = Blockly.utils.dom.createSvgElement(
Blockly.utils.dom.SvgElementType.G, {}, null);
Blockly.utils.Svg.G, {}, null);
labelField.constants_ = {
FIELD_TEXT_BASELINE_Y: 13
};
@@ -108,7 +108,7 @@ suite('Label Serializable Fields', function() {
}
function assertDoesNotHaveClass(labelField, cssClass) {
labelField.fieldGroup_ = Blockly.utils.dom.createSvgElement(
Blockly.utils.dom.SvgElementType.G, {}, null);
Blockly.utils.Svg.G, {}, null);
labelField.constants_ = {
FIELD_TEXT_BASELINE_Y: 13
};
@@ -155,7 +155,7 @@ suite('Label Serializable Fields', function() {
test('setClass', function() {
var field = new Blockly.FieldLabelSerializable();
field.fieldGroup_ = Blockly.utils.dom.createSvgElement(
Blockly.utils.dom.SvgElementType.G, {}, null);
Blockly.utils.Svg.G, {}, null);
field.constants_ = {
FIELD_TEXT_BASELINE_Y: 13
};

View File

@@ -98,7 +98,7 @@ suite('Label Fields', function() {
suite('Customizations', function() {
function assertHasClass(labelField, cssClass) {
labelField.fieldGroup_ = Blockly.utils.dom.createSvgElement(
Blockly.utils.dom.SvgElementType.G, {}, null);
Blockly.utils.Svg.G, {}, null);
labelField.constants_ = {
FIELD_TEXT_BASELINE_Y: 13
};
@@ -108,7 +108,7 @@ suite('Label Fields', function() {
}
function assertDoesNotHaveClass(labelField, cssClass) {
labelField.fieldGroup_ = Blockly.utils.dom.createSvgElement(
Blockly.utils.dom.SvgElementType.G, {}, null);
Blockly.utils.Svg.G, {}, null);
labelField.constants_ = {
FIELD_TEXT_BASELINE_Y: 13
};
@@ -156,7 +156,7 @@ suite('Label Fields', function() {
test('setClass', function() {
var field = new Blockly.FieldLabel();
field.fieldGroup_ = Blockly.utils.dom.createSvgElement(
Blockly.utils.dom.SvgElementType.G, {}, null);
Blockly.utils.Svg.G, {}, null);
field.constants_ = {
FIELD_TEXT_BASELINE_Y: 13
};

View File

@@ -46,12 +46,12 @@ var svgSpace;
function addPathAt(path, x, y) {
var group = Blockly.utils.dom.createSvgElement(
Blockly.utils.dom.SvgElementType.G,
Blockly.utils.Svg.G,
{
'transform': 'translate(' + (x + 50) + ', ' + y + ')'
}, svgSpace);
Blockly.utils.dom.createSvgElement(
Blockly.utils.dom.SvgElementType.PATH, {
Blockly.utils.Svg.PATH, {
'd': 'M 0,0 ' + path,
'marker-start': 'url(#startDot)',
'marker-end': 'url(#endDot)',