@@ -13,6 +13,7 @@ import VerticalFillIcon from '../../UI/CustomSvgIcons/VerticalSize';
1313import VerticalProportionalFillIcon from '../../UI/CustomSvgIcons/VerticalSizePercent' ;
1414import LetterV from '../../UI/CustomSvgIcons/LetterV' ;
1515import LetterH from '../../UI/CustomSvgIcons/LetterH' ;
16+ import Restore from '../../UI/CustomSvgIcons/Restore' ;
1617import CompactTextField from '../../UI/CompactTextField' ;
1718import CompactToggleButtons , {
1819 type CompactToggleButton ,
@@ -37,17 +38,18 @@ const getAnchorDisplayText = (
3738 basicAnchor : BasicAnchor ,
3839 axis : 'horizontal' | 'vertical'
3940) : string => {
41+ const axisLabel = axis === 'horizontal' ? 'horizontally' : 'vertically' ;
4042 switch ( basicAnchor ) {
4143 case 'MinEdge' :
42- return axis === 'horizontal' ? 'Left' : 'Bottom' ;
44+ return axis === 'horizontal' ? 'Left horizontally ' : 'Bottom vertically ' ;
4345 case 'Center' :
44- return ' Center' ;
46+ return ` Center ${ axisLabel } ` ;
4547 case 'MaxEdge' :
46- return axis === 'horizontal' ? 'Right' : 'Top' ;
48+ return axis === 'horizontal' ? 'Right horizontally ' : 'Top vertically ' ;
4749 case 'FixedFill' :
48- return ' Fill' ;
50+ return ` Fill ${ axisLabel } ` ;
4951 case 'ProportionalFill' :
50- return ' Proportional' ;
52+ return ` Proportional ${ axisLabel } ` ;
5153 case 'Advanced' :
5254 return 'Advanced' ;
5355 default :
@@ -75,11 +77,11 @@ const makeButtons = (
7577 isActive : currentBasicAnchor === target ,
7678 onClick : ( ) => {
7779 if ( currentBasicAnchor === target ) {
78- if ( noneEntry ) {
79- onUpdateProperty ( minEdgeProperty , noneEntry . minEdge ) ;
80- onUpdateProperty ( maxEdgeProperty , noneEntry . maxEdge ) ;
81- }
82- } else if ( entry ) {
80+ // Already active: do nothing. User must use the Restore
81+ // button in the text field to reset to None.
82+ return ;
83+ }
84+ if ( entry ) {
8385 onUpdateProperty ( minEdgeProperty , entry . minEdge ) ;
8486 onUpdateProperty ( maxEdgeProperty , entry . maxEdge ) ;
8587 }
@@ -257,11 +259,15 @@ const AnchorGrid = ({
257259 < CompactTextField
258260 value = { vDisplayValue }
259261 onChange = { ( ) => { } }
260- disabled = { ! vIsNone }
261262 placeholder = { vPlaceholder }
262263 renderLeftIcon = { className => < LetterV className = { className } /> }
263264 leftIconTooltip = { < Trans > Vertical</ Trans > }
264- onFocus = {
265+ renderEndAdornmentOnHover = {
266+ ! vIsNone
267+ ? className => < Restore className = { className } />
268+ : undefined
269+ }
270+ onClickEndAdornment = {
265271 ! vIsNone
266272 ? ( ) =>
267273 clearAnchor (
@@ -292,11 +298,15 @@ const AnchorGrid = ({
292298 < CompactTextField
293299 value = { hDisplayValue }
294300 onChange = { ( ) => { } }
295- disabled = { ! hIsNone }
296301 placeholder = { hPlaceholder }
297302 renderLeftIcon = { className => < LetterH className = { className } /> }
298303 leftIconTooltip = { < Trans > Horizontal</ Trans > }
299- onFocus = {
304+ renderEndAdornmentOnHover = {
305+ ! hIsNone
306+ ? className => < Restore className = { className } />
307+ : undefined
308+ }
309+ onClickEndAdornment = {
300310 ! hIsNone
301311 ? ( ) =>
302312 clearAnchor (
0 commit comments