mirror of
https://github.com/google/blockly.git
synced 2026-01-09 01:50:11 +01:00
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:
@@ -18,6 +18,7 @@ goog.require('Blockly.Events.Ui');
|
||||
goog.require('Blockly.Icon');
|
||||
goog.require('Blockly.utils.dom');
|
||||
goog.require('Blockly.utils.object');
|
||||
goog.require('Blockly.utils.Svg');
|
||||
|
||||
|
||||
/**
|
||||
@@ -47,7 +48,7 @@ Blockly.Warning.prototype.collapseHidden = false;
|
||||
Blockly.Warning.prototype.drawIcon_ = function(group) {
|
||||
// Triangle with rounded corners.
|
||||
Blockly.utils.dom.createSvgElement(
|
||||
Blockly.utils.dom.SvgElementType.PATH,
|
||||
Blockly.utils.Svg.PATH,
|
||||
{
|
||||
'class': 'blocklyIconShape',
|
||||
'd': 'M2,15Q-1,15 0.5,12L6.5,1.7Q8,-1 9.5,1.7L15.5,12Q17,15 14,15z'
|
||||
@@ -57,7 +58,7 @@ Blockly.Warning.prototype.drawIcon_ = function(group) {
|
||||
// systems render it differently.
|
||||
// Body of exclamation point.
|
||||
Blockly.utils.dom.createSvgElement(
|
||||
Blockly.utils.dom.SvgElementType.PATH,
|
||||
Blockly.utils.Svg.PATH,
|
||||
{
|
||||
'class': 'blocklyIconSymbol',
|
||||
'd': 'm7,4.8v3.16l0.27,2.27h1.46l0.27,-2.27v-3.16z'
|
||||
@@ -65,7 +66,7 @@ Blockly.Warning.prototype.drawIcon_ = function(group) {
|
||||
group);
|
||||
// Dot of exclamation point.
|
||||
Blockly.utils.dom.createSvgElement(
|
||||
Blockly.utils.dom.SvgElementType.RECT,
|
||||
Blockly.utils.Svg.RECT,
|
||||
{
|
||||
'class': 'blocklyIconSymbol',
|
||||
'x': '7', 'y': '11', 'height': '2', 'width': '2'
|
||||
@@ -81,7 +82,7 @@ Blockly.Warning.prototype.drawIcon_ = function(group) {
|
||||
*/
|
||||
Blockly.Warning.textToDom_ = function(text) {
|
||||
var paragraph = Blockly.utils.dom.createSvgElement(
|
||||
Blockly.utils.dom.SvgElementType.TEXT,
|
||||
Blockly.utils.Svg.TEXT,
|
||||
{
|
||||
'class': 'blocklyText blocklyBubbleText blocklyNoPointerEvents',
|
||||
'y': Blockly.Bubble.BORDER_WIDTH
|
||||
@@ -90,7 +91,7 @@ Blockly.Warning.textToDom_ = function(text) {
|
||||
var lines = text.split('\n');
|
||||
for (var i = 0; i < lines.length; i++) {
|
||||
var tspanElement = Blockly.utils.dom.createSvgElement(
|
||||
Blockly.utils.dom.SvgElementType.TSPAN,
|
||||
Blockly.utils.Svg.TSPAN,
|
||||
{'dy': '1em', 'x': Blockly.Bubble.BORDER_WIDTH}, paragraph);
|
||||
var textNode = document.createTextNode(lines[i]);
|
||||
tspanElement.appendChild(textNode);
|
||||
|
||||
Reference in New Issue
Block a user