support resizing multiple elements including texts (#1726)

Co-authored-by: David Luzar <luzar.david@gmail.com>
This commit is contained in:
Daishi Kato 2020-06-08 18:25:20 +09:00 committed by GitHub
parent ebb1341bbd
commit 53ab46126d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 192 additions and 195 deletions

View file

@ -23,7 +23,6 @@ import {
newLinearElement,
resizeElements,
getElementWithResizeHandler,
canResizeMutlipleElements,
getResizeOffsetXY,
getResizeArrowDirection,
getResizeHandlerFromCoords,
@ -1771,20 +1770,18 @@ class App extends React.Component<any, AppState> {
return;
}
} else if (selectedElements.length > 1 && !isOverScrollBar) {
if (canResizeMutlipleElements(selectedElements)) {
const resizeHandle = getResizeHandlerFromCoords(
getCommonBounds(selectedElements),
scenePointerX,
scenePointerY,
this.state.zoom,
event.pointerType,
);
if (resizeHandle) {
document.documentElement.style.cursor = getCursorForResizingElement({
resizeHandle,
});
return;
}
const resizeHandle = getResizeHandlerFromCoords(
getCommonBounds(selectedElements),
scenePointerX,
scenePointerY,
this.state.zoom,
event.pointerType,
);
if (resizeHandle) {
document.documentElement.style.cursor = getCursorForResizingElement({
resizeHandle,
});
return;
}
}
const hitElement = getElementAtPosition(
@ -2054,22 +2051,18 @@ class App extends React.Component<any, AppState> {
isResizingElements = true;
}
} else if (selectedElements.length > 1) {
if (canResizeMutlipleElements(selectedElements)) {
resizeHandle = getResizeHandlerFromCoords(
getCommonBounds(selectedElements),
x,
y,
this.state.zoom,
event.pointerType,
);
if (resizeHandle) {
document.documentElement.style.cursor = getCursorForResizingElement(
{
resizeHandle,
},
);
isResizingElements = true;
}
resizeHandle = getResizeHandlerFromCoords(
getCommonBounds(selectedElements),
x,
y,
this.state.zoom,
event.pointerType,
);
if (resizeHandle) {
document.documentElement.style.cursor = getCursorForResizingElement({
resizeHandle,
});
isResizingElements = true;
}
}
if (isResizingElements) {