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
4d2aac4f
Commit
4d2aac4f
authored
Mar 08, 2015
by
Neil Fraser
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bug-fixes to background grid.
parent
612b190e
Changes
6
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
23 additions
and
14 deletions
+23
-14
blockly_compressed.js
blockly_compressed.js
+7
-7
core/block.js
core/block.js
+5
-4
core/block_svg.js
core/block_svg.js
+9
-0
core/blockly.js
core/blockly.js
+1
-1
core/inject.js
core/inject.js
+0
-1
tests/playground.html
tests/playground.html
+1
-1
No files found.
blockly_compressed.js
View file @
4d2aac4f
This diff is collapsed.
Click to expand it.
core/block.js
View file @
4d2aac4f
...
@@ -295,14 +295,15 @@ Blockly.Block.prototype.getConnections_ = function(all) {
...
@@ -295,14 +295,15 @@ Blockly.Block.prototype.getConnections_ = function(all) {
* @private
* @private
*/
*/
Blockly
.
Block
.
prototype
.
bumpNeighbours_
=
function
()
{
Blockly
.
Block
.
prototype
.
bumpNeighbours_
=
function
()
{
if
(
!
this
.
workspace
)
{
return
;
// Deleted block.
}
if
(
Blockly
.
dragMode_
!=
0
)
{
if
(
Blockly
.
dragMode_
!=
0
)
{
// Don't bump blocks during a drag.
return
;
// Don't bump blocks during a drag.
return
;
}
}
var
rootBlock
=
this
.
getRootBlock
();
var
rootBlock
=
this
.
getRootBlock
();
if
(
rootBlock
.
isInFlyout
)
{
if
(
rootBlock
.
isInFlyout
)
{
// Don't move blocks around in a flyout.
return
;
// Don't move blocks around in a flyout.
return
;
}
}
// Loop though every connection on this block.
// Loop though every connection on this block.
var
myConnections
=
this
.
getConnections_
(
false
);
var
myConnections
=
this
.
getConnections_
(
false
);
...
...
core/block_svg.js
View file @
4d2aac4f
...
@@ -277,9 +277,18 @@ Blockly.BlockSvg.prototype.moveBy = function(dx, dy) {
...
@@ -277,9 +277,18 @@ Blockly.BlockSvg.prototype.moveBy = function(dx, dy) {
* @private
* @private
*/
*/
Blockly
.
BlockSvg
.
prototype
.
snapToGrid_
=
function
()
{
Blockly
.
BlockSvg
.
prototype
.
snapToGrid_
=
function
()
{
if
(
!
this
.
workspace
)
{
return
;
// Deleted block.
}
if
(
Blockly
.
dragMode_
!=
0
)
{
return
;
// Don't bump blocks during a drag.
}
if
(
this
.
getParent
())
{
if
(
this
.
getParent
())
{
return
;
// Only snap top-level blocks.
return
;
// Only snap top-level blocks.
}
}
if
(
this
.
isInFlyout
)
{
return
;
// Don't move blocks around in a flyout.
}
var
spacing
=
Blockly
.
gridOptions
[
'
spacing
'
];
var
spacing
=
Blockly
.
gridOptions
[
'
spacing
'
];
var
half
=
spacing
/
2
;
var
half
=
spacing
/
2
;
var
xy
=
this
.
getRelativeToSurfaceXY
();
var
xy
=
this
.
getRelativeToSurfaceXY
();
...
...
core/blockly.js
View file @
4d2aac4f
...
@@ -285,7 +285,7 @@ Blockly.onMouseDown_ = function(e) {
...
@@ -285,7 +285,7 @@ Blockly.onMouseDown_ = function(e) {
Blockly
.
selected
.
unselect
();
Blockly
.
selected
.
unselect
();
}
}
if
((
e
.
target
==
Blockly
.
svg
||
if
((
e
.
target
==
Blockly
.
svg
||
e
.
target
==
Blockly
.
mainWorkspace
.
svg
GridRect
_
)
&&
e
.
target
==
Blockly
.
mainWorkspace
.
svg
Background
_
)
&&
Blockly
.
isRightButton
(
e
))
{
Blockly
.
isRightButton
(
e
))
{
// Right-click on main workspace (not in a mutator).
// Right-click on main workspace (not in a mutator).
Blockly
.
showContextMenu_
(
e
);
Blockly
.
showContextMenu_
(
e
);
...
...
core/inject.js
View file @
4d2aac4f
...
@@ -146,7 +146,6 @@ Blockly.parseOptions_ = function(options) {
...
@@ -146,7 +146,6 @@ Blockly.parseOptions_ = function(options) {
}
else
{
}
else
{
grid
[
'
length
'
]
=
parseFloat
(
grid
[
'
length
'
]);
grid
[
'
length
'
]
=
parseFloat
(
grid
[
'
length
'
]);
}
}
grid
[
'
length
'
]
=
Math
.
min
(
grid
[
'
length
'
],
grid
[
'
spacing
'
]);
grid
[
'
snap
'
]
=
!!
grid
[
'
snap
'
];
grid
[
'
snap
'
]
=
!!
grid
[
'
snap
'
];
var
enableRealtime
=
!!
options
[
'
realtime
'
];
var
enableRealtime
=
!!
options
[
'
realtime
'
];
var
realtimeOptions
=
enableRealtime
?
options
[
'
realtimeOptions
'
]
:
undefined
;
var
realtimeOptions
=
enableRealtime
?
options
[
'
realtimeOptions
'
]
:
undefined
;
...
...
tests/playground.html
View file @
4d2aac4f
...
@@ -64,8 +64,8 @@ function start() {
...
@@ -64,8 +64,8 @@ function start() {
collapse
:
true
,
collapse
:
true
,
grid
:
grid
:
{
spacing
:
25
,
{
spacing
:
25
,
colour
:
'
#ccc
'
,
length
:
3
,
length
:
3
,
colour
:
'
#ccc
'
,
snap
:
true
},
snap
:
true
},
realtime
:
false
,
realtime
:
false
,
realtimeOptions
:
realtimeOptions
:
...
...
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