mirror of
https://github.com/google/blockly.git
synced 2026-01-07 09:00:11 +01:00
fix: throwing errors for chameleon blocks (#8121)
This commit is contained in:
@@ -113,13 +113,11 @@ export class InsertionMarkerPreviewer implements IConnectionPreviewer {
|
|||||||
private previewMarker(
|
private previewMarker(
|
||||||
draggedConn: RenderedConnection,
|
draggedConn: RenderedConnection,
|
||||||
staticConn: RenderedConnection,
|
staticConn: RenderedConnection,
|
||||||
): RenderedConnection {
|
): RenderedConnection | null {
|
||||||
const dragged = draggedConn.getSourceBlock();
|
const dragged = draggedConn.getSourceBlock();
|
||||||
const marker = this.createInsertionMarker(dragged);
|
const marker = this.createInsertionMarker(dragged);
|
||||||
const markerConn = this.getMatchingConnection(dragged, marker, draggedConn);
|
const markerConn = this.getMatchingConnection(dragged, marker, draggedConn);
|
||||||
if (!markerConn) {
|
if (!markerConn) return null;
|
||||||
throw Error('Could not create insertion marker to preview connection');
|
|
||||||
}
|
|
||||||
|
|
||||||
// Render disconnected from everything else so that we have a valid
|
// Render disconnected from everything else so that we have a valid
|
||||||
// connection location.
|
// connection location.
|
||||||
@@ -192,7 +190,7 @@ export class InsertionMarkerPreviewer implements IConnectionPreviewer {
|
|||||||
orig: BlockSvg,
|
orig: BlockSvg,
|
||||||
marker: BlockSvg,
|
marker: BlockSvg,
|
||||||
origConn: RenderedConnection,
|
origConn: RenderedConnection,
|
||||||
) {
|
): RenderedConnection | null {
|
||||||
const origConns = orig.getConnections_(true);
|
const origConns = orig.getConnections_(true);
|
||||||
const markerConns = marker.getConnections_(true);
|
const markerConns = marker.getConnections_(true);
|
||||||
if (origConns.length !== markerConns.length) return null;
|
if (origConns.length !== markerConns.length) return null;
|
||||||
|
|||||||
Reference in New Issue
Block a user