refactor: improve formatting and readability in ShortcutHelper, DisplayZone, and KeyPressListener components

This commit is contained in:
Nalvazhuthi
2025-08-25 16:23:21 +05:30
parent 5b7e8b893c
commit 6f308ddda4
3 changed files with 18 additions and 18 deletions

View File

@@ -326,9 +326,8 @@ const ShortcutHelper: React.FC<ShortcutHelperProps> = ({
</div>
<div
className={`shortcut-wrapper ${
activeShortcuts.length === 1 ? "single-item" : ""
}`}
className={`shortcut-wrapper ${activeShortcuts.length === 1 ? "single-item" : ""
}`}
>
{activeShortcuts.map((item) => (
<div

View File

@@ -241,21 +241,18 @@ const DisplayZone: React.FC<DisplayZoneProps> = ({
{Object.keys(zonesData).length !== 0 ? (
<>
{Object.values(zonesData).map((zone, index) => (
<>
{ }
<div
key={index}
className={`zone ${selectedZone.zoneUuid === zone.zoneUuid ? "active" : ""
}`}
onClick={() => {
<div
key={`${index}_${zone.zoneName}`}
className={`zone ${selectedZone.zoneUuid === zone.zoneUuid ? "active" : ""
}`}
onClick={() => {
handleSelect2dZoneData(zonesData[zone.zoneUuid]?.zoneUuid, zone.zoneName)
}
}
>
{zone.zoneName}
</div>
</>
handleSelect2dZoneData(zonesData[zone.zoneUuid]?.zoneUuid, zone.zoneName)
}
}
>
{zone.zoneName}
</div>
))}
</>
) : (

View File

@@ -221,8 +221,12 @@ const KeyPressListener: React.FC = () => {
// Shortcuts specific for sidebar visibility toggle and others specific to sidebar if added
handleSidebarShortcuts(keyCombination);
// Active module selection (builder, simulation, etc.)
handleModuleSwitch(keyCombination);
if (event.location === 0) { // Location 0 = standard keyboard (not numpad)
handleModuleSwitch(keyCombination);
}
// Common editing tools: cursor | delete | free-hand
handlePrimaryTools(keyCombination);
// Shortcuts specific to the builder module (e.g., drawing and measurement tools)