Skip to content

Commit bc44a43

Browse files
committed
ADD: parentRotateAngle for cursor
1 parent 81155f6 commit bc44a43

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
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.4",
3+
"version": "0.1.5",
44
"description": "A rectangle react component which can be resized and rotated",
55
"author": "MockingBot",
66
"license": "MIT",

src/ResizableRect.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,9 +99,10 @@ class ResizableRect extends Component {
9999

100100
render() {
101101
const styles = tLToCenter(this.props)
102-
const { zoomable, rotatable } = this.props
102+
const { zoomable, rotatable, parentRotateAngle } = this.props
103103
return (
104104
<Rect zoomable={zoomable} rotatable={rotatable && this.props.onRotate ? true : false} styles={styles}
105+
parentRotateAngle={parentRotateAngle}
105106
onResizeStart={this.props.onResizeStart}
106107
onResize={this.handleResize}
107108
onResizeEnd={this.props.onResizeEnd}

src/components/Rect/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ export default class Rect extends PureComponent {
131131
}
132132

133133
render () {
134-
const { styles: { position: { centerX, centerY }, size: { width, height }, transform: { rotateAngle } }, zoomable, rotatable } = this.props
134+
const { styles: { position: { centerX, centerY }, size: { width, height }, transform: { rotateAngle } }, zoomable, rotatable, parentRotateAngle } = this.props
135135
const style = { width, height, transform: `rotate(${rotateAngle}deg)`, left: centerX - width / 2, top: centerY - height / 2 }
136136
const direction = zoomable.split(',').map(d => d.trim()).filter(d => d)
137137

@@ -145,7 +145,7 @@ export default class Rect extends PureComponent {
145145
>
146146
{rotatable && <div className="rotate" onMouseDown={this.startRotate}><i></i></div>}
147147
{direction.map(d => {
148-
const cursor = `${getCursor(rotateAngle, d)}-resize`
148+
const cursor = `${getCursor(rotateAngle + parentRotateAngle, d)}-resize`
149149
return (
150150
<div key={d} style={{ cursor }} className={`${zoomableMap[d]} resizable-handler`} onMouseDown={(e) => this.startResize(e, cursor)}></div>
151151
)

0 commit comments

Comments
 (0)