Build your own AI office with Univer Office SDK. Bring editing, calculation, collaboration, and file processing into your product for people and AI agents. Built on an extensible open-source core.
TypeScript boardcollaborationdocdocxexceloffce365officepdfpptpptxpresentationsdksheetslidesspreadsheetuniverwordwordprocessorworkspacexlsx
feat: optimize the range of image rotation angle settings (#5914)
wpxp12345699a331e9ab18
diff --git a/packages/design/src/components/input-number/InputNumber.tsx b/packages/design/src/components/input-number/InputNumber.tsxindex efe2c0bb8c..a594a7019f 100644--- a/packages/design/src/components/input-number/InputNumber.tsx+++ b/packages/design/src/components/input-number/InputNumber.tsx@@ -89,7 +89,7 @@ export const InputNumber = forwardRef<HTMLInputElement, IInputNumberProps>(// Update internal value when value prop changesuseEffect(() => {- if (value !== undefined) {+ if (value !== undefined && value !== internalValue) {setInternalValue(value);lastValidValueRef.current = value;setInputValue(formatValue(value));diff --git a/packages/drawing-ui/src/utils/config.ts b/packages/drawing-ui/src/utils/config.tsindex e4918322be..a6df0b2db7 100644--- a/packages/drawing-ui/src/utils/config.ts+++ b/packages/drawing-ui/src/utils/config.ts@@ -18,4 +18,4 @@ export const MIN_DRAWING_WIDTH_LIMIT = 20;export const MIN_DRAWING_HEIGHT_LIMIT = 20;-export const RANGE_DRAWING_ROTATION_LIMIT = [-3600, 3600];+export const RANGE_DRAWING_ROTATION_LIMIT = [-360, 360];diff --git a/packages/drawing-ui/src/views/panel/DrawingTransform.tsx b/packages/drawing-ui/src/views/panel/DrawingTransform.tsxindex 9b701fe2d0..ce304377e0 100644--- a/packages/drawing-ui/src/views/panel/DrawingTransform.tsx+++ b/packages/drawing-ui/src/views/panel/DrawingTransform.tsx@@ -105,8 +105,8 @@ export const DrawingTransform = (props: IDrawingTransformProps) => {limitHeight = topSceneHeight - limitTop - ancestorTop;- if (limitHeight < MIN_DRAWING_WIDTH_LIMIT) {- limitHeight = MIN_DRAWING_WIDTH_LIMIT;+ if (limitHeight < MIN_DRAWING_HEIGHT_LIMIT) {+ limitHeight = MIN_DRAWING_HEIGHT_LIMIT;}if (left + limitWidth + ancestorLeft > topSceneWidth) {@@ -242,8 +242,6 @@ export const DrawingTransform = (props: IDrawingTransformProps) => {return;}- val = Math.max(val, MIN_DRAWING_WIDTH_LIMIT);-const { limitWidth, limitHeight } = checkMoveBoundary(xPosition, yPosition, val, height);val = Math.min(val, limitWidth);@@ -271,11 +269,10 @@ export const DrawingTransform = (props: IDrawingTransformProps) => {if (val == null) {return;}- val = Math.max(val, MIN_DRAWING_WIDTH_LIMIT);const { limitHeight, limitWidth } = checkMoveBoundary(xPosition, yPosition, width, val);- val = Math.min(val, limitHeight); ;+ val = Math.min(val, limitHeight);const updateParam: IDrawingParam = { unitId, subUnitId, drawingId, drawingType, transform: { height: val } };@@ -337,16 +334,6 @@ export const DrawingTransform = (props: IDrawingTransformProps) => {return;}- const [min, max] = RANGE_DRAWING_ROTATION_LIMIT;-- if (val < min) {- val = min;- }-- if (val > max) {- val = max;- }-const updateParam: IDrawingParam = { unitId, subUnitId, drawingId, drawingType, transform: { angle: val } };setRotation(val);@@ -384,11 +371,21 @@ export const DrawingTransform = (props: IDrawingTransformProps) => {><div><span>{localeService.t('image-panel.transform.width')}</span>- <InputNumber precision={1} value={width} onChange={(val) => { handleWidthChange(val); }} />+ <InputNumber+ precision={1}+ value={width}+ min={MIN_DRAWING_WIDTH_LIMIT}+ onChange={(val) => { handleWidthChange(val); }}+ /></div><div><span>{localeService.t('image-panel.transform.height')}</span>- <InputNumber precision={1} value={height} onChange={(val) => { handleHeightChange(val); }} />+ <InputNumber+ precision={1}+ value={height}+ min={MIN_DRAWING_HEIGHT_LIMIT}+ onChange={(val) => { handleHeightChange(val); }}+ /></div><div><span>{localeService.t('image-panel.transform.lock')}</span>@@ -414,7 +411,13 @@ export const DrawingTransform = (props: IDrawingTransformProps) => {</div><div><span>{localeService.t('image-panel.transform.rotate')}</span>- <InputNumber precision={1} value={rotation} onChange={handleRotationChange} />+ <InputNumber+ precision={1}+ value={rotation}+ min={RANGE_DRAWING_ROTATION_LIMIT[0]}+ max={RANGE_DRAWING_ROTATION_LIMIT[1]}+ onChange={handleRotationChange}+ /></div></div></div>