mirror of
https://github.com/google/blockly.git
synced 2026-01-08 01:20:12 +01:00
fix: widget positioning (#7507)
* chore: delete dead code * chore: moves location updating into the block * chore: change dragging to use update component locations * fix: field widgets not being moved when blocks are editted * chore: remove unnecessary resizeEditor_ calls * chore: format * chore: fix build * fix: tests * chore: PR comments * chore: format
This commit is contained in:
@@ -24,7 +24,6 @@ import * as internalConstants from './internal_constants.js';
|
||||
import {Coordinate} from './utils/coordinate.js';
|
||||
import * as dom from './utils/dom.js';
|
||||
import {Svg} from './utils/svg.js';
|
||||
import * as svgMath from './utils/svg_math.js';
|
||||
import * as svgPaths from './utils/svg_paths.js';
|
||||
|
||||
/** A shape that has a pathDown property. */
|
||||
@@ -270,27 +269,6 @@ export class RenderedConnection extends Connection {
|
||||
return this.offsetInBlock;
|
||||
}
|
||||
|
||||
/**
|
||||
* Move the blocks on either side of this connection right next to each other.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
tighten() {
|
||||
const dx = this.targetConnection!.x - this.x;
|
||||
const dy = this.targetConnection!.y - this.y;
|
||||
if (dx !== 0 || dy !== 0) {
|
||||
const block = this.targetBlock();
|
||||
const svgRoot = block!.getSvgRoot();
|
||||
if (!svgRoot) {
|
||||
throw Error('block is not rendered.');
|
||||
}
|
||||
// Workspace coordinates.
|
||||
const xy = svgMath.getRelativeXY(svgRoot);
|
||||
block!.translate(xy.x - dx, xy.y - dy);
|
||||
block!.moveConnections(-dx, -dy);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Moves the blocks on either side of this connection right next to
|
||||
* each other, based on their local offsets, not global positions.
|
||||
|
||||
Reference in New Issue
Block a user