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:
parent
5d9ffe54ee
commit
66c911f263
@ -4581,7 +4581,7 @@ exports[`better eslint`] = {
|
|||||||
"public/app/features/canvas/runtime/root.tsx:2845174121": [
|
"public/app/features/canvas/runtime/root.tsx:2845174121": [
|
||||||
[24, 19, 36, "Do not use any type assertions.", "1413431594"]
|
[24, 19, 36, "Do not use any type assertions.", "1413431594"]
|
||||||
],
|
],
|
||||||
"public/app/features/canvas/runtime/scene.tsx:2490140997": [
|
"public/app/features/canvas/runtime/scene.tsx:4285479205": [
|
||||||
[155, 61, 25, "Do not use any type assertions.", "588553285"],
|
[155, 61, 25, "Do not use any type assertions.", "588553285"],
|
||||||
[160, 42, 25, "Do not use any type assertions.", "588553285"]
|
[160, 42, 25, "Do not use any type assertions.", "588553285"]
|
||||||
],
|
],
|
||||||
@ -10980,10 +10980,9 @@ exports[`better eslint`] = {
|
|||||||
[41, 64, 3, "Unexpected any. Specify a different type.", "193409811"],
|
[41, 64, 3, "Unexpected any. Specify a different type.", "193409811"],
|
||||||
[41, 69, 3, "Unexpected any. Specify a different type.", "193409811"]
|
[41, 69, 3, "Unexpected any. Specify a different type.", "193409811"]
|
||||||
],
|
],
|
||||||
"public/app/plugins/panel/canvas/editor/LayerElementListEditor.tsx:2866351070": [
|
"public/app/plugins/panel/canvas/editor/LayerElementListEditor.tsx:374041207": [
|
||||||
[21, 33, 3, "Unexpected any. Specify a different type.", "193409811"],
|
[21, 33, 3, "Unexpected any. Specify a different type.", "193409811"],
|
||||||
[40, 30, 44, "Do not use any type assertions.", "712744497"],
|
[40, 30, 44, "Do not use any type assertions.", "712744497"]
|
||||||
[50, 20, 3, "Unexpected any. Specify a different type.", "193409811"]
|
|
||||||
],
|
],
|
||||||
"public/app/plugins/panel/canvas/editor/PlacementEditor.tsx:1494111960": [
|
"public/app/plugins/panel/canvas/editor/PlacementEditor.tsx:1494111960": [
|
||||||
[33, 53, 3, "Unexpected any. Specify a different type.", "193409811"]
|
[33, 53, 3, "Unexpected any. Specify a different type.", "193409811"]
|
||||||
|
@ -394,8 +394,12 @@ export class Scene {
|
|||||||
this.moveable!.isMoveableElement(selectedTarget) ||
|
this.moveable!.isMoveableElement(selectedTarget) ||
|
||||||
targets.some((target) => target === selectedTarget || target.contains(selectedTarget));
|
targets.some((target) => target === selectedTarget || target.contains(selectedTarget));
|
||||||
|
|
||||||
if (isTargetMoveableElement) {
|
const isTargetAlreadySelected = this.selecto
|
||||||
// Prevent drawing selection box when selected target is a moveable element
|
?.getSelectedTargets()
|
||||||
|
.includes(selectedTarget.parentElement.parentElement);
|
||||||
|
|
||||||
|
if (isTargetMoveableElement || isTargetAlreadySelected) {
|
||||||
|
// Prevent drawing selection box when selected target is a moveable element or already selected
|
||||||
event.stop();
|
event.stop();
|
||||||
}
|
}
|
||||||
}).on('selectEnd', (event) => {
|
}).on('selectEnd', (event) => {
|
||||||
|
@ -48,7 +48,7 @@ export class LayerElementListEditor extends PureComponent<Props> {
|
|||||||
layer.reinitializeMoveable();
|
layer.reinitializeMoveable();
|
||||||
};
|
};
|
||||||
|
|
||||||
onSelect = (item: any) => {
|
onSelect = (item: ElementState) => {
|
||||||
const { settings } = this.props.item;
|
const { settings } = this.props.item;
|
||||||
|
|
||||||
if (settings?.scene) {
|
if (settings?.scene) {
|
||||||
|
Loading…
Reference in New Issue
Block a user