@@ -5,6 +5,7 @@ import { createMemoizedSelector } from 'app/store/createMemoizedSelector';
55import { useAppDispatch , useAppSelector } from 'app/store/storeHooks' ;
66import IAIDndImage from 'common/components/IAIDndImage' ;
77import IAIDndImageIcon from 'common/components/IAIDndImageIcon' ;
8+ import { roundToMultiple } from 'common/util/roundDownToMultiple' ;
89import { setBoundingBoxDimensions } from 'features/canvas/store/canvasSlice' ;
910import { useControlAdapterControlImage } from 'features/controlAdapters/hooks/useControlAdapterControlImage' ;
1011import { useControlAdapterProcessedControlImage } from 'features/controlAdapters/hooks/useControlAdapterProcessedControlImage' ;
@@ -91,19 +92,14 @@ const ControlAdapterImagePreview = ({ isSmall, id }: Props) => {
9192 return ;
9293 }
9394
95+ const width = roundToMultiple ( controlImage . width , 8 ) ;
96+ const height = roundToMultiple ( controlImage . height , 8 ) ;
97+
9498 if ( activeTabName === 'unifiedCanvas' ) {
95- dispatch (
96- setBoundingBoxDimensions (
97- {
98- width : controlImage . width ,
99- height : controlImage . height ,
100- } ,
101- optimalDimension
102- )
103- ) ;
99+ dispatch ( setBoundingBoxDimensions ( { width, height } , optimalDimension ) ) ;
104100 } else {
105- dispatch ( widthChanged ( controlImage . width ) ) ;
106- dispatch ( heightChanged ( controlImage . height ) ) ;
101+ dispatch ( widthChanged ( width ) ) ;
102+ dispatch ( heightChanged ( height ) ) ;
107103 }
108104 } , [ controlImage , activeTabName , dispatch , optimalDimension ] ) ;
109105
0 commit comments