Fixed filters with tags

main
Dmitry Kalinin 6 years ago
parent 8b27dbe613
commit 89628fbac5

@ -165,18 +165,21 @@ class AnnotationsFilter {
let xbr = Number.MIN_SAFE_INTEGER; let xbr = Number.MIN_SAFE_INTEGER;
let ytl = Number.MAX_SAFE_INTEGER; let ytl = Number.MAX_SAFE_INTEGER;
let ybr = Number.MIN_SAFE_INTEGER; let ybr = Number.MIN_SAFE_INTEGER;
let [width, height] = [null, null];
if (state.objectType !== 'tag') {
state.points.forEach((coord, idx) => {
if (idx % 2) { // y
ytl = Math.min(ytl, coord);
ybr = Math.max(ybr, coord);
} else { // x
xtl = Math.min(xtl, coord);
xbr = Math.max(xbr, coord);
}
});
[width, height] = [xbr - xtl, ybr - ytl];
}
state.points.forEach((coord, idx) => {
if (idx % 2) { // y
ytl = Math.min(ytl, coord);
ybr = Math.max(ybr, coord);
} else { // x
xtl = Math.min(xtl, coord);
xbr = Math.max(xbr, coord);
}
});
const [width, height] = [xbr - xtl, ybr - ytl];
const attributes = {}; const attributes = {};
Object.keys(state.attributes).reduce((acc, key) => { Object.keys(state.attributes).reduce((acc, key) => {
const attr = labelAttributes[key]; const attr = labelAttributes[key];

@ -68,18 +68,22 @@ function ItemMenu(
Propagate Propagate
</Button> </Button>
</Menu.Item> </Menu.Item>
<Menu.Item> { objectType !== ObjectType.TAG && (
<Button disabled={objectType === ObjectType.TAG} type='link' onClick={toBackground}> <>
<Icon component={BackgroundIcon} /> <Menu.Item>
To background <Button type='link' onClick={toBackground}>
</Button> <Icon component={BackgroundIcon} />
</Menu.Item> To background
<Menu.Item> </Button>
<Button disabled={objectType === ObjectType.TAG} type='link' onClick={toForeground}> </Menu.Item>
<Icon component={ForegroundIcon} /> <Menu.Item>
To foreground <Button type='link' onClick={toForeground}>
</Button> <Icon component={ForegroundIcon} />
</Menu.Item> To foreground
</Button>
</Menu.Item>
</>
)}
<Menu.Item> <Menu.Item>
<Button <Button
type='link' type='link'

Loading…
Cancel
Save