Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions core/css.js
Original file line number Diff line number Diff line change
Expand Up @@ -788,9 +788,7 @@ Blockly.Css.CONTENT = [
'}',

'.blocklyAngleCircle {',
'stroke: ' + Blockly.Colours.motion.tertiary + ';',
'stroke-width: 1;',
'fill: ' + Blockly.Colours.motion.secondary + ';',
'}',

'.blocklyAngleCenterPoint {',
Expand Down
38 changes: 25 additions & 13 deletions core/field_angle.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,9 +137,22 @@ Blockly.FieldAngle.RADIUS = Blockly.FieldAngle.HALF
Blockly.FieldAngle.CENTER_RADIUS = 2;

/**
* Path to the arrow svg icon.
* SVG path data for arrow icon.
*/
Blockly.FieldAngle.ARROW_SVG_PATH = 'icons/arrow.svg';
Blockly.FieldAngle.ARROW_SVG_PATH_DATA =
'M 0.0189 -1.3178' +
' L -4.4901 -0.5663' +
' C -4.7532 -0.5224 -4.9811 -0.2606 -4.9811 0.0156' +
' C -4.9811 0.2836 -4.7613 0.5522 -4.4901 0.5974' +
' L 0.0189 1.3489' +
' L 0.0189 3.0185' +
' C 0.0189 3.5625 0.3833 3.752 0.8327 3.4269' +
' L 4.641 0.6721' +
' C 5.0982 0.3414 5.0957 -0.1853 4.6527 -0.5168' +
' L 0.821 -3.3842' +
' C 0.3756 -3.7175 0.0189 -3.5381 0.0189 -2.9874' +
' L 0.0189 -1.3178' +
' Z';

/**
* Clean up this FieldAngle, as well as the inherited FieldTextInput.
Expand Down Expand Up @@ -175,6 +188,7 @@ Blockly.FieldAngle.prototype.showEditor_ = function() {
Blockly.DropDownDiv.clearContent();
var div = Blockly.DropDownDiv.getContentDiv();
// Build the SVG DOM.
var parentBlock = this.sourceBlock_.parentBlock_;
var svg = Blockly.utils.createSvgElement('svg', {
'xmlns': 'http://www.w3.org/2000/svg',
'xmlns:html': 'http://www.w3.org/1999/xhtml',
Expand All @@ -186,6 +200,8 @@ Blockly.FieldAngle.prototype.showEditor_ = function() {
Blockly.utils.createSvgElement('circle', {
'cx': Blockly.FieldAngle.HALF, 'cy': Blockly.FieldAngle.HALF,
'r': Blockly.FieldAngle.RADIUS,
'fill': parentBlock.getColourSecondary(),
'stroke': parentBlock.getColourTertiary(),
'class': 'blocklyAngleCircle'
}, svg);
this.gauge_ = Blockly.utils.createSvgElement('path',
Expand Down Expand Up @@ -231,24 +247,20 @@ Blockly.FieldAngle.prototype.showEditor_ = function() {
'r': Blockly.FieldAngle.HANDLE_RADIUS,
'class': 'blocklyAngleDragHandle'
}, this.handle_);
this.arrowSvg_ = Blockly.utils.createSvgElement('image',
this.arrowSvg_ = Blockly.utils.createSvgElement('path',
{
'width': Blockly.FieldAngle.ARROW_WIDTH,
'height': Blockly.FieldAngle.ARROW_WIDTH,
'x': -Blockly.FieldAngle.ARROW_WIDTH / 2,
'y': -Blockly.FieldAngle.ARROW_WIDTH / 2,
'class': 'blocklyAngleDragArrow'
'class': 'blocklyAngleDragArrow',
'fill': parentBlock.getColour(),
'd': Blockly.FieldAngle.ARROW_SVG_PATH_DATA
},
this.handle_);
this.arrowSvg_.setAttributeNS(
'http://www.w3.org/1999/xlink',
'xlink:href',
Blockly.mainWorkspace.options.pathToMedia + Blockly.FieldAngle.ARROW_SVG_PATH
);

Blockly.DropDownDiv.setColour(this.sourceBlock_.parentBlock_.getColour(),
this.sourceBlock_.getColourTertiary());
Blockly.DropDownDiv.setCategory(this.sourceBlock_.parentBlock_.getCategory());

Blockly.DropDownDiv.setColour(parentBlock.getColour(), this.sourceBlock_.getColourTertiary());
Blockly.DropDownDiv.setCategory(parentBlock.getCategory());
Blockly.DropDownDiv.showPositionedByBlock(this, this.sourceBlock_);

this.mouseDownWrapper_ =
Expand Down