Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
ardublockly
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
xpstem
ardublockly
Commits
90e3ccb2
Commit
90e3ccb2
authored
Oct 04, 2015
by
Neil Fraser
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add Blockly.BlockSvg.START_HAT option.
parent
b9929573
Changes
2
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
46 additions
and
11 deletions
+46
-11
blockly_compressed.js
blockly_compressed.js
+12
-11
core/block_svg.js
core/block_svg.js
+34
-0
No files found.
blockly_compressed.js
View file @
90e3ccb2
This diff is collapsed.
Click to expand it.
core/block_svg.js
View file @
90e3ccb2
...
...
@@ -851,6 +851,28 @@ Blockly.BlockSvg.NOTCH_WIDTH = 30;
* @const
*/
Blockly
.
BlockSvg
.
CORNER_RADIUS
=
8
;
/**
* Do blocks with no previous or output connections have a 'hat' on top?
* @const
*/
Blockly
.
BlockSvg
.
START_HAT
=
false
;
/**
* Path of the top hat's curve.
* @const
*/
Blockly
.
BlockSvg
.
START_HAT_PATH
=
'
c 30,-15 70,-15 100,0
'
;
/**
* Path of the top hat's curve's highlight in LTR.
* @const
*/
Blockly
.
BlockSvg
.
START_HAT_HIGHLIGHT_LTR
=
'
c 17.8,-9.2 45.3,-14.9 75,-8.7 M 100.5,0.5
'
;
/**
* Path of the top hat's curve's highlight in RTL.
* @const
*/
Blockly
.
BlockSvg
.
START_HAT_HIGHLIGHT_RTL
=
'
m 25,-8.7 c 29.7,-6.2 57.2,-0.5 75,8.7
'
;
/**
* Distance from shape edge to intersect with a curved corner at 45 degrees.
* Applies to highlighting on around the inside of a curve.
...
...
@@ -1704,6 +1726,7 @@ Blockly.BlockSvg.prototype.renderCompute_ = function(iconWidth) {
* @private
*/
Blockly
.
BlockSvg
.
prototype
.
renderDraw_
=
function
(
iconWidth
,
inputRows
)
{
this
.
startHat_
=
false
;
// Should the top and bottom left corners be rounded or square?
if
(
this
.
outputConnection
)
{
this
.
squareTopLeftCorner_
=
true
;
...
...
@@ -1717,6 +1740,11 @@ Blockly.BlockSvg.prototype.renderDraw_ = function(iconWidth, inputRows) {
if
(
prevBlock
&&
prevBlock
.
getNextBlock
()
==
this
)
{
this
.
squareTopLeftCorner_
=
true
;
}
}
else
if
(
Blockly
.
BlockSvg
.
START_HAT
)
{
// No output or previous connection.
this
.
squareTopLeftCorner_
=
true
;
this
.
startHat_
=
true
;
inputRows
.
rightEdge
=
Math
.
max
(
inputRows
.
rightEdge
,
100
);
}
var
nextBlock
=
this
.
getNextBlock
();
if
(
nextBlock
)
{
...
...
@@ -1771,6 +1799,12 @@ Blockly.BlockSvg.prototype.renderDrawTop_ =
if
(
this
.
squareTopLeftCorner_
)
{
steps
.
push
(
'
m 0,0
'
);
highlightSteps
.
push
(
'
m 0.5,0.5
'
);
if
(
this
.
startHat_
)
{
steps
.
push
(
Blockly
.
BlockSvg
.
START_HAT_PATH
);
highlightSteps
.
push
(
this
.
RTL
?
Blockly
.
BlockSvg
.
START_HAT_HIGHLIGHT_RTL
:
Blockly
.
BlockSvg
.
START_HAT_HIGHLIGHT_LTR
);
}
}
else
{
steps
.
push
(
Blockly
.
BlockSvg
.
TOP_LEFT_CORNER_START
);
highlightSteps
.
push
(
this
.
RTL
?
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment