Skip to content
This repository was archived by the owner on Apr 18, 2024. It is now read-only.

Commit ee9cfa5

Browse files
Travis1282bmartel
andauthored
fix: LSDV-5145: Regions hover lock consistency (#1411)
* fix: lsdv-5145: regions hover lock consistancy * fix the hover states for outliner item controls in new ui --------- Co-authored-by: Brandon Martel <[email protected]>
1 parent f44d177 commit ee9cfa5

File tree

3 files changed

+37
-19
lines changed

3 files changed

+37
-19
lines changed

src/components/SidePanels/Components/LockButton.tsx

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { FC } from 'react';
33
import { IconLockLocked, IconLockUnlocked } from '../../../assets/icons';
44
import { ButtonProps } from '../../../common/Button/Button';
55
import { RegionControlButton } from './RegionControlButton';
6+
import { FF_DEV_3873, isFF } from '../../../utils/feature-flags';
67

78
export const LockButton: FC<{
89
item: any,
@@ -18,9 +19,25 @@ export const LockButton: FC<{
1819
const isLocked = locked || item.isReadOnly() || annotation.isReadOnly();
1920
const isRegionReadonly = item.isReadOnly() && !locked;
2021

21-
return item && (hovered || item.isReadOnly() || locked) && (
22-
<RegionControlButton disabled={isRegionReadonly} onClick={onClick} hotkey={hotkey} look={look} style={style}>
23-
{isLocked ? <IconLockLocked/> : <IconLockUnlocked/>}
24-
</RegionControlButton>
22+
if (isFF(FF_DEV_3873)) {
23+
const styles = {
24+
...style,
25+
display: item.isReadOnly() || locked ? undefined : 'none',
26+
};
27+
28+
return (
29+
<RegionControlButton disabled={isRegionReadonly} onClick={onClick} hotkey={hotkey} look={look} style={styles}>
30+
{isLocked ? <IconLockLocked /> : <IconLockUnlocked />}
31+
</RegionControlButton>
32+
);
33+
}
34+
35+
return (
36+
item &&
37+
(hovered || item.isReadOnly() || locked) && (
38+
<RegionControlButton disabled={isRegionReadonly} onClick={onClick} hotkey={hotkey} look={look} style={style}>
39+
{isLocked ? <IconLockLocked /> : <IconLockUnlocked />}
40+
</RegionControlButton>
41+
)
2542
);
2643
});

src/components/SidePanels/OutlinerPanel/OutlinerTree.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ const useDataTree = ({
157157
'--selection-color': color.alpha(0.1).css(),
158158
},
159159
className: rootClass.elem('node').mod(mods).toClassName(),
160-
title: (data: any) => <RootTitle {...data}/>,
160+
title: (data: any) => <RootTitle {...data} />,
161161
};
162162
}, [hovered, selectedKeys]);
163163

@@ -442,7 +442,11 @@ const RegionControls: FC<RegionControlsProps> = observer(({
442442
/>
443443
</Elem>
444444
<Elem name="control" mod={{ type: 'visibility' }}>
445-
{(hovered || hidden) && (
445+
{isFF(FF_DEV_3873) ? (
446+
<RegionControlButton onClick={onToggleHidden} style={hidden ? undefined : ({ display: 'none' })}>
447+
{hidden ? <IconEyeClosed/> : <IconEyeOpened/>}
448+
</RegionControlButton>
449+
) : (hovered || hidden) && (
446450
<RegionControlButton onClick={onToggleHidden}>
447451
{hidden ? <IconEyeClosed/> : <IconEyeOpened/>}
448452
</RegionControlButton>

src/components/SidePanels/OutlinerPanel/TreeView.styl

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,12 @@
1818
background-color var(--selection-color, rgba(#000, 0.04))
1919

2020
&:hover .outliner-item__controls
21-
display grid
21+
display flex
2222

23-
&_newUI
24-
display flex
23+
&:hover .outliner-item__controls_newUI
24+
.outliner-item__control_type_lock button,
25+
.outliner-item__control_type_visibility button
26+
display inline-flex !important
2527

2628
&-switcher
2729
width 24px
@@ -136,17 +138,15 @@
136138
position initial
137139
justify-content space-between
138140

139-
.outliner-item__control_type_dirty
140-
display none
141-
142-
.outliner-item__control_type_lock
143-
display none
144-
145141
.outliner-item__control_type_predict
146142
width 14px
147143

148144
.outliner-item__control_type_score
149145
font-size 12px
146+
147+
.outliner-item__control_type_predict:empty,
148+
.outliner-item__control_type_score:empty
149+
display none
150150

151151
&_withControls
152152
grid-template-columns repeat(6, 32px)
@@ -170,10 +170,7 @@
170170
color $magic_color
171171

172172
&:hover &__controls
173-
display grid
174-
175-
&_newUI
176-
display flex
173+
display flex
177174

178175
.outliner-item__control_type_lock
179176
display flex

0 commit comments

Comments
 (0)