diff --git a/public/app/features/canvas/runtime/frame.tsx b/public/app/features/canvas/runtime/frame.tsx index d09be5d7af5..cd1e1364d58 100644 --- a/public/app/features/canvas/runtime/frame.tsx +++ b/public/app/features/canvas/runtime/frame.tsx @@ -89,7 +89,7 @@ export class FrameState extends ElementState { reinitializeMoveable() { // Need to first clear current selection and then re-init moveable with slight delay this.scene.clearCurrentSelection(); - setTimeout(() => this.scene.initMoveable(true, this.scene.isEditingEnabled), 100); + setTimeout(() => this.scene.initMoveable(true, this.scene.isEditingEnabled)); } // ??? or should this be on the element directly? diff --git a/public/app/features/canvas/runtime/scene.tsx b/public/app/features/canvas/runtime/scene.tsx index e86919a43c6..32719381ca6 100644 --- a/public/app/features/canvas/runtime/scene.tsx +++ b/public/app/features/canvas/runtime/scene.tsx @@ -106,7 +106,7 @@ export class Scene { this.currentLayer = this.root; this.selection.next([]); } - }, 100); + }); return this.root; } @@ -226,7 +226,7 @@ export class Scene { if (this.div) { this.initMoveable(true, this.isEditingEnabled); } - }, 100); + }); } }; diff --git a/public/app/plugins/panel/canvas/editor/PlacementEditor.tsx b/public/app/plugins/panel/canvas/editor/PlacementEditor.tsx index 1080cd38179..81cbc37e423 100644 --- a/public/app/plugins/panel/canvas/editor/PlacementEditor.tsx +++ b/public/app/plugins/panel/canvas/editor/PlacementEditor.tsx @@ -48,6 +48,12 @@ export const PlacementEditor: FC { + setTimeout(() => { + settings.scene.select({ targets: [element.div!] }); + }); + }; + const onHorizontalConstraintSelect = (h: SelectableValue) => { onHorizontalConstraintChange(h.value!); }; @@ -57,6 +63,7 @@ export const PlacementEditor: FC) => { @@ -68,16 +75,14 @@ export const PlacementEditor: FC { element.options.placement![placement] = value ?? element.options.placement![placement]; element.applyLayoutStylesToDiv(); settings.scene.clearCurrentSelection(true); - // TODO: This needs to have a better sync method with where div is - setTimeout(() => { - settings.scene.select({ targets: [element.div!] }); - }, 100); + reselectElementAfterChange(); }; const constraint = element.tempConstraint ?? layout ?? {};