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
244a3cce
Commit
244a3cce
authored
Dec 03, 2014
by
Neil Fraser
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow scrollbars without categories.
parent
ad7d0a13
Changes
2
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
41 additions
and
44 deletions
+41
-44
blockly_compressed.js
blockly_compressed.js
+23
-23
core/inject.js
core/inject.js
+18
-21
No files found.
blockly_compressed.js
View file @
244a3cce
This diff is collapsed.
Click to expand it.
core/inject.js
View file @
244a3cce
...
...
@@ -117,14 +117,9 @@ Blockly.parseOptions_ = function(options) {
hasDisable
=
hasCategories
;
}
}
if
(
tree
&&
!
hasCategories
)
{
// Scrollbars are not compatible with a non-flyout toolbox.
var
hasScrollbars
=
false
;
}
else
{
var
hasScrollbars
=
options
[
'
scrollbars
'
];
if
(
hasScrollbars
===
undefined
)
{
hasScrollbars
=
true
;
}
var
hasScrollbars
=
options
[
'
scrollbars
'
];
if
(
hasScrollbars
===
undefined
)
{
hasScrollbars
=
hasCategories
;
}
var
hasSounds
=
options
[
'
sounds
'
];
if
(
hasSounds
===
undefined
)
{
...
...
@@ -287,42 +282,44 @@ Blockly.createDom_ = function(container) {
flyout
.
autoClose
=
false
;
// Insert the flyout behind the workspace so that blocks appear on top.
goog
.
dom
.
insertSiblingBefore
(
flyoutSvg
,
Blockly
.
mainWorkspace
.
svgGroup_
);
}
if
(
!
Blockly
.
hasScrollbars
)
{
var
workspaceChanged
=
function
()
{
if
(
Blockly
.
Block
.
dragMode_
==
0
)
{
var
metrics
=
Blockly
.
mainWorkspace
.
getMetrics
();
if
(
metrics
.
contentTop
<
0
||
var
edgeLeft
=
metrics
.
viewLeft
+
metrics
.
absoluteLeft
;
var
edgeTop
=
metrics
.
viewTop
+
metrics
.
absoluteTop
;
if
(
metrics
.
contentTop
<
edgeTop
||
metrics
.
contentTop
+
metrics
.
contentHeight
>
metrics
.
viewHeight
+
metrics
.
viewTop
||
metrics
.
contentLeft
<
(
Blockly
.
RTL
?
metrics
.
viewLeft
:
0
)
||
metrics
.
viewHeight
+
edgeTop
||
metrics
.
contentLeft
<
(
Blockly
.
RTL
?
metrics
.
viewLeft
:
edgeLeft
)
||
metrics
.
contentLeft
+
metrics
.
contentWidth
>
(
Blockly
.
RTL
?
metrics
.
viewWidth
:
metrics
.
viewWidth
+
metrics
.
viewLeft
))
{
// One or more blocks is out of bounds. Bump them back in.
metrics
.
viewWidth
:
metrics
.
viewWidth
+
edgeLeft
))
{
// One or more blocks may be out of bounds. Bump them back in.
var
MARGIN
=
25
;
var
blocks
=
Blockly
.
mainWorkspace
.
getTopBlocks
(
false
);
for
(
var
b
=
0
,
block
;
block
=
blocks
[
b
];
b
++
)
{
var
blockXY
=
block
.
getRelativeToSurfaceXY
();
var
blockHW
=
block
.
getHeightWidth
();
// Bump any block that's above the top back inside.
var
overflow
=
metrics
.
viewTop
+
MARGIN
-
blockHW
.
height
-
blockXY
.
y
;
var
overflow
=
edgeTop
+
MARGIN
-
blockHW
.
height
-
blockXY
.
y
;
if
(
overflow
>
0
)
{
block
.
moveBy
(
0
,
overflow
);
}
// Bump any block that's below the bottom back inside.
var
overflow
=
metrics
.
viewTop
+
metrics
.
viewHeight
-
MARGIN
-
blockXY
.
y
;
var
overflow
=
edgeTop
+
metrics
.
viewHeight
-
MARGIN
-
blockXY
.
y
;
if
(
overflow
<
0
)
{
block
.
moveBy
(
0
,
overflow
);
}
// Bump any block that's off the left back inside.
var
overflow
=
MARGIN
+
metrics
.
viewLeft
-
blockXY
.
x
-
(
Blockly
.
RTL
?
0
:
blockHW
.
width
);
var
overflow
=
MARGIN
+
edgeLeft
-
blockXY
.
x
-
(
Blockly
.
RTL
?
0
:
blockHW
.
width
);
if
(
overflow
>
0
)
{
block
.
moveBy
(
overflow
,
0
);
}
// Bump any block that's off the right back inside.
var
overflow
=
metrics
.
view
Left
+
metrics
.
viewWidth
-
MARGIN
-
var
overflow
=
edge
Left
+
metrics
.
viewWidth
-
MARGIN
-
blockXY
.
x
+
(
Blockly
.
RTL
?
blockHW
.
width
:
0
);
if
(
overflow
<
0
)
{
block
.
moveBy
(
overflow
,
0
);
...
...
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