Canvas: Stop selecto box from triggering when programmatically selecting elements (#51579)

Co-authored-by: Ryan McKinley <ryantxu@gmail.com>
This commit is contained in:
Nathan Marrs
2022-06-29 10:19:48 -07:00
committed by GitHub
parent 5d9ffe54ee
commit 66c911f263
3 changed files with 10 additions and 7 deletions

View File

@@ -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) => {

View File

@@ -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) {