Skip to content

Commit

Permalink
Disabled Fit-all when there are no objects
Browse files Browse the repository at this point in the history
  • Loading branch information
bgoldowsky committed Oct 18, 2024
1 parent 7a207c7 commit 5cc8f68
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/components/tiles/geometry/geometry-toolbar-registration.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -279,9 +279,10 @@ function ZoomOutButton({name}: IToolbarButtonComponentProps) {
);
}

function FitAllButton({name}: IToolbarButtonComponentProps) {
const FitAllButton = observer(function FitAllButton({name}: IToolbarButtonComponentProps) {
const readOnly = useReadOnlyContext();
const { handlers } = useGeometryTileContext();
const { content, handlers } = useGeometryTileContext();
const disabled = !content || content.objects.size === 0;

function handleClick() {
if (readOnly) return;
Expand All @@ -293,11 +294,12 @@ function FitAllButton({name}: IToolbarButtonComponentProps) {
name={name}
title="Fit all"
onClick={handleClick}
>
disabled={disabled}
>
<FitAllSvg/>
</TileToolbarButton>
);
}
});

registerTileToolbarButtons("geometry",
[
Expand Down

0 comments on commit 5cc8f68

Please sign in to comment.