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
890d8d8d
Commit
890d8d8d
authored
Sep 22, 2015
by
Neil Fraser
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix zoom center button. Reverse disconnect wiggle.
parent
34f4b067
Changes
5
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
44 additions
and
30 deletions
+44
-30
blockly_compressed.js
blockly_compressed.js
+17
-17
core/block_svg.js
core/block_svg.js
+8
-5
core/field.js
core/field.js
+3
-2
core/workspace_svg.js
core/workspace_svg.js
+12
-4
core/zoom_controls.js
core/zoom_controls.js
+4
-2
No files found.
blockly_compressed.js
View file @
890d8d8d
This diff is collapsed.
Click to expand it.
core/block_svg.js
View file @
890d8d8d
...
@@ -706,9 +706,7 @@ Blockly.BlockSvg.prototype.onMouseMove_ = function(e) {
...
@@ -706,9 +706,7 @@ Blockly.BlockSvg.prototype.onMouseMove_ = function(e) {
if
(
this_
.
parentBlock_
)
{
if
(
this_
.
parentBlock_
)
{
// Push this block to the very top of the stack.
// Push this block to the very top of the stack.
this_
.
setParent
(
null
);
this_
.
setParent
(
null
);
if
(
workspace_
.
scale
>=
1
)
{
this_
.
disconnectUiEffect
();
this_
.
disconnectUiEffect
();
}
}
}
this_
.
setDragging_
(
true
);
this_
.
setDragging_
(
true
);
workspace_
.
recordDeleteAreas
();
workspace_
.
recordDeleteAreas
();
...
@@ -1097,7 +1095,9 @@ Blockly.BlockSvg.disposeUiStep_ = function(clone, rtl, start, workspaceScale) {
...
@@ -1097,7 +1095,9 @@ Blockly.BlockSvg.disposeUiStep_ = function(clone, rtl, start, workspaceScale) {
*/
*/
Blockly
.
BlockSvg
.
prototype
.
connectionUiEffect
=
function
()
{
Blockly
.
BlockSvg
.
prototype
.
connectionUiEffect
=
function
()
{
this
.
workspace
.
playAudio
(
'
click
'
);
this
.
workspace
.
playAudio
(
'
click
'
);
if
(
this
.
workspace
.
scale
<
1
)
{
return
;
// Too small to care about visual effects.
}
// Determine the absolute coordinates of the inferior block.
// Determine the absolute coordinates of the inferior block.
var
xy
=
Blockly
.
getSvgXY_
(
/** @type {!Element} */
(
this
.
svgGroup_
),
var
xy
=
Blockly
.
getSvgXY_
(
/** @type {!Element} */
(
this
.
svgGroup_
),
this
.
workspace
);
this
.
workspace
);
...
@@ -1144,12 +1144,15 @@ Blockly.BlockSvg.connectionUiStep_ = function(ripple, start, workspaceScale) {
...
@@ -1144,12 +1144,15 @@ Blockly.BlockSvg.connectionUiStep_ = function(ripple, start, workspaceScale) {
*/
*/
Blockly
.
BlockSvg
.
prototype
.
disconnectUiEffect
=
function
()
{
Blockly
.
BlockSvg
.
prototype
.
disconnectUiEffect
=
function
()
{
this
.
workspace
.
playAudio
(
'
disconnect
'
);
this
.
workspace
.
playAudio
(
'
disconnect
'
);
if
(
this
.
workspace
.
scale
<
1
)
{
return
;
// Too small to care about visual effects.
}
// Horizontal distance for bottom of block to wiggle.
// Horizontal distance for bottom of block to wiggle.
var
DISPLACEMENT
=
10
;
var
DISPLACEMENT
=
10
;
// Scale magnitude of skew to height of block.
// Scale magnitude of skew to height of block.
var
height
=
this
.
getHeightWidth
().
height
;
var
height
=
this
.
getHeightWidth
().
height
;
var
magnitude
=
Math
.
atan
(
DISPLACEMENT
/
height
)
/
Math
.
PI
*
180
;
var
magnitude
=
Math
.
atan
(
DISPLACEMENT
/
height
)
/
Math
.
PI
*
180
;
if
(
this
.
RTL
)
{
if
(
!
this
.
RTL
)
{
magnitude
*=
-
1
;
magnitude
*=
-
1
;
}
}
// Start the animation.
// Start the animation.
...
...
core/field.js
View file @
890d8d8d
...
@@ -113,9 +113,10 @@ Blockly.Field.prototype.init = function(block) {
...
@@ -113,9 +113,10 @@ Blockly.Field.prototype.init = function(block) {
'
x
'
:
-
Blockly
.
BlockSvg
.
SEP_SPACE_X
/
2
,
'
x
'
:
-
Blockly
.
BlockSvg
.
SEP_SPACE_X
/
2
,
'
y
'
:
0
,
'
y
'
:
0
,
'
height
'
:
16
},
this
.
fieldGroup_
,
this
.
sourceBlock_
.
workspace
);
'
height
'
:
16
},
this
.
fieldGroup_
,
this
.
sourceBlock_
.
workspace
);
/** @type {Element} */
/** @type {
!
Element} */
this
.
textElement_
=
Blockly
.
createSvgElement
(
'
text
'
,
this
.
textElement_
=
Blockly
.
createSvgElement
(
'
text
'
,
{
'
class
'
:
'
blocklyText
'
,
'
y
'
:
this
.
size_
.
height
-
12.5
},
this
.
fieldGroup_
);
{
'
class
'
:
'
blocklyText
'
,
'
y
'
:
this
.
size_
.
height
-
12.5
},
this
.
fieldGroup_
);
this
.
updateEditable
();
this
.
updateEditable
();
block
.
getSvgRoot
().
appendChild
(
this
.
fieldGroup_
);
block
.
getSvgRoot
().
appendChild
(
this
.
fieldGroup_
);
...
...
core/workspace_svg.js
View file @
890d8d8d
...
@@ -913,18 +913,26 @@ Blockly.WorkspaceSvg.prototype.zoomCenter = function(type) {
...
@@ -913,18 +913,26 @@ Blockly.WorkspaceSvg.prototype.zoomCenter = function(type) {
/**
/**
* Reset zooming and dragging.
* Reset zooming and dragging.
* @param {!Event} e Mouse down event.
*/
*/
Blockly
.
WorkspaceSvg
.
prototype
.
zoomReset
=
function
()
{
Blockly
.
WorkspaceSvg
.
prototype
.
zoomReset
=
function
(
e
)
{
this
.
scale
=
1
;
this
.
scale
=
1
;
this
.
updateGridPattern_
();
this
.
updateGridPattern_
();
var
metrics
=
this
.
getMetrics
();
this
.
scrollbar
.
set
((
metrics
.
contentWidth
-
metrics
.
viewWidth
)
/
2
,
(
metrics
.
contentHeight
-
metrics
.
viewHeight
)
/
2
);
Blockly
.
hideChaff
(
false
);
Blockly
.
hideChaff
(
false
);
if
(
this
.
flyout_
)
{
if
(
this
.
flyout_
)
{
// No toolbox, resize flyout.
// No toolbox, resize flyout.
this
.
flyout_
.
reflow
();
this
.
flyout_
.
reflow
();
}
}
// Center the workspace once the scaling has had a chance to take effect.
var
thisWorkspace
=
this
;
var
scroll
=
function
()
{
var
metrics
=
thisWorkspace
.
getMetrics
();
thisWorkspace
.
scrollbar
.
set
((
metrics
.
contentWidth
-
metrics
.
viewWidth
)
/
2
,
(
metrics
.
contentHeight
-
metrics
.
viewHeight
)
/
2
);
};
setTimeout
(
scroll
,
0
);
// This event has been handled. No need to bubble up to the document.
e
.
stopPropagation
();
};
};
/**
/**
...
...
core/zoom_controls.js
View file @
890d8d8d
...
@@ -163,11 +163,13 @@ Blockly.ZoomControls.prototype.createDom = function() {
...
@@ -163,11 +163,13 @@ Blockly.ZoomControls.prototype.createDom = function() {
// Attach event listeners.
// Attach event listeners.
Blockly
.
bindEvent_
(
zoomresetSvg
,
'
mousedown
'
,
workspace
,
workspace
.
zoomReset
);
Blockly
.
bindEvent_
(
zoomresetSvg
,
'
mousedown
'
,
workspace
,
workspace
.
zoomReset
);
Blockly
.
bindEvent_
(
zoominSvg
,
'
mousedown
'
,
null
,
function
()
{
Blockly
.
bindEvent_
(
zoominSvg
,
'
mousedown
'
,
null
,
function
(
e
)
{
workspace
.
zoomCenter
(
1
);
workspace
.
zoomCenter
(
1
);
e
.
stopPropagation
();
// Don't start a workspace scroll.
});
});
Blockly
.
bindEvent_
(
zoomoutSvg
,
'
mousedown
'
,
null
,
function
()
{
Blockly
.
bindEvent_
(
zoomoutSvg
,
'
mousedown
'
,
null
,
function
(
e
)
{
workspace
.
zoomCenter
(
-
1
);
workspace
.
zoomCenter
(
-
1
);
e
.
stopPropagation
();
// Don't start a workspace scroll.
});
});
return
this
.
svgGroup_
;
return
this
.
svgGroup_
;
...
...
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