From 9e5b4b2856a5f3b15237ce58e9e5a2f7b7740dc0 Mon Sep 17 00:00:00 2001 From: Neil Fraser Date: Wed, 24 Dec 2014 13:48:45 -0800 Subject: [PATCH] Fix bug 34. --- blockly_compressed.js | 2 +- core/block_svg.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/blockly_compressed.js b/blockly_compressed.js index ae5edf62e..9cd7aa211 100644 --- a/blockly_compressed.js +++ b/blockly_compressed.js @@ -1019,7 +1019,7 @@ Blockly.ContextMenu.hide=function(){Blockly.WidgetDiv.hideIfOwner(Blockly.Contex // Copyright 2012 Google Inc. Apache License 2.0 Blockly.BlockSvg=function(){this.svgGroup_=Blockly.createSvgElement("g",{},null);this.svgPathDark_=Blockly.createSvgElement("path",{"class":"blocklyPathDark",transform:"translate(1, 1)"},this.svgGroup_);this.svgPath_=Blockly.createSvgElement("path",{"class":"blocklyPath"},this.svgGroup_);this.svgPathLight_=Blockly.createSvgElement("path",{"class":"blocklyPathLight"},this.svgGroup_);this.svgPath_.tooltip=this;Blockly.Tooltip.bindMouseEvents(this.svgPath_);this.updateMovable()}; goog.inherits(Blockly.BlockSvg,Blockly.Block);Blockly.BlockSvg.prototype.height=0;Blockly.BlockSvg.prototype.width=0;Blockly.BlockSvg.INLINE=-1; -Blockly.BlockSvg.prototype.initSvg=function(){goog.asserts.assert(this.workspace.rendered,"Workspace is headless.");this.updateColour();for(var a=0,b;b=this.inputList[a];a++)b.init();this.mutator&&this.mutator.createIcon();Blockly.readOnly||Blockly.bindEvent_(this.getSvgRoot(),"mousedown",this,this.onMouseDown_);this.workspace.getCanvas().appendChild(this.getSvgRoot());goog.isFunction(this.onchange)&&Blockly.bindEvent_(this.workspace.getCanvas(),"blocklyWorkspaceChange",this,this.onchange)}; +Blockly.BlockSvg.prototype.initSvg=function(){goog.asserts.assert(this.workspace.rendered,"Workspace is headless.");for(var a=0,b;b=this.inputList[a];a++)b.init();this.mutator&&this.mutator.createIcon();this.updateColour();Blockly.readOnly||Blockly.bindEvent_(this.getSvgRoot(),"mousedown",this,this.onMouseDown_);this.workspace.getCanvas().appendChild(this.getSvgRoot());goog.isFunction(this.onchange)&&Blockly.bindEvent_(this.workspace.getCanvas(),"blocklyWorkspaceChange",this,this.onchange)}; Blockly.BlockSvg.prototype.select=function(){Blockly.selected&&Blockly.selected.unselect();Blockly.selected=this;this.addSelect();Blockly.fireUiEvent(this.workspace.getCanvas(),"blocklySelectChange")};Blockly.BlockSvg.prototype.unselect=function(){Blockly.selected=null;this.removeSelect();Blockly.fireUiEvent(this.workspace.getCanvas(),"blocklySelectChange")};Blockly.BlockSvg.prototype.mutator=null;Blockly.BlockSvg.prototype.comment=null;Blockly.BlockSvg.prototype.warning=null; Blockly.BlockSvg.prototype.getIcons=function(){var a=[];this.mutator&&a.push(this.mutator);this.comment&&a.push(this.comment);this.warning&&a.push(this.warning);return a};Blockly.BlockSvg.onMouseUpWrapper_=null;Blockly.BlockSvg.onMouseMoveWrapper_=null; Blockly.BlockSvg.terminateDrag_=function(){Blockly.BlockSvg.onMouseUpWrapper_&&(Blockly.unbindEvent_(Blockly.BlockSvg.onMouseUpWrapper_),Blockly.BlockSvg.onMouseUpWrapper_=null);Blockly.BlockSvg.onMouseMoveWrapper_&&(Blockly.unbindEvent_(Blockly.BlockSvg.onMouseMoveWrapper_),Blockly.BlockSvg.onMouseMoveWrapper_=null);var a=Blockly.selected;if(2==Blockly.dragMode_&&a){var b=a.getRelativeToSurfaceXY();a.moveConnections_(b.x-a.startDragX,b.y-a.startDragY);delete a.draggedBubbles_;a.setDragging_(!1); diff --git a/core/block_svg.js b/core/block_svg.js index 3f1485475..e86f12afd 100644 --- a/core/block_svg.js +++ b/core/block_svg.js @@ -74,13 +74,13 @@ Blockly.BlockSvg.INLINE = -1; */ Blockly.BlockSvg.prototype.initSvg = function() { goog.asserts.assert(this.workspace.rendered, 'Workspace is headless.'); - this.updateColour(); for (var x = 0, input; input = this.inputList[x]; x++) { input.init(); } if (this.mutator) { this.mutator.createIcon(); } + this.updateColour(); if (!Blockly.readOnly) { Blockly.bindEvent_(this.getSvgRoot(), 'mousedown', this, this.onMouseDown_);