mirror of
https://github.com/google/blockly.git
synced 2026-01-04 23:50:12 +01:00
fix: Fix unsafe cast in Input.setVisible(). (#8695)
This commit is contained in:
@@ -20,7 +20,7 @@ import type {Connection} from '../connection.js';
|
|||||||
import type {ConnectionType} from '../connection_type.js';
|
import type {ConnectionType} from '../connection_type.js';
|
||||||
import type {Field} from '../field.js';
|
import type {Field} from '../field.js';
|
||||||
import * as fieldRegistry from '../field_registry.js';
|
import * as fieldRegistry from '../field_registry.js';
|
||||||
import type {RenderedConnection} from '../rendered_connection.js';
|
import {RenderedConnection} from '../rendered_connection.js';
|
||||||
import {Align} from './align.js';
|
import {Align} from './align.js';
|
||||||
import {inputTypes} from './input_types.js';
|
import {inputTypes} from './input_types.js';
|
||||||
|
|
||||||
@@ -181,15 +181,14 @@ export class Input {
|
|||||||
for (let y = 0, field; (field = this.fieldRow[y]); y++) {
|
for (let y = 0, field; (field = this.fieldRow[y]); y++) {
|
||||||
field.setVisible(visible);
|
field.setVisible(visible);
|
||||||
}
|
}
|
||||||
if (this.connection) {
|
if (this.connection && this.connection instanceof RenderedConnection) {
|
||||||
const renderedConnection = this.connection as RenderedConnection;
|
|
||||||
// Has a connection.
|
// Has a connection.
|
||||||
if (visible) {
|
if (visible) {
|
||||||
renderList = renderedConnection.startTrackingAll();
|
renderList = this.connection.startTrackingAll();
|
||||||
} else {
|
} else {
|
||||||
renderedConnection.stopTrackingAll();
|
this.connection.stopTrackingAll();
|
||||||
}
|
}
|
||||||
const child = renderedConnection.targetBlock();
|
const child = this.connection.targetBlock();
|
||||||
if (child) {
|
if (child) {
|
||||||
child.getSvgRoot().style.display = visible ? 'block' : 'none';
|
child.getSvgRoot().style.display = visible ? 'block' : 'none';
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user