mirror of
https://github.com/google/blockly.git
synced 2025-12-16 06:10:12 +01:00
@@ -179,18 +179,18 @@ export class InsertionMarkerManager {
|
||||
*/
|
||||
applyConnections() {
|
||||
if (!this.activeCandidate) return;
|
||||
const {local, closest} = this.activeCandidate;
|
||||
local.connect(closest);
|
||||
eventUtils.disable();
|
||||
this.hidePreview();
|
||||
eventUtils.enable();
|
||||
const {local, closest} = this.activeCandidate;
|
||||
local.connect(closest);
|
||||
if (this.topBlock.rendered) {
|
||||
const inferiorConnection = local.isSuperior() ? closest : local;
|
||||
blockAnimations.connectionUiEffect(inferiorConnection.getSourceBlock());
|
||||
const rootBlock = this.topBlock.getRootBlock();
|
||||
|
||||
// bringToFront is incredibly expensive. Delay by at least a frame.
|
||||
requestAnimationFrame(() => {
|
||||
blockAnimations.connectionUiEffect(inferiorConnection.getSourceBlock());
|
||||
setTimeout(() => {
|
||||
rootBlock.bringToFront();
|
||||
}, 0);
|
||||
|
||||
@@ -55,6 +55,7 @@ function doRenders() {
|
||||
|
||||
renderBlock(block);
|
||||
updateConnectionLocations(block, block.getRelativeToSurfaceXY());
|
||||
updateIconLocations(block);
|
||||
}
|
||||
for (const workspace of workspaces) {
|
||||
workspace.resizeContents();
|
||||
@@ -98,3 +99,19 @@ function updateConnectionLocations(block: BlockSvg, blockOrigin: Coordinate) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates all icons that are children of the given block with their new
|
||||
* locations.
|
||||
*
|
||||
* @param block The block to update the icon locations of.
|
||||
*/
|
||||
function updateIconLocations(block: BlockSvg) {
|
||||
if (!block.getIcons) return;
|
||||
for (const icon of block.getIcons()) {
|
||||
icon.computeIconLocation();
|
||||
}
|
||||
for (const child of block.getChildren(false)) {
|
||||
updateIconLocations(child);
|
||||
}
|
||||
}
|
||||
|
||||
4
package-lock.json
generated
4
package-lock.json
generated
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "blockly",
|
||||
"version": "9.3.2",
|
||||
"version": "9.3.3",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "blockly",
|
||||
"version": "9.3.2",
|
||||
"version": "9.3.3",
|
||||
"hasInstallScript": true,
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "blockly",
|
||||
"version": "9.3.2",
|
||||
"version": "9.3.3",
|
||||
"description": "Blockly is a library for building visual programming editors.",
|
||||
"keywords": [
|
||||
"blockly"
|
||||
|
||||
Reference in New Issue
Block a user