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

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 // After editing, the options are valid, but the scene was in a different panel or inline editing mode has changed
const shouldUpdateSceneAndPanel = const shouldUpdateSceneAndPanel = this.needsReload && this.props.options !== nextProps.options;
(this.needsReload && this.props.options !== nextProps.options) || const inlineEditingSwitched = this.props.options.inlineEditing !== nextProps.options.inlineEditing;
this.props.options.inlineEditing !== nextProps.options.inlineEditing; if (shouldUpdateSceneAndPanel || inlineEditingSwitched) {
if (shouldUpdateSceneAndPanel) {
this.needsReload = false; this.needsReload = false;
this.scene.load(nextProps.options.root, nextProps.options.inlineEditing); this.scene.load(nextProps.options.root, nextProps.options.inlineEditing);
this.scene.updateSize(nextProps.width, nextProps.height); this.scene.updateSize(nextProps.width, nextProps.height);
this.scene.updateData(nextProps.data); this.scene.updateData(nextProps.data);
changed = true; changed = true;
if (this.props.options.inlineEditing) { if (inlineEditingSwitched && this.props.options.inlineEditing) {
this.scene.selecto?.destroy(); this.scene.selecto?.destroy();
} }
} }