mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Canvas: Stop selecto box from triggering when programmatically selecting elements (#51579)
Co-authored-by: Ryan McKinley <ryantxu@gmail.com>
This commit is contained in:
@@ -394,8 +394,12 @@ export class Scene {
|
||||
this.moveable!.isMoveableElement(selectedTarget) ||
|
||||
targets.some((target) => target === selectedTarget || target.contains(selectedTarget));
|
||||
|
||||
if (isTargetMoveableElement) {
|
||||
// Prevent drawing selection box when selected target is a moveable element
|
||||
const isTargetAlreadySelected = this.selecto
|
||||
?.getSelectedTargets()
|
||||
.includes(selectedTarget.parentElement.parentElement);
|
||||
|
||||
if (isTargetMoveableElement || isTargetAlreadySelected) {
|
||||
// Prevent drawing selection box when selected target is a moveable element or already selected
|
||||
event.stop();
|
||||
}
|
||||
}).on('selectEnd', (event) => {
|
||||
|
||||
@@ -48,7 +48,7 @@ export class LayerElementListEditor extends PureComponent<Props> {
|
||||
layer.reinitializeMoveable();
|
||||
};
|
||||
|
||||
onSelect = (item: any) => {
|
||||
onSelect = (item: ElementState) => {
|
||||
const { settings } = this.props.item;
|
||||
|
||||
if (settings?.scene) {
|
||||
|
||||
Reference in New Issue
Block a user