Commit 4fe83ba4 authored by Neil Fraser's avatar Neil Fraser

Tweak highlight path on inputs by a few pixels.

parent b81bff88
......@@ -833,9 +833,9 @@ Blockly.BlockSvg.prototype.renderDrawTop_=function(a,b,c,d){this.squareTopLeftCo
Blockly.BlockSvg.prototype.renderDrawRight_=function(a,b,c,d,e,f,g){for(var h,k=0,l,p,n=0,q;q=f[n];n++){h=Blockly.BlockSvg.SEP_SPACE_X;0==n&&(h+=Blockly.RTL?-g:g);b.push("M",f.rightEdge-1+","+(k+1));if(this.block_.isCollapsed()){var m=q[0];l=k+Blockly.BlockSvg.FIELD_HEIGHT;this.renderFields_(m.fieldRow,h,l);a.push(Blockly.BlockSvg.JAGGED_TEETH);Blockly.RTL?b.push("l 8,0 0,3.8 7,3.2 m -14.5,9 l 8,4"):b.push("h 8");m=q.height-Blockly.BlockSvg.JAGGED_TEETH_HEIGHT;a.push("v",m);Blockly.RTL&&b.push("v",
m-2);this.width+=Blockly.BlockSvg.JAGGED_TEETH_WIDTH}else if(q.type==Blockly.BlockSvg.INLINE){for(var r=0;m=q[r];r++)l=k+Blockly.BlockSvg.FIELD_HEIGHT,q.thicker&&(l+=Blockly.BlockSvg.INLINE_PADDING_Y),h=this.renderFields_(m.fieldRow,h,l),m.type!=Blockly.DUMMY_INPUT&&(h+=m.renderWidth+Blockly.BlockSvg.SEP_SPACE_X),m.type==Blockly.INPUT_VALUE&&(c.push("M",h-Blockly.BlockSvg.SEP_SPACE_X+","+(k+Blockly.BlockSvg.INLINE_PADDING_Y)),c.push("h",Blockly.BlockSvg.TAB_WIDTH-2-m.renderWidth),c.push(Blockly.BlockSvg.TAB_PATH_DOWN),
c.push("v",m.renderHeight+1-Blockly.BlockSvg.TAB_HEIGHT),c.push("h",m.renderWidth+2-Blockly.BlockSvg.TAB_WIDTH),c.push("z"),Blockly.RTL?(d.push("M",h-Blockly.BlockSvg.SEP_SPACE_X-3+Blockly.BlockSvg.TAB_WIDTH-m.renderWidth+","+(k+Blockly.BlockSvg.INLINE_PADDING_Y+1)),d.push(Blockly.BlockSvg.TAB_PATH_DOWN_HIGHLIGHT_RTL),d.push("v",m.renderHeight-Blockly.BlockSvg.TAB_HEIGHT+3),d.push("h",m.renderWidth-Blockly.BlockSvg.TAB_WIDTH+1)):(d.push("M",h-Blockly.BlockSvg.SEP_SPACE_X+1+","+(k+Blockly.BlockSvg.INLINE_PADDING_Y+
1)),d.push("v",m.renderHeight+1),d.push("h",Blockly.BlockSvg.TAB_WIDTH-2-m.renderWidth),d.push("M",h-m.renderWidth-Blockly.BlockSvg.SEP_SPACE_X+.8+","+(k+Blockly.BlockSvg.INLINE_PADDING_Y+Blockly.BlockSvg.TAB_HEIGHT-.4)),d.push("l",.42*Blockly.BlockSvg.TAB_WIDTH+",-1.8")),l=Blockly.RTL?e.x-h-Blockly.BlockSvg.TAB_WIDTH+Blockly.BlockSvg.SEP_SPACE_X+m.renderWidth+1:e.x+h+Blockly.BlockSvg.TAB_WIDTH-Blockly.BlockSvg.SEP_SPACE_X-m.renderWidth-1,p=e.y+k+Blockly.BlockSvg.INLINE_PADDING_Y+1,m.connection.moveTo(l,
1)),d.push("v",m.renderHeight+1),d.push("h",Blockly.BlockSvg.TAB_WIDTH-2-m.renderWidth),d.push("M",h-m.renderWidth-Blockly.BlockSvg.SEP_SPACE_X+1.8+","+(k+Blockly.BlockSvg.INLINE_PADDING_Y+Blockly.BlockSvg.TAB_HEIGHT-.4)),d.push("l",.38*Blockly.BlockSvg.TAB_WIDTH+",-1.8")),l=Blockly.RTL?e.x-h-Blockly.BlockSvg.TAB_WIDTH+Blockly.BlockSvg.SEP_SPACE_X+m.renderWidth+1:e.x+h+Blockly.BlockSvg.TAB_WIDTH-Blockly.BlockSvg.SEP_SPACE_X-m.renderWidth-1,p=e.y+k+Blockly.BlockSvg.INLINE_PADDING_Y+1,m.connection.moveTo(l,
p),m.connection.targetConnection&&m.connection.tighten_());h=Math.max(h,f.rightEdge);this.width=Math.max(this.width,h);a.push("H",h);b.push("H",h+(Blockly.RTL?-1:0));a.push("v",q.height);Blockly.RTL&&b.push("v",q.height-2)}else q.type==Blockly.INPUT_VALUE?(m=q[0],l=k+Blockly.BlockSvg.FIELD_HEIGHT,m.align!=Blockly.ALIGN_LEFT&&(r=f.rightEdge-m.fieldWidth-Blockly.BlockSvg.TAB_WIDTH-2*Blockly.BlockSvg.SEP_SPACE_X,m.align==Blockly.ALIGN_RIGHT?h+=r:m.align==Blockly.ALIGN_CENTRE&&(h+=(r+h)/2)),this.renderFields_(m.fieldRow,
h,l),a.push(Blockly.BlockSvg.TAB_PATH_DOWN),r=q.height-Blockly.BlockSvg.TAB_HEIGHT,a.push("v",r),Blockly.RTL?(b.push(Blockly.BlockSvg.TAB_PATH_DOWN_HIGHLIGHT_RTL),b.push("v",r)):(b.push("M",f.rightEdge-4.2+","+(k+Blockly.BlockSvg.TAB_HEIGHT-.4)),b.push("l",.42*Blockly.BlockSvg.TAB_WIDTH+",-1.8")),l=e.x+(Blockly.RTL?-f.rightEdge-1:f.rightEdge+1),p=e.y+k,m.connection.moveTo(l,p),m.connection.targetConnection&&(m.connection.tighten_(),this.width=Math.max(this.width,f.rightEdge+m.connection.targetBlock().getHeightWidth().width-
h,l),a.push(Blockly.BlockSvg.TAB_PATH_DOWN),r=q.height-Blockly.BlockSvg.TAB_HEIGHT,a.push("v",r),Blockly.RTL?(b.push(Blockly.BlockSvg.TAB_PATH_DOWN_HIGHLIGHT_RTL),b.push("v",r)):(b.push("M",f.rightEdge-4.2+","+(k+Blockly.BlockSvg.TAB_HEIGHT-.4)),b.push("l",.38*Blockly.BlockSvg.TAB_WIDTH+",-1.8")),l=e.x+(Blockly.RTL?-f.rightEdge-1:f.rightEdge+1),p=e.y+k,m.connection.moveTo(l,p),m.connection.targetConnection&&(m.connection.tighten_(),this.width=Math.max(this.width,f.rightEdge+m.connection.targetBlock().getHeightWidth().width-
Blockly.BlockSvg.TAB_WIDTH+1))):q.type==Blockly.DUMMY_INPUT?(m=q[0],l=k+Blockly.BlockSvg.FIELD_HEIGHT,m.align!=Blockly.ALIGN_LEFT&&(r=f.rightEdge-m.fieldWidth-2*Blockly.BlockSvg.SEP_SPACE_X,f.hasValue&&(r-=Blockly.BlockSvg.TAB_WIDTH),m.align==Blockly.ALIGN_RIGHT?h+=r:m.align==Blockly.ALIGN_CENTRE&&(h+=(r+h)/2)),this.renderFields_(m.fieldRow,h,l),a.push("v",q.height),Blockly.RTL&&b.push("v",q.height-2)):q.type==Blockly.NEXT_STATEMENT&&(m=q[0],0==n&&(a.push("v",Blockly.BlockSvg.SEP_SPACE_Y),Blockly.RTL&&
b.push("v",Blockly.BlockSvg.SEP_SPACE_Y-1),k+=Blockly.BlockSvg.SEP_SPACE_Y),l=k+Blockly.BlockSvg.FIELD_HEIGHT,m.align!=Blockly.ALIGN_LEFT&&(r=f.statementEdge-m.fieldWidth-2*Blockly.BlockSvg.SEP_SPACE_X,m.align==Blockly.ALIGN_RIGHT?h+=r:m.align==Blockly.ALIGN_CENTRE&&(h+=(r+h)/2)),this.renderFields_(m.fieldRow,h,l),h=f.statementEdge+Blockly.BlockSvg.NOTCH_WIDTH,a.push("H",h),a.push(Blockly.BlockSvg.INNER_TOP_LEFT_CORNER),a.push("v",q.height-2*Blockly.BlockSvg.CORNER_RADIUS),a.push(Blockly.BlockSvg.INNER_BOTTOM_LEFT_CORNER),
a.push("H",f.rightEdge),Blockly.RTL?(b.push("M",h-Blockly.BlockSvg.NOTCH_WIDTH+Blockly.BlockSvg.DISTANCE_45_OUTSIDE+","+(k+Blockly.BlockSvg.DISTANCE_45_OUTSIDE)),b.push(Blockly.BlockSvg.INNER_TOP_LEFT_CORNER_HIGHLIGHT_RTL),b.push("v",q.height-2*Blockly.BlockSvg.CORNER_RADIUS),b.push(Blockly.BlockSvg.INNER_BOTTOM_LEFT_CORNER_HIGHLIGHT_RTL),b.push("H",f.rightEdge-1)):(b.push("M",h-Blockly.BlockSvg.NOTCH_WIDTH+Blockly.BlockSvg.DISTANCE_45_OUTSIDE+","+(k+q.height-Blockly.BlockSvg.DISTANCE_45_OUTSIDE)),
......@@ -1089,7 +1089,7 @@ Blockly.FieldTextInput.prototype.onHtmlInputChange_=function(a){var b=Blockly.Fi
Blockly.FieldTextInput.prototype.validate_=function(){var a=!0;goog.asserts.assertObject(Blockly.FieldTextInput.htmlInput_);var b=Blockly.FieldTextInput.htmlInput_;this.changeHandler_&&(a=this.changeHandler_(b.value));null===a?Blockly.addClass_(b,"blocklyInvalidInput"):Blockly.removeClass_(b,"blocklyInvalidInput")};
Blockly.FieldTextInput.prototype.resizeEditor_=function(){var a=Blockly.WidgetDiv.DIV,b=this.fieldGroup_.getBBox();a.style.width=b.width+"px";b=Blockly.getAbsoluteXY_(this.borderRect_);if(Blockly.RTL){var c=this.borderRect_.getBBox();b.x+=c.width;b.x-=a.offsetWidth}b.y+=1;goog.userAgent.WEBKIT&&(b.y-=3);a.style.left=b.x+"px";a.style.top=b.y+"px"};
Blockly.FieldTextInput.prototype.widgetDispose_=function(){var a=this;return function(){var b=Blockly.FieldTextInput.htmlInput_,c=b.value;a.changeHandler_&&(c=a.changeHandler_(c),null===c&&(c=b.defaultValue));a.setText(c);a.sourceBlock_.rendered&&a.sourceBlock_.render();Blockly.unbindEvent_(b.onKeyUpWrapper_);Blockly.unbindEvent_(b.onKeyPressWrapper_);Blockly.unbindEvent_(b.onWorkspaceChangeWrapper_);Blockly.FieldTextInput.htmlInput_=null;Blockly.WidgetDiv.DIV.style.width="auto"}};
Blockly.FieldTextInput.numberValidator=function(a){a=a.replace(/O/ig,"0");a=a.replace(/,/g,"");a=parseFloat(a||0);return isNaN(a)?null:String(a)};Blockly.FieldTextInput.nonnegativeIntegerValidator=function(a){(a=Blockly.FieldTextInput.numberValidator(a))&&(a=String(Math.max(0,Math.floor(a))));return a};
Blockly.FieldTextInput.numberValidator=function(a){if(null===a)return null;a=a.replace(/O/ig,"0");a=a.replace(/,/g,"");a=parseFloat(a||0);return isNaN(a)?null:String(a)};Blockly.FieldTextInput.nonnegativeIntegerValidator=function(a){(a=Blockly.FieldTextInput.numberValidator(a))&&(a=String(Math.max(0,Math.floor(a))));return a};
// Copyright 2013 Google Inc. Apache License 2.0
Blockly.FieldAngle=function(a,b){var c;if(b){var d=this;c=function(a){a=Blockly.FieldAngle.angleValidator.call(d,a);null!==a&&b.call(d,a);return a}}else c=Blockly.FieldAngle.angleValidator;this.symbol_=Blockly.createSvgElement("tspan",{},null);this.symbol_.appendChild(document.createTextNode("\u00b0"));Blockly.FieldAngle.superClass_.constructor.call(this,a,c)};goog.inherits(Blockly.FieldAngle,Blockly.FieldTextInput);
Blockly.FieldAngle.prototype.clone=function(){return new Blockly.FieldAngle(this.getText(),this.changeHandler_)};Blockly.FieldAngle.ROUND=15;Blockly.FieldAngle.HALF=50;Blockly.FieldAngle.RADIUS=Blockly.FieldAngle.HALF-1;Blockly.FieldAngle.prototype.dispose_=function(){var a=this;return function(){Blockly.FieldAngle.superClass_.dispose_.call(a)();a.gauge_=null;a.clickWrapper_&&Blockly.unbindEvent_(a.clickWrapper_);a.moveWrapper1_&&Blockly.unbindEvent_(a.moveWrapper1_);a.moveWrapper2_&&Blockly.unbindEvent_(a.moveWrapper2_)}};
......@@ -1285,7 +1285,7 @@ Blockly.convertCoordinates=function(a,b,c){c&&(a-=window.scrollX||window.pageXOf
Blockly.shortestStringLength=function(a){if(!a.length)return 0;for(var b=a[0].length,c=1;c<a.length;c++)b=Math.min(b,a[c].length);return b};Blockly.commonWordPrefix=function(a,b){if(!a.length)return 0;if(1==a.length)return a[0].length;for(var c=0,d=b||Blockly.shortestStringLength(a),e=0;e<d;e++){for(var f=a[0][e],g=1;g<a.length;g++)if(f!=a[g][e])return c;" "==f&&(c=e+1)}for(g=1;g<a.length;g++)if((f=a[g][e])&&" "!=f)return c;return d};
Blockly.commonWordSuffix=function(a,b){if(!a.length)return 0;if(1==a.length)return a[0].length;for(var c=0,d=b||Blockly.shortestStringLength(a),e=0;e<d;e++){for(var f=a[0].substr(-e-1,1),g=1;g<a.length;g++)if(f!=a[g].substr(-e-1,1))return c;" "==f&&(c=e+1)}for(g=1;g<a.length;g++)if((f=a[g].charAt(a[g].length-e-1))&&" "!=f)return c;return d};Blockly.isNumber=function(a){return!!a.match(/^\s*-?\d+(\.\d+)?\s*$/)};
// Copyright 2011 Google Inc. Apache License 2.0
Blockly.pathToMedia="https://blockly-demo.appspot.com/static/media/";Blockly.SVG_NS="http://www.w3.org/2000/svg";Blockly.HTML_NS="http://www.w3.org/1999/xhtml";Blockly.HSV_SATURATION=.45;Blockly.HSV_VALUE=.65;Blockly.SPRITE={width:64,height:92,url:"sprites.png"};Blockly.makeColour=function(a){return goog.color.hsvToHex(a,Blockly.HSV_SATURATION,256*Blockly.HSV_VALUE)};Blockly.INPUT_VALUE=1;Blockly.OUTPUT_VALUE=2;Blockly.NEXT_STATEMENT=3;Blockly.PREVIOUS_STATEMENT=4;Blockly.DUMMY_INPUT=5;
Blockly.pathToMedia="https://blockly-demo.appspot.com/static/media/";Blockly.SVG_NS="http://www.w3.org/2000/svg";Blockly.HTML_NS="http://www.w3.org/1999/xhtml";Blockly.HSV_SATURATION=.45;Blockly.HSV_VALUE=.65;Blockly.SPRITE={width:64,height:92,url:"sprites.png"};Blockly.makeColour=function(a){return goog.color.hsvToHex(a,Blockly.HSV_SATURATION,255*Blockly.HSV_VALUE)};Blockly.INPUT_VALUE=1;Blockly.OUTPUT_VALUE=2;Blockly.NEXT_STATEMENT=3;Blockly.PREVIOUS_STATEMENT=4;Blockly.DUMMY_INPUT=5;
Blockly.ALIGN_LEFT=-1;Blockly.ALIGN_CENTRE=0;Blockly.ALIGN_RIGHT=1;Blockly.OPPOSITE_TYPE=[];Blockly.OPPOSITE_TYPE[Blockly.INPUT_VALUE]=Blockly.OUTPUT_VALUE;Blockly.OPPOSITE_TYPE[Blockly.OUTPUT_VALUE]=Blockly.INPUT_VALUE;Blockly.OPPOSITE_TYPE[Blockly.NEXT_STATEMENT]=Blockly.PREVIOUS_STATEMENT;Blockly.OPPOSITE_TYPE[Blockly.PREVIOUS_STATEMENT]=Blockly.NEXT_STATEMENT;Blockly.SOUNDS_=Object.create(null);Blockly.selected=null;Blockly.readOnly=!1;Blockly.highlightedConnection_=null;
Blockly.localConnection_=null;Blockly.DRAG_RADIUS=5;Blockly.SNAP_RADIUS=20;Blockly.BUMP_DELAY=250;Blockly.COLLAPSE_CHARS=30;Blockly.mainWorkspace=null;Blockly.clipboard_=null;Blockly.onTouchUpWrapper_=null;Blockly.svgSize=function(){return{width:Blockly.svg.cachedWidth_,height:Blockly.svg.cachedHeight_}};
Blockly.svgResize=function(){var a=Blockly.svg,b=a.parentNode,c=b.offsetWidth,b=b.offsetHeight;a.cachedWidth_!=c&&(a.setAttribute("width",c+"px"),a.cachedWidth_=c);a.cachedHeight_!=b&&(a.setAttribute("height",b+"px"),a.cachedHeight_=b);Blockly.mainWorkspace.scrollbar&&Blockly.mainWorkspace.scrollbar.resize()};
......
......@@ -868,19 +868,20 @@ Blockly.BlockSvg.prototype.renderDrawRight_ = function(steps, highlightSteps,
highlightInlineSteps.push('h',
input.renderWidth - Blockly.BlockSvg.TAB_WIDTH + 1);
} else {
// Highlight right edge, bottom, and glint at bottom of tab.
// Highlight right edge, bottom.
highlightInlineSteps.push('M',
(cursorX - Blockly.BlockSvg.SEP_SPACE_X + 1) + ',' +
(cursorY + Blockly.BlockSvg.INLINE_PADDING_Y + 1));
highlightInlineSteps.push('v', input.renderHeight + 1);
highlightInlineSteps.push('h', Blockly.BlockSvg.TAB_WIDTH - 2 -
input.renderWidth);
// Short highlight glint at bottom of tab.
highlightInlineSteps.push('M',
(cursorX - input.renderWidth - Blockly.BlockSvg.SEP_SPACE_X +
0.8) + ',' + (cursorY + Blockly.BlockSvg.INLINE_PADDING_Y +
1.8) + ',' + (cursorY + Blockly.BlockSvg.INLINE_PADDING_Y +
Blockly.BlockSvg.TAB_HEIGHT - 0.4));
highlightInlineSteps.push('l',
(Blockly.BlockSvg.TAB_WIDTH * 0.42) + ',-1.8');
(Blockly.BlockSvg.TAB_WIDTH * 0.38) + ',-1.8');
}
// Create inline input connection.
if (Blockly.RTL) {
......@@ -935,7 +936,7 @@ Blockly.BlockSvg.prototype.renderDrawRight_ = function(steps, highlightSteps,
// Short highlight glint at bottom of tab.
highlightSteps.push('M', (inputRows.rightEdge - 4.2) + ',' +
(cursorY + Blockly.BlockSvg.TAB_HEIGHT - 0.4));
highlightSteps.push('l', (Blockly.BlockSvg.TAB_WIDTH * 0.42) +
highlightSteps.push('l', (Blockly.BlockSvg.TAB_WIDTH * 0.38) +
',-1.8');
}
// Create external input connection.
......
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