One pixel glitch in inline connections.

This commit is contained in:
Neil Fraser
2015-05-26 19:07:21 -07:00
parent b3e7784920
commit 9e8edc8c3f
5 changed files with 12 additions and 12 deletions

View File

@@ -1113,10 +1113,10 @@ Blockly.BlockSvg.prototype.removeSelect=function(){Blockly.removeClass_(this.svg
Blockly.BlockSvg.prototype.render=function(a){this.rendered=!0;var b=Blockly.BlockSvg.SEP_SPACE_X;this.RTL&&(b=-b);for(var c=this.getIcons(),d=0;d<c.length;d++)b=c[d].renderIcon(b);b+=this.RTL?Blockly.BlockSvg.SEP_SPACE_X:-Blockly.BlockSvg.SEP_SPACE_X;c=this.renderCompute_(b);this.renderDraw_(b,c);!1!==a&&((a=this.getParent())?a.render(!0):Blockly.fireUiEvent(window,"resize"));Blockly.Realtime.blockChanged(this)};
Blockly.BlockSvg.prototype.renderFields_=function(a,b,c){this.RTL&&(b=-b);for(var d=0,e;e=a[d];d++){var f=e.getSvgRoot();f&&(this.RTL?(b-=e.renderSep+e.renderWidth,f.setAttribute("transform","translate("+b+", "+c+")"),e.renderWidth&&(b-=Blockly.BlockSvg.SEP_SPACE_X)):(f.setAttribute("transform","translate("+(b+e.renderSep)+", "+c+")"),e.renderWidth&&(b+=e.renderSep+e.renderWidth+Blockly.BlockSvg.SEP_SPACE_X)))}return this.RTL?-b:b};
Blockly.BlockSvg.prototype.renderCompute_=function(a){var b=this.inputList,c=[];c.rightEdge=a+2*Blockly.BlockSvg.SEP_SPACE_X;if(this.previousConnection||this.nextConnection)c.rightEdge=Math.max(c.rightEdge,Blockly.BlockSvg.NOTCH_WIDTH+Blockly.BlockSvg.SEP_SPACE_X);for(var d=0,e=0,f=!1,g=!1,h=!1,k=void 0,l=this.inputsInline&&!this.isCollapsed(),p=0,m;m=b[p];p++)if(m.isVisible()){var q;l&&k&&k!=Blockly.NEXT_STATEMENT&&m.type!=Blockly.NEXT_STATEMENT?q=c[c.length-1]:(k=m.type,q=[],q.type=l&&m.type!=Blockly.NEXT_STATEMENT?
Blockly.BlockSvg.INLINE:m.type,q.height=0,c.push(q));q.push(m);m.renderHeight=Blockly.BlockSvg.MIN_BLOCK_Y;m.renderWidth=l&&m.type==Blockly.INPUT_VALUE?Blockly.BlockSvg.TAB_WIDTH+1.25*Blockly.BlockSvg.SEP_SPACE_X:0;if(m.connection&&m.connection.targetConnection){var n=m.connection.targetBlock().getHeightWidth();m.renderHeight=Math.max(m.renderHeight,n.height);m.renderWidth=Math.max(m.renderWidth,n.width)}p==b.length-1&&m.renderHeight--;q.height=Math.max(q.height,m.renderHeight);m.fieldWidth=0;1==
c.length&&(m.fieldWidth+=this.RTL?-a:a);for(var n=!1,r=0,t;t=m.fieldRow[r];r++){0!=r&&(m.fieldWidth+=Blockly.BlockSvg.SEP_SPACE_X);var u=t.getSize();t.renderWidth=u.width;t.renderSep=n&&t.EDITABLE?Blockly.BlockSvg.SEP_SPACE_X:0;m.fieldWidth+=t.renderWidth+t.renderSep;q.height=Math.max(q.height,u.height);n=t.EDITABLE}q.type!=Blockly.BlockSvg.INLINE&&(q.type==Blockly.NEXT_STATEMENT?(g=!0,e=Math.max(e,m.fieldWidth)):(q.type==Blockly.INPUT_VALUE?f=!0:q.type==Blockly.DUMMY_INPUT&&(h=!0),d=Math.max(d,m.fieldWidth)))}for(a=
0;q=c[a];a++)if(q.thicker=!1,q.type==Blockly.BlockSvg.INLINE)for(b=0;m=q[b];b++)if(m.type==Blockly.INPUT_VALUE){q.height+=2*Blockly.BlockSvg.INLINE_PADDING_Y;q.thicker=!0;break}c.statementEdge=2*Blockly.BlockSvg.SEP_SPACE_X+e;g&&(c.rightEdge=Math.max(c.rightEdge,c.statementEdge+Blockly.BlockSvg.NOTCH_WIDTH));f?c.rightEdge=Math.max(c.rightEdge,d+2*Blockly.BlockSvg.SEP_SPACE_X+Blockly.BlockSvg.TAB_WIDTH):h&&(c.rightEdge=Math.max(c.rightEdge,d+2*Blockly.BlockSvg.SEP_SPACE_X));c.hasValue=f;c.hasStatement=
g;c.hasDummy=h;return c};
Blockly.BlockSvg.INLINE:m.type,q.height=0,c.push(q));q.push(m);m.renderHeight=Blockly.BlockSvg.MIN_BLOCK_Y;m.renderWidth=l&&m.type==Blockly.INPUT_VALUE?Blockly.BlockSvg.TAB_WIDTH+1.25*Blockly.BlockSvg.SEP_SPACE_X:0;if(m.connection&&m.connection.targetConnection){var n=m.connection.targetBlock().getHeightWidth();m.renderHeight=Math.max(m.renderHeight,n.height);m.renderWidth=Math.max(m.renderWidth,n.width)}l||p!=b.length-1||m.renderHeight--;q.height=Math.max(q.height,m.renderHeight);m.fieldWidth=0;
1==c.length&&(m.fieldWidth+=this.RTL?-a:a);for(var n=!1,r=0,t;t=m.fieldRow[r];r++){0!=r&&(m.fieldWidth+=Blockly.BlockSvg.SEP_SPACE_X);var u=t.getSize();t.renderWidth=u.width;t.renderSep=n&&t.EDITABLE?Blockly.BlockSvg.SEP_SPACE_X:0;m.fieldWidth+=t.renderWidth+t.renderSep;q.height=Math.max(q.height,u.height);n=t.EDITABLE}q.type!=Blockly.BlockSvg.INLINE&&(q.type==Blockly.NEXT_STATEMENT?(g=!0,e=Math.max(e,m.fieldWidth)):(q.type==Blockly.INPUT_VALUE?f=!0:q.type==Blockly.DUMMY_INPUT&&(h=!0),d=Math.max(d,
m.fieldWidth)))}for(a=0;q=c[a];a++)if(q.thicker=!1,q.type==Blockly.BlockSvg.INLINE)for(b=0;m=q[b];b++)if(m.type==Blockly.INPUT_VALUE){q.height+=2*Blockly.BlockSvg.INLINE_PADDING_Y;q.thicker=!0;break}c.statementEdge=2*Blockly.BlockSvg.SEP_SPACE_X+e;g&&(c.rightEdge=Math.max(c.rightEdge,c.statementEdge+Blockly.BlockSvg.NOTCH_WIDTH));f?c.rightEdge=Math.max(c.rightEdge,d+2*Blockly.BlockSvg.SEP_SPACE_X+Blockly.BlockSvg.TAB_WIDTH):h&&(c.rightEdge=Math.max(c.rightEdge,d+2*Blockly.BlockSvg.SEP_SPACE_X));c.hasValue=
f;c.hasStatement=g;c.hasDummy=h;return c};
Blockly.BlockSvg.prototype.renderDraw_=function(a,b){if(this.outputConnection)this.squareBottomLeftCorner_=this.squareTopLeftCorner_=!0;else{this.squareBottomLeftCorner_=this.squareTopLeftCorner_=!1;if(this.previousConnection){var c=this.previousConnection.targetBlock();c&&c.getNextBlock()==this&&(this.squareTopLeftCorner_=!0)}this.getNextBlock()&&(this.squareBottomLeftCorner_=!0)}var d=this.getRelativeToSurfaceXY(),e=[],f=[],c=[],g=[];this.renderDrawTop_(e,c,d,b.rightEdge);var h=this.renderDrawRight_(e,
c,f,g,d,b,a);this.renderDrawBottom_(e,c,d,h);this.renderDrawLeft_(e,c,d,h);d=e.join(" ")+"\n"+f.join(" ");this.svgPath_.setAttribute("d",d);this.svgPathDark_.setAttribute("d",d);d=c.join(" ")+"\n"+g.join(" ");this.svgPathLight_.setAttribute("d",d);this.RTL&&(this.svgPath_.setAttribute("transform","scale(-1 1)"),this.svgPathLight_.setAttribute("transform","scale(-1 1)"),this.svgPathDark_.setAttribute("transform","translate(1,1) scale(-1 1)"))};
Blockly.BlockSvg.prototype.renderDrawTop_=function(a,b,c,d){this.squareTopLeftCorner_?(a.push("m 0,0"),b.push("m 1,1")):(a.push(Blockly.BlockSvg.TOP_LEFT_CORNER_START),b.push(this.RTL?Blockly.BlockSvg.TOP_LEFT_CORNER_START_HIGHLIGHT_RTL:Blockly.BlockSvg.TOP_LEFT_CORNER_START_HIGHLIGHT_LTR),a.push(Blockly.BlockSvg.TOP_LEFT_CORNER),b.push(Blockly.BlockSvg.TOP_LEFT_CORNER_HIGHLIGHT));this.previousConnection&&(a.push("H",Blockly.BlockSvg.NOTCH_WIDTH-15),b.push("H",Blockly.BlockSvg.NOTCH_WIDTH-15),a.push(Blockly.BlockSvg.NOTCH_PATH_LEFT),

View File

@@ -1446,7 +1446,7 @@ Blockly.BlockSvg.prototype.renderCompute_ = function(iconWidth) {
input.renderWidth = Math.max(input.renderWidth, bBox.width);
}
if (i == inputList.length - 1) {
if (!isInline && i == inputList.length - 1) {
// Last element should overhang slightly due to shadow.
input.renderHeight--;
}

View File

@@ -9,7 +9,7 @@ goog.require('Blockly.Msg');
Blockly.Msg.ADD_COMMENT = "ใส่คำอธิบาย";
Blockly.Msg.AUTH = "กรุณาอนุญาตแอปนี้เพื่อเปิดใช้งาน การบันทึกงานของคุณ และยินยอมให้คุณแบ่งปันงานของคุณได้";
Blockly.Msg.CHANGE_VALUE_TITLE = "เปลี่ยนค่า:";
Blockly.Msg.CHAT = "คุยกับ ผู้ร่วมงานของคุณโดยพิมพ์ลงในกล่องนี้!";
Blockly.Msg.CHAT = "คุยกับผู้ร่วมงานของคุณโดยพิมพ์ลงในกล่องนี้!";
Blockly.Msg.COLLAPSE_ALL = "ย่อบล็อก";
Blockly.Msg.COLLAPSE_BLOCK = "ย่อบล็อก";
Blockly.Msg.COLOUR_BLEND_COLOUR1 = "สีที่ 1";

View File

@@ -208,7 +208,7 @@ Blockly.Msg.MATH_MODULO_HELPURL = "https://zh.wikipedia.org/wiki/模除";
Blockly.Msg.MATH_MODULO_TITLE = "取余数自 %1 ÷ %2";
Blockly.Msg.MATH_MODULO_TOOLTIP = "返回这两个数字相除后的余数。";
Blockly.Msg.MATH_MULTIPLICATION_SYMBOL = "×"; // untranslated
Blockly.Msg.MATH_NUMBER_HELPURL = "https://zh.wikipedia.org/wiki/数";
Blockly.Msg.MATH_NUMBER_HELPURL = "https://zh.wikipedia.org/wiki/数";
Blockly.Msg.MATH_NUMBER_TOOLTIP = "一个数字。";
Blockly.Msg.MATH_ONLIST_HELPURL = ""; // untranslated
Blockly.Msg.MATH_ONLIST_OPERATOR_AVERAGE = "列表中的平均数";

View File

@@ -156,7 +156,7 @@ Blockly.Msg.LOGIC_BOOLEAN_FALSE = "否";
Blockly.Msg.LOGIC_BOOLEAN_HELPURL = "https://github.com/google/blockly/wiki/Logic#values"; // untranslated
Blockly.Msg.LOGIC_BOOLEAN_TOOLTIP = "返回 真 或 否。";
Blockly.Msg.LOGIC_BOOLEAN_TRUE = "真";
Blockly.Msg.LOGIC_COMPARE_HELPURL = "https://en.wikipedia.org/wiki/Inequality_(mathematics)";
Blockly.Msg.LOGIC_COMPARE_HELPURL = "https://zh.wikipedia.org/wiki/不等";
Blockly.Msg.LOGIC_COMPARE_TOOLTIP_EQ = "如果這兩個輸入區塊內容相等,返回 真。";
Blockly.Msg.LOGIC_COMPARE_TOOLTIP_GT = "如果第一個輸入大於第二個輸入,返回 真。";
Blockly.Msg.LOGIC_COMPARE_TOOLTIP_GTE = "如果第一個輸入大於或等於第二個輸入,返回 真。";
@@ -175,12 +175,12 @@ Blockly.Msg.LOGIC_OPERATION_OR = "或";
Blockly.Msg.LOGIC_OPERATION_TOOLTIP_AND = "如果這兩個輸入值都為 真,則返回 真。";
Blockly.Msg.LOGIC_OPERATION_TOOLTIP_OR = "如果至少一個輸入的值為 真,返回 真。";
Blockly.Msg.LOGIC_TERNARY_CONDITION = "測試";
Blockly.Msg.LOGIC_TERNARY_HELPURL = "https://en.wikipedia.org/wiki/%3F:"; // untranslated
Blockly.Msg.LOGIC_TERNARY_HELPURL = "https://zh.wikipedia.org/wiki/條件運算符";
Blockly.Msg.LOGIC_TERNARY_IF_FALSE = "如果為非";
Blockly.Msg.LOGIC_TERNARY_IF_TRUE = "如果為真";
Blockly.Msg.LOGIC_TERNARY_TOOLTIP = "檢查 'test' 中的條件。如果條件為 真,將返回 '如果為 真' 值 ;否則,返回 '如果為 否' 的值。";
Blockly.Msg.MATH_ADDITION_SYMBOL = "+"; // untranslated
Blockly.Msg.MATH_ARITHMETIC_HELPURL = "https://en.wikipedia.org/wiki/Arithmetic";
Blockly.Msg.MATH_ARITHMETIC_HELPURL = "https://zh.wikipedia.org/wiki/算術";
Blockly.Msg.MATH_ARITHMETIC_TOOLTIP_ADD = "返回兩個數字的總和。";
Blockly.Msg.MATH_ARITHMETIC_TOOLTIP_DIVIDE = "返回兩個數字的商。";
Blockly.Msg.MATH_ARITHMETIC_TOOLTIP_MINUS = "返回兩個數字的差。";
@@ -208,7 +208,7 @@ Blockly.Msg.MATH_MODULO_HELPURL = "https://zh.wikipedia.org/wiki/模除";
Blockly.Msg.MATH_MODULO_TITLE = "取餘數自 %1 ÷ %2";
Blockly.Msg.MATH_MODULO_TOOLTIP = "回傳兩個數字相除的餘數";
Blockly.Msg.MATH_MULTIPLICATION_SYMBOL = "×"; // untranslated
Blockly.Msg.MATH_NUMBER_HELPURL = "https://en.wikipedia.org/wiki/Number";
Blockly.Msg.MATH_NUMBER_HELPURL = "https://zh.wikipedia.org/wiki/";
Blockly.Msg.MATH_NUMBER_TOOLTIP = "一個數字。";
Blockly.Msg.MATH_ONLIST_HELPURL = ""; // untranslated
Blockly.Msg.MATH_ONLIST_OPERATOR_AVERAGE = "平均值 自列表";
@@ -239,7 +239,7 @@ Blockly.Msg.MATH_ROUND_OPERATOR_ROUND = "四捨五入";
Blockly.Msg.MATH_ROUND_OPERATOR_ROUNDDOWN = "無條件捨去";
Blockly.Msg.MATH_ROUND_OPERATOR_ROUNDUP = "無條件進位";
Blockly.Msg.MATH_ROUND_TOOLTIP = "將數字向上或向下舍入。";
Blockly.Msg.MATH_SINGLE_HELPURL = "https://en.wikipedia.org/wiki/Square_root";
Blockly.Msg.MATH_SINGLE_HELPURL = "https://zh.wikipedia.org/wiki/平方根";
Blockly.Msg.MATH_SINGLE_OP_ABSOLUTE = "絕對值";
Blockly.Msg.MATH_SINGLE_OP_ROOT = "開根號";
Blockly.Msg.MATH_SINGLE_TOOLTIP_ABS = "返回指定數字的絕對值。";