Hide dashboard elements if only one canvas view (#5599)

<!-- Raised an issue to propose your change
(https://github.com/cvat-ai/cvat/issues).
It helps to avoid duplication of efforts from multiple independent
contributors.
Discuss your ideas with maintainers to be sure that changes will be
approved and merged.
Read the
[CONTRIBUTION](https://github.com/cvat-ai/cvat/blob/develop/CONTRIBUTING.md)
guide. -->

<!-- Provide a general summary of your changes in the Title above -->

### Motivation and context
<!-- Why is this change required? What problem does it solve? If it
fixes an open
issue, please link to the issue here. Describe your changes in detail,
add
screenshots. -->

### How has this been tested?
<!-- Please describe in detail how you tested your changes.
Include details of your testing environment, and the tests you ran to
see how your change affects other areas of the code, etc. -->

### Checklist
<!-- Go over all the following points, and put an `x` in all the boxes
that apply.
If an item isn't applicable by a reason then ~~explicitly
strikethrough~~ the whole
line. If you don't do that github will show an incorrect process for the
pull request.
If you're unsure about any of these, don't hesitate to ask. We're here
to help! -->
- [x] I submit my changes into the `develop` branch
- [ ] I have added a description of my changes into
[CHANGELOG](https://github.com/cvat-ai/cvat/blob/develop/CHANGELOG.md)
file
- [ ] I have updated the [documentation](
https://github.com/cvat-ai/cvat/blob/develop/README.md#documentation)
accordingly
- [ ] I have added tests to cover my changes
- [ ] I have linked related issues ([read github docs](

https://help.github.com/en/github/managing-your-work-on-github/linking-a-pull-request-to-an-issue#linking-a-pull-request-to-an-issue-using-a-keyword))
- [x] I have increased versions of npm packages if it is necessary
([cvat-canvas](https://github.com/cvat-ai/cvat/tree/develop/cvat-canvas#versioning),

[cvat-core](https://github.com/cvat-ai/cvat/tree/develop/cvat-core#versioning),
[cvat-data](https://github.com/cvat-ai/cvat/tree/develop/cvat-data#versioning)
and
[cvat-ui](https://github.com/cvat-ai/cvat/tree/develop/cvat-ui#versioning))

### License

- [x] I submit _my code changes_ under the same [MIT License](
https://github.com/cvat-ai/cvat/blob/develop/LICENSE) that covers the
project.
  Feel free to contact the maintainers if that's a concern.
main
Boris Sekachev 3 years ago committed by GitHub
parent a8052fc70d
commit 9b55a7f7d4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -1,6 +1,6 @@
{
"name": "cvat-ui",
"version": "1.47.0",
"version": "1.47.1",
"description": "CVAT single-page application",
"main": "src/index.tsx",
"scripts": {

@ -2,6 +2,8 @@
//
// SPDX-License-Identifier: MIT
import config from 'config';
export interface ItemLayout {
viewType: ViewType;
offset: number[];
@ -35,8 +37,8 @@ defaultLayout['2D']['0'] = [{
offset: [0],
x: 0,
y: 0,
w: 12,
h: 12,
w: config.CANVAS_WORKSPACE_COLS,
h: config.CANVAS_WORKSPACE_ROWS,
}];
defaultLayout['2D']['1'] = [
@ -46,7 +48,7 @@ defaultLayout['2D']['1'] = [
x: 9,
y: 0,
w: 3,
h: 4,
h: config.CANVAS_WORKSPACE_DEFAULT_CONTEXT_HEIGHT,
viewIndex: '0',
},
];
@ -111,7 +113,7 @@ defaultLayout['3D']['1'] = [
x: 9,
y: 0,
w: 3,
h: 4,
h: config.CANVAS_WORKSPACE_DEFAULT_CONTEXT_HEIGHT,
viewIndex: '0',
},
];

@ -72,7 +72,8 @@ const fitLayout = (type: DimensionType, layoutConfig: ItemLayout[]): ItemLayout[
const relatedViews = layoutConfig
.filter((item: ItemLayout) => item.viewType === ViewType.RELATED_IMAGE);
const relatedViewsCols = relatedViews.length > 6 ? 2 : 1;
const height = Math.floor(config.CANVAS_WORKSPACE_ROWS / (relatedViews.length / relatedViewsCols));
let height = Math.floor(config.CANVAS_WORKSPACE_ROWS / (relatedViews.length / relatedViewsCols));
height = Math.min(height, config.CANVAS_WORKSPACE_DEFAULT_CONTEXT_HEIGHT);
relatedViews.forEach((view: ItemLayout, i: number) => {
updatedLayout.push({
...view,
@ -210,6 +211,10 @@ function CanvasLayout({ type }: { type?: DimensionType }): JSX.Element {
i: typeof (value.viewIndex) !== 'undefined' ? `${value.viewType}_${value.viewIndex}` : `${value.viewType}`,
}));
const singleClassName = 'cvat-canvas-grid-root-single';
const className = !relatedFiles && children.length <= 1 ?
`cvat-canvas-grid-root ${singleClassName}` : 'cvat-canvas-grid-root';
return (
<Layout.Content>
{ !!rowHeight && (
@ -219,7 +224,7 @@ function CanvasLayout({ type }: { type?: DimensionType }): JSX.Element {
style={{ background: canvasBackgroundColor }}
containerPadding={[config.CANVAS_WORKSPACE_PADDING, config.CANVAS_WORKSPACE_PADDING]}
margin={[config.CANVAS_WORKSPACE_MARGIN, config.CANVAS_WORKSPACE_MARGIN]}
className='cvat-canvas-grid-root'
className={className}
rowHeight={rowHeight}
layout={layout}
onLayoutChange={(updatedLayout: RGL.Layout[]) => {

@ -8,6 +8,28 @@
position: relative;
}
.cvat-canvas-grid-root-single {
.cvat-grid-item-drag-handler {
display: none;
}
.cvat-grid-item-fullscreen-handler {
display: none;
}
.cvat-grid-item-resize-handler {
display: none;
}
.cvat-grid-item-close-button {
display: none;
}
& +.cvat-grid-layout-common-setups {
display: none;
}
}
.cvat-grid-layout-common-setups {
position: absolute;
top: 0;

@ -29,6 +29,7 @@ const DEFAULT_PROJECT_SUBSETS = ['Train', 'Test', 'Validation'];
const CANVAS_WORKSPACE_ROWS = 12;
const CANVAS_WORKSPACE_COLS = 12;
const CANVAS_WORKSPACE_MARGIN = 8;
const CANVAS_WORKSPACE_DEFAULT_CONTEXT_HEIGHT = 4;
const CANVAS_WORKSPACE_PADDING = CANVAS_WORKSPACE_MARGIN / 2;
const OUTSIDE_PIC_URL = 'https://opencv.github.io/cvat/images/image019.jpg';
const DEFAULT_AWS_S3_REGIONS: string[][] = [
@ -142,4 +143,5 @@ export default {
CANVAS_WORKSPACE_COLS,
CANVAS_WORKSPACE_MARGIN,
CANVAS_WORKSPACE_PADDING,
CANVAS_WORKSPACE_DEFAULT_CONTEXT_HEIGHT,
};

Loading…
Cancel
Save