Don't show resize cursor if multiple elements are selected (#353)

This commit is contained in:
Guillermo Peralta Scura 2020-01-12 17:24:11 -03:00 committed by Christopher Chedeau
parent f91b708abb
commit 4c62cbf57e

View File

@ -902,27 +902,20 @@ export class App extends React.Component<{}, AppState> {
return; return;
} }
const { x, y } = viewportCoordsToSceneCoords(e, this.state); const { x, y } = viewportCoordsToSceneCoords(e, this.state);
const resizeElement = getElementWithResizeHandler( const selectedElements = elements.filter(e => e.isSelected).length;
elements, if (selectedElements === 1) {
{ x, y }, const resizeElement = getElementWithResizeHandler(
this.state elements,
); { x, y },
if (resizeElement && resizeElement.resizeHandle) { this.state
document.documentElement.style.cursor = `${resizeElement.resizeHandle}-resize`; );
return; if (resizeElement && resizeElement.resizeHandle) {
document.documentElement.style.cursor = `${resizeElement.resizeHandle}-resize`;
return;
}
} }
const hitElement = getElementAtPosition(elements, x, y); const hitElement = getElementAtPosition(elements, x, y);
if (hitElement) { document.documentElement.style.cursor = hitElement ? "move" : "";
const resizeHandle = resizeTest(hitElement, x, y, {
scrollX: this.state.scrollX,
scrollY: this.state.scrollY
});
document.documentElement.style.cursor = resizeHandle
? `${resizeHandle}-resize`
: `move`;
} else {
document.documentElement.style.cursor = ``;
}
}} }}
/> />
</div> </div>