Canvas: Fix selecto breaking on enter / exit panel edit mode (#48387)

This commit is contained in:
Nathan Marrs 2022-04-27 20:51:02 -07:00 committed by GitHub
parent 3ae90efda2
commit b990d3c9e3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -113,17 +113,16 @@ export class CanvasPanel extends Component<Props, State> {
}
// After editing, the options are valid, but the scene was in a different panel or inline editing mode has changed
const shouldUpdateSceneAndPanel =
(this.needsReload && this.props.options !== nextProps.options) ||
this.props.options.inlineEditing !== nextProps.options.inlineEditing;
if (shouldUpdateSceneAndPanel) {
const shouldUpdateSceneAndPanel = this.needsReload && this.props.options !== nextProps.options;
const inlineEditingSwitched = this.props.options.inlineEditing !== nextProps.options.inlineEditing;
if (shouldUpdateSceneAndPanel || inlineEditingSwitched) {
this.needsReload = false;
this.scene.load(nextProps.options.root, nextProps.options.inlineEditing);
this.scene.updateSize(nextProps.width, nextProps.height);
this.scene.updateData(nextProps.data);
changed = true;
if (this.props.options.inlineEditing) {
if (inlineEditingSwitched && this.props.options.inlineEditing) {
this.scene.selecto?.destroy();
}
}