Commit 1ca2fdc8 authored by Neil Fraser's avatar Neil Fraser

Add classes to svg groups.

parent af75752c
This diff is collapsed.
......@@ -115,10 +115,11 @@ Blockly.Flyout.prototype.createDom = function() {
/*
<g>
<path class="blocklyFlyoutBackground"/>
<g></g>
<g class="blocklyFlyout"></g>
</g>
*/
this.svgGroup_ = Blockly.createSvgElement('g', {}, null);
this.svgGroup_ = Blockly.createSvgElement('g',
{'class': 'blocklyFlyout'}, null);
this.svgBackground_ = Blockly.createSvgElement('path',
{'class': 'blocklyFlyoutBackground'}, this.svgGroup_);
this.svgGroup_.appendChild(this.workspace_.createDom());
......
......@@ -305,12 +305,14 @@ Blockly.Scrollbar.prototype.resize = function(opt_metrics) {
*/
Blockly.Scrollbar.prototype.createDom_ = function() {
/* Create the following DOM:
<g>
<g class="blocklyScrollbarHorizontal">
<rect class="blocklyScrollbarBackground" />
<rect class="blocklyScrollbarKnob" rx="8" ry="8" />
</g>
*/
this.svgGroup_ = Blockly.createSvgElement('g', {}, null);
var className = 'blocklyScrollbar' +
(this.horizontal_ ? 'Horizontal' : 'Vertical');
this.svgGroup_ = Blockly.createSvgElement('g', {'class': className}, null);
this.svgBackground_ = Blockly.createSvgElement('rect',
{'class': 'blocklyScrollbarBackground'}, this.svgGroup_);
var radius = Math.floor((Blockly.Scrollbar.scrollbarThickness - 5) / 2);
......
......@@ -151,23 +151,24 @@ Blockly.Trashcan.prototype.top_ = 0;
*/
Blockly.Trashcan.prototype.createDom = function() {
/* Here's the markup that will be generated:
<g>
<clippath id="blocklyTrashBodyClipPath">
<g class="blocklyTrash">
<clippath id="blocklyTrashBodyClipPath837493">
<rect width="47" height="45" y="15"></rect>
</clippath>
<image width="64" height="92" y="-32" xlink:href="media/sprites.png"
clip-path="url(#blocklyTrashBodyClipPath)"></image>
<clippath id="blocklyTrashLidClipPath">
clip-path="url(#blocklyTrashBodyClipPath837493)"></image>
<clippath id="blocklyTrashLidClipPath837493">
<rect width="47" height="15"></rect>
</clippath>
<image width="84" height="92" y="-32" xlink:href="media/sprites.png"
clip-path="url(#blocklyTrashLidClipPath)"></image>
clip-path="url(#blocklyTrashLidClipPath837493)"></image>
</g>
*/
this.svgGroup_ = Blockly.createSvgElement('g', {}, null);
this.svgGroup_ = Blockly.createSvgElement('g',
{'class': 'blocklyTrash'}, null);
var rnd = String(Math.random()).substring(2);
var clip = Blockly.createSvgElement('clipPath',
{'id': 'blocklyTrashBodyClipPath'},
{'id': 'blocklyTrashBodyClipPath' + rnd},
this.svgGroup_);
Blockly.createSvgElement('rect',
{'width': this.WIDTH_, 'height': this.BODY_HEIGHT_,
......@@ -175,19 +176,19 @@ Blockly.Trashcan.prototype.createDom = function() {
clip);
var body = Blockly.createSvgElement('image',
{'width': Blockly.SPRITE.width, 'height': Blockly.SPRITE.height, 'y': -32,
'clip-path': 'url(#blocklyTrashBodyClipPath)'},
'clip-path': 'url(#blocklyTrashBodyClipPath' + rnd + ')'},
this.svgGroup_);
body.setAttributeNS('http://www.w3.org/1999/xlink', 'xlink:href',
this.workspace_.options.pathToMedia + Blockly.SPRITE.url);
var clip = Blockly.createSvgElement('clipPath',
{'id': 'blocklyTrashLidClipPath'},
{'id': 'blocklyTrashLidClipPath' + rnd},
this.svgGroup_);
Blockly.createSvgElement('rect',
{'width': this.WIDTH_, 'height': this.LID_HEIGHT_}, clip);
this.svgLid_ = Blockly.createSvgElement('image',
{'width': Blockly.SPRITE.width, 'height': Blockly.SPRITE.height, 'y': -32,
'clip-path': 'url(#blocklyTrashLidClipPath)'},
'clip-path': 'url(#blocklyTrashLidClipPath' + rnd + ')'},
this.svgGroup_);
this.svgLid_.setAttributeNS('http://www.w3.org/1999/xlink', 'xlink:href',
this.workspace_.options.pathToMedia + Blockly.SPRITE.url);
......
......@@ -110,15 +110,16 @@ Blockly.WorkspaceSvg.prototype.scrollbar = null;
*/
Blockly.WorkspaceSvg.prototype.createDom = function(opt_backgroundClass) {
/*
<g>
<g class="blocklyWorkspace">
<rect class="blocklyMainBackground" height="100%" width="100%"></rect>
[Trashcan and/or flyout may go here]
<g></g> // Block canvas
<g></g> // Bubble canvas
<g class="blocklyBlockCanvas"></g>
<g class="blocklyBubbleCanvas"></g>
[Scrollbars may go here]
</g>
*/
this.svgGroup_ = Blockly.createSvgElement('g', {}, null);
this.svgGroup_ = Blockly.createSvgElement('g',
{'class': 'blocklyWorkspace'}, null);
if (opt_backgroundClass) {
this.svgBackground_ = Blockly.createSvgElement('rect',
{'height': '100%', 'width': '100%',
......@@ -128,8 +129,10 @@ Blockly.WorkspaceSvg.prototype.createDom = function(opt_backgroundClass) {
'url(#' + this.options.gridPattern.id + ')';
}
}
this.svgBlockCanvas_ = Blockly.createSvgElement('g', {}, this.svgGroup_);
this.svgBubbleCanvas_ = Blockly.createSvgElement('g', {}, this.svgGroup_);
this.svgBlockCanvas_ = Blockly.createSvgElement('g',
{'class': 'blocklyBlockCanvas'}, this.svgGroup_);
this.svgBubbleCanvas_ = Blockly.createSvgElement('g',
{'class': 'blocklyBubbleCanvas'}, this.svgGroup_);
if (this.options.hasTrashcan) {
this.addTrashcan_();
}
......
......@@ -226,7 +226,7 @@ Blockly.Msg.MATH_RANDOM_FLOAT_HELPURL = "https://en.wikipedia.org/wiki/Random_nu
Blockly.Msg.MATH_RANDOM_FLOAT_TITLE_RANDOM = "रैन्डम अंश";
Blockly.Msg.MATH_RANDOM_FLOAT_TOOLTIP = "Return a random fraction between 0.0 (inclusive) and 1.0 (exclusive)."; // untranslated
Blockly.Msg.MATH_RANDOM_INT_HELPURL = "https://en.wikipedia.org/wiki/Random_number_generation";
Blockly.Msg.MATH_RANDOM_INT_TITLE = "%1 से % 2 तक रैन्डम पूर्णांक";
Blockly.Msg.MATH_RANDOM_INT_TITLE = "%1 से %2 तक रैन्डम पूर्णांक";
Blockly.Msg.MATH_RANDOM_INT_TOOLTIP = "Return a random integer between the two specified limits, inclusive."; // untranslated
Blockly.Msg.MATH_ROUND_HELPURL = "https://en.wikipedia.org/wiki/Rounding";
Blockly.Msg.MATH_ROUND_OPERATOR_ROUND = "पूर्णांक बनाएँ";
......
......@@ -62,7 +62,7 @@ Blockly.Msg.CONTROLS_WHILEUNTIL_OPERATOR_WHILE = "تا تکرار کو";
Blockly.Msg.CONTROLS_WHILEUNTIL_TOOLTIP_UNTIL = "While a value is false, then do some statements."; // untranslated
Blockly.Msg.CONTROLS_WHILEUNTIL_TOOLTIP_WHILE = "While a value is true, then do some statements."; // untranslated
Blockly.Msg.DELETE_BLOCK = "پاکسا کردن برشت";
Blockly.Msg.DELETE_X_BLOCKS = "پاکسا کردن1% د برشتیا";
Blockly.Msg.DELETE_X_BLOCKS = "پاکسا کردن%1 د برشتیا";
Blockly.Msg.DISABLE_BLOCK = "ناکشتگر کردن برشت";
Blockly.Msg.DUPLICATE_BLOCK = "کپی کردن";
Blockly.Msg.ENABLE_BLOCK = "کنشتگر کردن برشت";
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment