|
@@ -156,6 +156,7 @@ import {
|
156
|
156
|
getElementsWithinSelection,
|
157
|
157
|
getNormalizedZoom,
|
158
|
158
|
getSelectedElements,
|
|
159
|
+ hasBackground,
|
159
|
160
|
isOverScrollBars,
|
160
|
161
|
isSomeElementSelected,
|
161
|
162
|
} from "../scene";
|
|
@@ -1582,17 +1583,22 @@ class App extends React.Component<AppProps, AppState> {
|
1582
|
1583
|
}
|
1583
|
1584
|
|
1584
|
1585
|
if (event.key === KEYS.G || event.key === KEYS.S) {
|
1585
|
|
- const selectedElements = getSelectedElements(
|
1586
|
|
- this.scene.getElements(),
|
1587
|
|
- this.state,
|
1588
|
|
- );
|
1589
|
|
- if (selectedElements.length) {
|
1590
|
|
- if (event.key === KEYS.G) {
|
1591
|
|
- this.setState({ openPopup: "backgroundColorPicker" });
|
1592
|
|
- }
|
1593
|
|
- if (event.key === KEYS.S) {
|
1594
|
|
- this.setState({ openPopup: "strokeColorPicker" });
|
1595
|
|
- }
|
|
1586
|
+ if (this.state.elementType === "selection") {
|
|
1587
|
+ return;
|
|
1588
|
+ }
|
|
1589
|
+
|
|
1590
|
+ if (
|
|
1591
|
+ event.key === KEYS.G &&
|
|
1592
|
+ (hasBackground(this.state.elementType) ||
|
|
1593
|
+ getSelectedElements(
|
|
1594
|
+ this.scene.getElements(),
|
|
1595
|
+ this.state,
|
|
1596
|
+ ).some((element) => hasBackground(element.type)))
|
|
1597
|
+ ) {
|
|
1598
|
+ this.setState({ openPopup: "backgroundColorPicker" });
|
|
1599
|
+ }
|
|
1600
|
+ if (event.key === KEYS.S) {
|
|
1601
|
+ this.setState({ openPopup: "strokeColorPicker" });
|
1596
|
1602
|
}
|
1597
|
1603
|
}
|
1598
|
1604
|
},
|