From 48e757ff876e630ce17726a42dcc22d1c3b116a7 Mon Sep 17 00:00:00 2001 From: Nathan Marrs Date: Tue, 12 Jul 2022 07:22:16 -0700 Subject: [PATCH] Canvas: Show constraints on element drag #52074 --- public/app/features/canvas/runtime/ables.tsx | 7 ++----- public/app/features/canvas/runtime/element.tsx | 3 --- public/app/features/canvas/runtime/scene.tsx | 7 ------- 3 files changed, 2 insertions(+), 15 deletions(-) diff --git a/public/app/features/canvas/runtime/ables.tsx b/public/app/features/canvas/runtime/ables.tsx index 621e3afba8e..ae19c84f87a 100644 --- a/public/app/features/canvas/runtime/ables.tsx +++ b/public/app/features/canvas/runtime/ables.tsx @@ -44,11 +44,8 @@ export const constraintViewable = (scene: Scene) => ({ const rect = moveable.getRect(); const targetElement = scene.findElementByTarget(moveable.state.target); - // If target is currently in motion or selection is more than 1 element don't display constraint visualizations - if ( - targetElement?.isMoving || - (scene.selecto?.getSelectedTargets() && scene.selecto?.getSelectedTargets().length > 1) - ) { + // If selection is more than 1 element don't display constraint visualizations + if (scene.selecto?.getSelectedTargets() && scene.selecto?.getSelectedTargets().length > 1) { return; } diff --git a/public/app/features/canvas/runtime/element.tsx b/public/app/features/canvas/runtime/element.tsx index cbc912264f2..3f9b2d95ae3 100644 --- a/public/app/features/canvas/runtime/element.tsx +++ b/public/app/features/canvas/runtime/element.tsx @@ -26,9 +26,6 @@ export class ElementState implements LayerElement { sizeStyle: CSSProperties = {}; dataStyle: CSSProperties = {}; - // Determine whether or not element is in motion or not (via moveable) - isMoving = false; - // Temp stored constraint for visualization purposes (switch to top / left constraint to simplify some functionality) tempConstraint: Constraint | undefined; diff --git a/public/app/features/canvas/runtime/scene.tsx b/public/app/features/canvas/runtime/scene.tsx index 0bec916d8a7..f9845333e34 100644 --- a/public/app/features/canvas/runtime/scene.tsx +++ b/public/app/features/canvas/runtime/scene.tsx @@ -326,12 +326,6 @@ export class Scene { .on('clickGroup', (event) => { this.selecto!.clickTarget(event.inputEvent, event.inputTarget); }) - .on('dragStart', (event) => { - const targetedElement = this.findElementByTarget(event.target); - if (targetedElement) { - targetedElement.isMoving = true; - } - }) .on('drag', (event) => { const targetedElement = this.findElementByTarget(event.target); targetedElement!.applyDrag(event); @@ -346,7 +340,6 @@ export class Scene { const targetedElement = this.findElementByTarget(event.target); if (targetedElement) { targetedElement.setPlacementFromConstraint(); - targetedElement.isMoving = false; } this.moved.next(Date.now());