Invoke is a leading creative engine that uses image and video generation models to empower professionals, artists, and enthusiasts to generate and create visual media using the latest AI-driven technologies. The solution offers an industry-leading application interface, and serves as the foundation for multiple commercial products.
TypeScript ai-artartificial-intelligencegenerative-artimage-generationimg2imginpaintinglatent-diffusionlinuxmacosoutpaintingstable-diffusiontxt2imgwindows
import type { SettingFieldProps } from '@platform/ui/settings/contracts';
import { SettingControl } from '@platform/ui/settings/SettingControl';
import { getImageMapClickSelectsCluster, getImageMapShowClusterLabels } from '@workbench/image-map/imageMapSettings';
import { readBuiltIn, useLayeredSetting } from '@workbench/settings/useLayeredSetting';
import { ClusterStrengthField } from '@workbench/widgets/image-map/ClusterStrengthField';
import { useCallback } from 'react';
export const Field = (props: SettingFieldProps) => {
// Its empty state means "derive it", which no shared control expresses.
if (props.field.id === 'clusterEps') {
return <ClusterStrengthField {...props} />;
}
return <BooleanField {...props} />;
};
const BooleanField = ({ field, surface, target }: SettingFieldProps) => {
const read = field.id === 'clickSelectsCluster' ? getImageMapClickSelectsCluster : getImageMapShowClusterLabels;
const { disabled, layer, set, value } = useLayeredSetting(
'image-map',
field.id,
target,
read,
readBuiltIn(read),
field
);
const onChange = useCallback(
(next: boolean | string | number) => {
if (typeof next === 'boolean' && (field.id === 'clickSelectsCluster' || field.id === 'showClusterLabels')) {
set(next);
}
},
[field.id, set]
);
return (
<SettingControl
layer={layer}
disabled={disabled}
field={field}
surface={surface}
value={value}
onChange={onChange}
/>
);
};