-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* added color to django app and cvat-core * temp * temp * Added label color to mask dump * Fixed UI for label color picker * npm packages and CHANGELOG * fixed models and migrations * Fixed default background color and using normalization * Added setting label color with hash * fixed error * Added close icon to color picker * Fixed CHANGELOG * requested changes * fixed menu visibility * Fixed label hashing and algorithm * Added wheel package to CI * Fixed dockerfile * moved wheel package from dockerfile to requirements * fixed requirements * Fixed requirements Co-authored-by: Nikita Manovich <nikita.manovich@intel.com>
- Loading branch information
1 parent
822a3b5
commit bee4c37
Showing
38 changed files
with
453 additions
and
328 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
58 changes: 0 additions & 58 deletions
58
cvat-ui/src/components/annotation-page/standard-workspace/objects-side-bar/color-changer.tsx
This file was deleted.
Oops, something went wrong.
131 changes: 131 additions & 0 deletions
131
cvat-ui/src/components/annotation-page/standard-workspace/objects-side-bar/color-picker.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,131 @@ | ||
// Copyright (C) 2020 Intel Corporation | ||
// | ||
// SPDX-License-Identifier: MIT | ||
import React, { useState } from 'react'; | ||
import { Row, Col } from 'antd/lib/grid'; | ||
import Icon from 'antd/lib/icon'; | ||
import Button from 'antd/lib/button'; | ||
import Popover from 'antd/lib/popover'; | ||
import Text from 'antd/lib/typography/Text'; | ||
import { SketchPicker } from 'react-color'; | ||
import Tooltip from 'antd/lib/tooltip'; | ||
|
||
import getCore from 'cvat-core-wrapper'; | ||
|
||
const core = getCore(); | ||
|
||
interface Props { | ||
children: React.ReactNode; | ||
value?: string; | ||
visible?: boolean; | ||
resetVisible?: boolean; | ||
onChange?: (value: string) => void; | ||
onVisibleChange?: (visible: boolean) => void; | ||
placement?: 'left' | 'top' | 'right' | 'bottom' | 'topLeft' | 'topRight' | 'bottomLeft' | 'bottomRight' | 'leftTop' | 'leftBottom' | 'rightTop' | 'rightBottom' | undefined; | ||
} | ||
|
||
function ColorPicker(props: Props, ref: React.Ref<any>): JSX.Element { | ||
const { | ||
children, | ||
value, | ||
visible, | ||
resetVisible, | ||
onChange, | ||
onVisibleChange, | ||
placement, | ||
} = props; | ||
|
||
const [colorState, setColorState] = useState(value); | ||
const [pickerVisible, setPickerVisible] = useState(false); | ||
|
||
const colors = [...core.enums.colors]; | ||
|
||
const changeVisible = (_visible: boolean): void => { | ||
if (typeof onVisibleChange === 'function') { | ||
onVisibleChange(_visible); | ||
} else { | ||
setPickerVisible(_visible); | ||
} | ||
}; | ||
|
||
return ( | ||
<Popover | ||
content={( | ||
<> | ||
<SketchPicker | ||
color={colorState} | ||
onChange={(color) => setColorState(color.hex)} | ||
presetColors={colors} | ||
ref={ref} | ||
disableAlpha | ||
/> | ||
<Row> | ||
<Col span={9}> | ||
{resetVisible !== false && ( | ||
<Button | ||
onClick={() => { | ||
if (typeof onChange === 'function') onChange(''); | ||
changeVisible(false); | ||
}} | ||
> | ||
Reset | ||
</Button> | ||
)} | ||
</Col> | ||
<Col span={9}> | ||
<Button | ||
onClick={() => { | ||
changeVisible(false); | ||
}} | ||
> | ||
Cancel | ||
</Button> | ||
</Col> | ||
<Col span={6}> | ||
<Button | ||
type='primary' | ||
onClick={() => { | ||
if (typeof onChange === 'function') onChange(colorState || ''); | ||
changeVisible(false); | ||
}} | ||
> | ||
Ok | ||
</Button> | ||
</Col> | ||
</Row> | ||
</> | ||
)} | ||
title={( | ||
<Row type='flex' justify='space-between' align='middle'> | ||
<Col span={12}> | ||
<Text strong> | ||
Select color | ||
</Text> | ||
</Col> | ||
<Col span={4}> | ||
<Tooltip title='Cancel'> | ||
<Button | ||
type='link' | ||
onClick={() => { | ||
changeVisible(false); | ||
}} | ||
> | ||
<Icon type='close' /> | ||
</Button> | ||
</Tooltip> | ||
</Col> | ||
</Row> | ||
|
||
)} | ||
placement={placement || 'left'} | ||
overlayClassName='cvat-label-color-picker' | ||
trigger='click' | ||
visible={typeof visible === 'boolean' ? visible : pickerVisible} | ||
onVisibleChange={changeVisible} | ||
> | ||
{children} | ||
</Popover> | ||
); | ||
} | ||
|
||
export default React.forwardRef(ColorPicker); |
Oops, something went wrong.