fix: allow box selection of points when inside editor (#5594)
This commit is contained in:
parent
8f8dd1105f
commit
b5fd904808
@ -3060,7 +3060,7 @@ class App extends React.Component<AppProps, AppState> {
|
|||||||
setCursor(this.canvas, CURSOR_TYPE.MOVE);
|
setCursor(this.canvas, CURSOR_TYPE.MOVE);
|
||||||
}
|
}
|
||||||
} else if (
|
} else if (
|
||||||
shouldShowBoundingBox([element]) &&
|
shouldShowBoundingBox([element], this.state) &&
|
||||||
isHittingElementBoundingBoxWithoutHittingElement(
|
isHittingElementBoundingBoxWithoutHittingElement(
|
||||||
element,
|
element,
|
||||||
this.state,
|
this.state,
|
||||||
|
@ -67,7 +67,7 @@ export const hitTest = (
|
|||||||
|
|
||||||
if (
|
if (
|
||||||
isElementSelected(appState, element) &&
|
isElementSelected(appState, element) &&
|
||||||
shouldShowBoundingBox([element])
|
shouldShowBoundingBox([element], appState)
|
||||||
) {
|
) {
|
||||||
return isPointHittingElementBoundingBox(element, point, threshold);
|
return isPointHittingElementBoundingBox(element, point, threshold);
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,7 @@ import {
|
|||||||
|
|
||||||
import { getElementAbsoluteCoords, Bounds } from "./bounds";
|
import { getElementAbsoluteCoords, Bounds } from "./bounds";
|
||||||
import { rotate } from "../math";
|
import { rotate } from "../math";
|
||||||
import { Zoom } from "../types";
|
import { AppState, Zoom } from "../types";
|
||||||
import { isTextElement } from ".";
|
import { isTextElement } from ".";
|
||||||
import { isLinearElement } from "./typeChecks";
|
import { isLinearElement } from "./typeChecks";
|
||||||
import { DEFAULT_SPACING } from "../renderer/renderScene";
|
import { DEFAULT_SPACING } from "../renderer/renderScene";
|
||||||
@ -267,7 +267,11 @@ export const getTransformHandles = (
|
|||||||
|
|
||||||
export const shouldShowBoundingBox = (
|
export const shouldShowBoundingBox = (
|
||||||
elements: NonDeletedExcalidrawElement[],
|
elements: NonDeletedExcalidrawElement[],
|
||||||
|
appState: AppState,
|
||||||
) => {
|
) => {
|
||||||
|
if (appState.editingLinearElement) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
if (elements.length > 1) {
|
if (elements.length > 1) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -424,7 +424,10 @@ export const _renderScene = ({
|
|||||||
!appState.editingLinearElement
|
!appState.editingLinearElement
|
||||||
) {
|
) {
|
||||||
const locallySelectedElements = getSelectedElements(elements, appState);
|
const locallySelectedElements = getSelectedElements(elements, appState);
|
||||||
const showBoundingBox = shouldShowBoundingBox(locallySelectedElements);
|
const showBoundingBox = shouldShowBoundingBox(
|
||||||
|
locallySelectedElements,
|
||||||
|
appState,
|
||||||
|
);
|
||||||
|
|
||||||
const locallySelectedIds = locallySelectedElements.map(
|
const locallySelectedIds = locallySelectedElements.map(
|
||||||
(element) => element.id,
|
(element) => element.id,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user