From 6825ed9a3166fa5c5990ea96852ed1c21e436eb6 Mon Sep 17 00:00:00 2001 From: bokuweb Date: Fri, 16 Nov 2018 09:36:44 +0900 Subject: [PATCH] fix: index.d.ts --- README.md | 4 ++++ index.d.ts | 1 + src/index.js | 5 +++-- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 4de8116ea..532069023 100644 --- a/README.md +++ b/README.md @@ -294,6 +294,10 @@ npm test ## Changelog +#### v4.10.0 + +- Add scale props #388 + #### v4.9.3 - Fix auto having "px" appended #382 diff --git a/index.d.ts b/index.d.ts index 3dde0b7d8..e7463bfef 100644 --- a/index.d.ts +++ b/index.d.ts @@ -123,6 +123,7 @@ export interface ResizableProps extends React.HTMLAttributes { handleWrapperStyle?: React.CSSProperties, handleWrapperClass?: string, handleComponent?: HandleComponent, + scale?: number } export default class Resizable extends React.Component { diff --git a/src/index.js b/src/index.js index fe6484e89..1a2dfab45 100644 --- a/src/index.js +++ b/src/index.js @@ -120,7 +120,7 @@ export type ResizableProps = { onResize?: ResizeCallback, onResizeStop?: ResizeCallback, defaultSize?: Size, - scale: number + scale?: number }; type State = { @@ -411,7 +411,8 @@ export default class Resizable extends React.Component { const clientX = event instanceof MouseEvent ? event.clientX : event.touches[0].clientX; const clientY = event instanceof MouseEvent ? event.clientY : event.touches[0].clientY; const { direction, original, width, height } = this.state; - const { lockAspectRatio, lockAspectRatioExtraHeight, lockAspectRatioExtraWidth, scale } = this.props; + const { lockAspectRatio, lockAspectRatioExtraHeight, lockAspectRatioExtraWidth } = this.props; + const scale = this.props.scale || 1; let { maxWidth, maxHeight, minWidth, minHeight } = this.props; // TODO: refactor