mirror of
https://github.com/scratchfoundation/scratch-blocks.git
synced 2025-08-28 22:10:31 -04:00
Replace drawn icons with images (issue 45).
This commit is contained in:
parent
1916f2351d
commit
e2af14c32f
7 changed files with 124 additions and 129 deletions
|
@ -38,10 +38,15 @@ goog.require('Blockly.Icon');
|
|||
*/
|
||||
Blockly.Warning = function(block) {
|
||||
Blockly.Warning.superClass_.constructor.call(this, block);
|
||||
this.createIcon_();
|
||||
this.createIcon();
|
||||
};
|
||||
goog.inherits(Blockly.Warning, Blockly.Icon);
|
||||
|
||||
/**
|
||||
* Icon in base64 format.
|
||||
* @private
|
||||
*/
|
||||
Blockly.Warning.prototype.png_ = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABEAAAARCAYAAAA7bUf6AAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAANyAAADcgBffIlqAAAAAd0SU1FB98DGgApDBpIGrEAAAGfSURBVDjLnZM9S2NREIbfc2P8AF27BXshpIzK5g9ssUj8C2tnYyUoiBGSyk4sbCLs1vkRgoW1jYWFICwsMV2Se3JPboLe+FhcNCZcjXFgOMzHeec9M2ekDwTIAEUgo68IsOQczdNTIudoAksTg/g+5+UyDxKUyzz4PueTsvhZr+NmZkCC6Wmo1QiAX58FmLKWf4VCDPCiGxtgLf+B9FiQXo+9y0ucBIUCnJ3B+noMdHGBC0P2xrH4HoYEmUx8qVQCgMPD2F5ehjDEjTbZe2s4p5NKRenb2+Qid3dSpaK0tTp+j8VKq0VncXHQh2IxZrK/P/AtLECjQQf4McQEMNbq786O5qwdANfr8Xl/P/AFgbS7qzlr9Qcwr4EoYvPmBud5wxPJ5+HqCtbWhv3GwPU1Lor4/fKMeedo5vPDiRKsrsLWFuRyybFOhxbwTd0upWqVcDQpaTqjWq0SdruU5PvUkiol/ZNRzeXA96mp3aaRzSYnjdNsFtptGiYI2PY8HaVSmu33xWf3K5WS6ffVe3rSgXnzT+YlpSfY00djjJOkZ/wpr41bQMIsAAAAAElFTkSuQmCC';
|
||||
|
||||
/**
|
||||
* Create the text for the warning's bubble.
|
||||
|
@ -71,28 +76,6 @@ Blockly.Warning.textToDom_ = function(text) {
|
|||
*/
|
||||
Blockly.Warning.prototype.text_ = '';
|
||||
|
||||
/**
|
||||
* Create the icon on the block.
|
||||
* @private
|
||||
*/
|
||||
Blockly.Warning.prototype.createIcon_ = function() {
|
||||
Blockly.Icon.prototype.createIcon_.call(this);
|
||||
/* Here's the markup that will be generated:
|
||||
<path class="blocklyIconShield" d="..."/>
|
||||
<text class="blocklyIconMark" x="8" y="13">!</text>
|
||||
*/
|
||||
var iconShield = Blockly.createSvgElement('path',
|
||||
{'class': 'blocklyIconShield',
|
||||
'd': 'M 2,15 Q -1,15 0.5,12 L 6.5,1.7 Q 8,-1 9.5,1.7 L 15.5,12 ' +
|
||||
'Q 17,15 14,15 z'},
|
||||
this.iconGroup_);
|
||||
this.iconMark_ = Blockly.createSvgElement('text',
|
||||
{'class': 'blocklyIconMark',
|
||||
'x': Blockly.Icon.RADIUS,
|
||||
'y': 2 * Blockly.Icon.RADIUS - 3}, this.iconGroup_);
|
||||
this.iconMark_.appendChild(document.createTextNode('!'));
|
||||
};
|
||||
|
||||
/**
|
||||
* Show or hide the warning bubble.
|
||||
* @param {boolean} visible True if the bubble should be visible.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue