Skip to content

Commit

Permalink
Prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
nofurtherinformation committed Nov 11, 2024
1 parent 7074edc commit b5e9551
Showing 1 changed file with 28 additions and 21 deletions.
49 changes: 28 additions & 21 deletions app/src/app/utils/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -383,27 +383,34 @@ export const colorZoneAssignments = (
* @param {MapStore['shatterIds']} shatterIds - The shatter IDs used to determine layer types.
*/
export const resetZoneColors = ({
ids, zoneAssignments, mapRef, mapDocument, shatterIds
ids,
zoneAssignments,
mapRef,
mapDocument,
shatterIds,
}: {
ids?: Set<string> | string[],
zoneAssignments?: MapStore['zoneAssignments']
mapRef: ReturnType<MapStore['getMapRef']>,
mapDocument: MapStore['mapDocument'],
shatterIds: MapStore['shatterIds']
ids?: Set<string> | string[];
zoneAssignments?: MapStore['zoneAssignments'];
mapRef: ReturnType<MapStore['getMapRef']>;
mapDocument: MapStore['mapDocument'];
shatterIds: MapStore['shatterIds'];
}) => {
const idsToReset = ids ? Array.from(ids) : zoneAssignments ? Array.from(zoneAssignments.keys()) : null
if (!mapDocument || !mapRef || !idsToReset) return
const childLayerExists = mapDocument?.child_layer
const shatterIdsExist = shatterIds.parents.size
const getSourceLayer = childLayerExists && shatterIdsExist
? (id: string) => {
return shatterIds.children.has(id)
? mapDocument.child_layer!
: mapDocument.parent_layer
}
: (_: string) => mapDocument.parent_layer
idsToReset.forEach(id => {
const sourceLayer = getSourceLayer(id)
const idsToReset = ids
? Array.from(ids)
: zoneAssignments
? Array.from(zoneAssignments.keys())
: null;
if (!mapDocument || !mapRef || !idsToReset) return;
const childLayerExists = mapDocument?.child_layer;
const shatterIdsExist = shatterIds.parents.size;
const getSourceLayer =
childLayerExists && shatterIdsExist
? (id: string) => {
return shatterIds.children.has(id) ? mapDocument.child_layer! : mapDocument.parent_layer;
}
: (_: string) => mapDocument.parent_layer;
idsToReset.forEach(id => {
const sourceLayer = getSourceLayer(id);
mapRef?.setFeatureState(
{
source: BLOCK_SOURCE_ID,
Expand All @@ -415,8 +422,8 @@ export const resetZoneColors = ({
zone: null,
}
);
})
}
});
};

// property changes on which to re-color assignments
export const colorZoneAssignmentTriggers = [
Expand Down

0 comments on commit b5e9551

Please sign in to comment.