Skip to content

Commit b72fba4

Browse files
committed
ADD: resizer can be flipped
1 parent bc44a43 commit b72fba4

File tree

3 files changed

+7
-6
lines changed

3 files changed

+7
-6
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-resizable-rotatable-draggable",
3-
"version": "0.1.5",
3+
"version": "0.1.6",
44
"description": "A rectangle react component which can be resized and rotated",
55
"author": "MockingBot",
66
"license": "MIT",

src/components/Rect/index.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ export default class Rect extends PureComponent {
2727
onRotateEnd: PropTypes.func,
2828
onDragStart: PropTypes.func,
2929
onDrag: PropTypes.func,
30-
onDragEnd: PropTypes.func
30+
onDragEnd: PropTypes.func,
31+
parentRotateAngle: PropTypes.number
3132
}
3233

3334
setElementRef = ref => this.$element = ref
@@ -132,7 +133,7 @@ export default class Rect extends PureComponent {
132133

133134
render () {
134135
const { styles: { position: { centerX, centerY }, size: { width, height }, transform: { rotateAngle } }, zoomable, rotatable, parentRotateAngle } = this.props
135-
const style = { width, height, transform: `rotate(${rotateAngle}deg)`, left: centerX - width / 2, top: centerY - height / 2 }
136+
const style = { width: Math.abs(width), height: Math.abs(height), transform: `rotate(${rotateAngle}deg)`, left: centerX - Math.abs(width) / 2, top: centerY - Math.abs(height) / 2 }
136137
const direction = zoomable.split(',').map(d => d.trim()).filter(d => d)
137138

138139

src/index.example.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,9 @@ handleRotateStart = () => console.log("start")
5656
<ResizableRect
5757
{...{ left, top, width, height, rotateAngle }}
5858
// aspectRatio={false}
59-
// minWidth={10}
60-
// minHeight={10}
61-
zoomable='n, w, s, e, nw, ne, se, sw'
59+
// minWidth={-Infinity}
60+
// minHeight={-Infinity}
61+
zoomable="n, w, s, e, nw, ne, se, sw"
6262
// rotatable={true}
6363
onRotateStart={this.handleRotateStart}
6464
onRotate={this.handleRotate}

0 commit comments

Comments
 (0)