|
@@ -156,6 +156,7 @@ import {
|
|
|
getElementsWithinSelection,
|
|
|
getNormalizedZoom,
|
|
|
getSelectedElements,
|
|
|
+ hasBackground,
|
|
|
isOverScrollBars,
|
|
|
isSomeElementSelected,
|
|
|
} from "../scene";
|
|
@@ -1582,17 +1583,22 @@ class App extends React.Component<AppProps, AppState> {
|
|
|
}
|
|
|
|
|
|
if (event.key === KEYS.G || event.key === KEYS.S) {
|
|
|
- const selectedElements = getSelectedElements(
|
|
|
- this.scene.getElements(),
|
|
|
- this.state,
|
|
|
- );
|
|
|
- if (selectedElements.length) {
|
|
|
- if (event.key === KEYS.G) {
|
|
|
- this.setState({ openPopup: "backgroundColorPicker" });
|
|
|
- }
|
|
|
- if (event.key === KEYS.S) {
|
|
|
- this.setState({ openPopup: "strokeColorPicker" });
|
|
|
- }
|
|
|
+ if (this.state.elementType === "selection") {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (
|
|
|
+ event.key === KEYS.G &&
|
|
|
+ (hasBackground(this.state.elementType) ||
|
|
|
+ getSelectedElements(
|
|
|
+ this.scene.getElements(),
|
|
|
+ this.state,
|
|
|
+ ).some((element) => hasBackground(element.type)))
|
|
|
+ ) {
|
|
|
+ this.setState({ openPopup: "backgroundColorPicker" });
|
|
|
+ }
|
|
|
+ if (event.key === KEYS.S) {
|
|
|
+ this.setState({ openPopup: "strokeColorPicker" });
|
|
|
}
|
|
|
}
|
|
|
},
|