From 86971b1b30a52d31b4c531b3bd7683454280b90e Mon Sep 17 00:00:00 2001 From: Nathan Marrs Date: Wed, 27 Apr 2022 21:09:27 -0700 Subject: [PATCH] Fix layer action / constraint change adhering to inline editing state (#48390) --- public/app/features/canvas/runtime/group.tsx | 2 +- public/app/features/canvas/runtime/scene.tsx | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/public/app/features/canvas/runtime/group.tsx b/public/app/features/canvas/runtime/group.tsx index 91e1c6a6510..35d38155a90 100644 --- a/public/app/features/canvas/runtime/group.tsx +++ b/public/app/features/canvas/runtime/group.tsx @@ -77,7 +77,7 @@ export class GroupState 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), 100); + setTimeout(() => this.scene.initMoveable(true, this.scene.isEditingEnabled), 100); } // ??? 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 d16e63f89db..41db45e95a6 100644 --- a/public/app/features/canvas/runtime/scene.tsx +++ b/public/app/features/canvas/runtime/scene.tsx @@ -52,6 +52,7 @@ export class Scene { moveable?: Moveable; div?: HTMLDivElement; currentLayer?: GroupState; + isEditingEnabled?: boolean; constructor(cfg: CanvasGroupOptions, enableEditing: boolean, public onSave: (cfg: CanvasGroupOptions) => void) { this.root = this.load(cfg, enableEditing); @@ -86,6 +87,8 @@ export class Scene { this.save // callback when changes are made ); + this.isEditingEnabled = enableEditing; + setTimeout(() => { if (this.div) { // If editing is enabled, clear selecto instance @@ -165,7 +168,7 @@ export class Scene { if (updateMoveable) { setTimeout(() => { if (this.div) { - this.initMoveable(true); + this.initMoveable(true, this.isEditingEnabled); } }, 100); }